diff --git a/.gitignore b/.gitignore index 49ca1f4..d188dc0 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ bin/* gin-bin .idea/ .vscode +cover.out diff --git a/env/env.go b/env/env.go index 0b8c56d..dd8197e 100644 --- a/env/env.go +++ b/env/env.go @@ -1,7 +1,9 @@ package env import ( - "github.com/gobuffalo/envy" + "fmt" + "os" + "github.com/gobuffalo/helpers/hctx" ) @@ -22,9 +24,21 @@ func New() hctx.Map { // Env will return the specified environment variable, // or an error if it can not be found // <%= env("GOPATH") %> -var Env = envy.MustGet +func Env(key string) (string, error) { + s := os.Getenv(key) + if len(s) == 0 { + return "", fmt.Errorf("could not find ENV %q", key) + } + return s, nil +} // Env will return the specified environment variable, // or the second argument, if not found // <%= envOr("GOPATH", "~/go) %> -var EnvOr = envy.Get +func EnvOr(key string, def string) string { + s := os.Getenv(key) + if len(s) == 0 { + return def + } + return s +} diff --git a/forms/bootstrap/bootstrap.go b/forms/bootstrap/bootstrap.go index 1408883..af57a63 100644 --- a/forms/bootstrap/bootstrap.go +++ b/forms/bootstrap/bootstrap.go @@ -5,7 +5,7 @@ import ( "html/template" "github.com/gobuffalo/helpers/hctx" - "github.com/gobuffalo/tags" + "github.com/gobuffalo/tags/v3" ) // Keys to be used in templates for the functions in this package. diff --git a/forms/bootstrap/form.go b/forms/bootstrap/form.go index 4328cbb..7710301 100644 --- a/forms/bootstrap/form.go +++ b/forms/bootstrap/form.go @@ -4,8 +4,8 @@ import ( "html/template" "github.com/gobuffalo/helpers/hctx" - "github.com/gobuffalo/tags" - "github.com/gobuffalo/tags/form/bootstrap" + "github.com/gobuffalo/tags/v3" + "github.com/gobuffalo/tags/v3/form/bootstrap" ) // Form implements a `github.com/gobuffalo/plush` helper around the diff --git a/forms/bootstrap/form_for.go b/forms/bootstrap/form_for.go index 7c7ab2d..5d840f8 100644 --- a/forms/bootstrap/form_for.go +++ b/forms/bootstrap/form_for.go @@ -5,8 +5,8 @@ import ( "github.com/gobuffalo/helpers/hctx" "github.com/gobuffalo/helpers/paths" - "github.com/gobuffalo/tags" - "github.com/gobuffalo/tags/form/bootstrap" + "github.com/gobuffalo/tags/v3" + "github.com/gobuffalo/tags/v3/form/bootstrap" ) // FormFor implements a `github.com/gobuffalo/plush` helper around the diff --git a/forms/bootstrap/form_for_test.go b/forms/bootstrap/form_for_test.go index 65b709f..100040e 100644 --- a/forms/bootstrap/form_for_test.go +++ b/forms/bootstrap/form_for_test.go @@ -7,7 +7,7 @@ import ( "github.com/gobuffalo/helpers/hctx" "github.com/gobuffalo/helpers/helptest" - "github.com/gobuffalo/tags" + "github.com/gobuffalo/tags/v3" ) type Car struct { diff --git a/forms/form.go b/forms/form.go index 2125166..6c1c60b 100644 --- a/forms/form.go +++ b/forms/form.go @@ -4,8 +4,8 @@ import ( "html/template" "github.com/gobuffalo/helpers/hctx" - "github.com/gobuffalo/tags" - "github.com/gobuffalo/tags/form" + "github.com/gobuffalo/tags/v3" + "github.com/gobuffalo/tags/v3/form" ) // Form implements a `github.com/gobuffalo/plush` helper around the diff --git a/forms/form_for.go b/forms/form_for.go index b68bc2c..04b035f 100644 --- a/forms/form_for.go +++ b/forms/form_for.go @@ -5,8 +5,8 @@ import ( "github.com/gobuffalo/helpers/hctx" "github.com/gobuffalo/helpers/paths" - "github.com/gobuffalo/tags" - "github.com/gobuffalo/tags/form" + "github.com/gobuffalo/tags/v3" + "github.com/gobuffalo/tags/v3/form" ) // FormFor implements a `github.com/gobuffalo/plush` helper around the diff --git a/forms/form_for_test.go b/forms/form_for_test.go index 33bb4a2..27c2a8e 100644 --- a/forms/form_for_test.go +++ b/forms/form_for_test.go @@ -7,7 +7,7 @@ import ( "github.com/gobuffalo/helpers/hctx" "github.com/gobuffalo/helpers/helptest" - "github.com/gobuffalo/tags" + "github.com/gobuffalo/tags/v3" ) type Car struct { diff --git a/forms/forms.go b/forms/forms.go index e36e44b..8aa5956 100644 --- a/forms/forms.go +++ b/forms/forms.go @@ -5,7 +5,7 @@ import ( "html/template" "github.com/gobuffalo/helpers/hctx" - "github.com/gobuffalo/tags" + "github.com/gobuffalo/tags/v3" ) // Keys to be used in templates for the functions in this package. diff --git a/go.mod b/go.mod index d076e7d..4719bd8 100644 --- a/go.mod +++ b/go.mod @@ -3,17 +3,8 @@ module github.com/gobuffalo/helpers go 1.13 require ( - github.com/fatih/structs v1.1.0 // indirect - github.com/gobuffalo/envy v1.8.1 github.com/gobuffalo/flect v0.2.0 github.com/gobuffalo/github_flavored_markdown v1.1.0 - github.com/gobuffalo/tags v2.1.7+incompatible - github.com/gobuffalo/uuid v2.0.5+incompatible // indirect - github.com/gobuffalo/validate v2.0.3+incompatible // indirect - github.com/gofrs/uuid v3.2.0+incompatible // indirect - github.com/onsi/ginkgo v1.10.3 // indirect - github.com/onsi/gomega v1.7.1 // indirect - github.com/pkg/errors v0.8.1 // indirect - github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516 // indirect + github.com/gobuffalo/tags/v3 v3.0.2 github.com/stretchr/testify v1.4.0 ) diff --git a/go.sum b/go.sum index 2e97599..c2dabdd 100644 --- a/go.sum +++ b/go.sum @@ -3,28 +3,16 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gobuffalo/envy v1.8.1 h1:RUr68liRvs0TS1D5qdW3mQv2SjAsu1QWMCx1tG4kDjs= -github.com/gobuffalo/envy v1.8.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= github.com/gobuffalo/flect v0.2.0 h1:EWCvMGGxOjsgwlWaP+f4+Hh6yrrte7JeFL2S6b+0hdM= github.com/gobuffalo/flect v0.2.0/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80= github.com/gobuffalo/github_flavored_markdown v1.1.0 h1:8Zzj4fTRl/OP2R7sGerzSf6g2nEJnaBEJe7UAOiEvbQ= github.com/gobuffalo/github_flavored_markdown v1.1.0/go.mod h1:TSpTKWcRTI0+v7W3x8dkSKMLJSUpuVitlptCkpeY8ic= -github.com/gobuffalo/tags v2.1.7+incompatible h1:GUxxh34f9SI4U0Pj3ZqvopO9SlzuqSf+g4ZGSPSszt4= -github.com/gobuffalo/tags v2.1.7+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= -github.com/gobuffalo/uuid v2.0.5+incompatible h1:c5uWRuEnYggYCrT9AJm0U2v1QTG7OVDAvxhj8tIV5Gc= -github.com/gobuffalo/uuid v2.0.5+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= -github.com/gobuffalo/validate v2.0.3+incompatible h1:6f4JCEz11Zi6iIlexMv7Jz10RBPvgI795AOaubtCwTE= -github.com/gobuffalo/validate v2.0.3+incompatible/go.mod h1:N+EtDe0J8252BgfzQUChBgfd6L93m9weay53EWFVsMM= +github.com/gobuffalo/tags/v3 v3.0.2 h1:gxE6c6fA5radwQeg59aPIeYgCG8YA8AZd3Oh6fh5UXA= +github.com/gobuffalo/tags/v3 v3.0.2/go.mod h1:ZQeN6TCTiwAFnS0dNcbDtSgZDwNKSpqajvVtt6mlYpA= +github.com/gobuffalo/validate/v3 v3.0.0 h1:dF7Bg8NMF9Zv8bZvUMXYJXxZdj+eSZ8z/lGM7/jVFUE= +github.com/gobuffalo/validate/v3 v3.0.0/go.mod h1:HFpjq+AIiA2RHoQnQVTFKF/ZpUPXwyw82LgyDPxQ9r0= github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -32,19 +20,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/microcosm-cc/bluemonday v1.0.2 h1:5lPfLTTAvAbtS0VqT+94yOtFnGfUWYyx0+iToC3Os3s= github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3 h1:OoxbjfXVZyod1fmWYhI7SEyaD8B00ynP3T+D5GiyHOY= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.3.2 h1:XU784Pr0wdahMY2bYcyK6N1KuaRAdLtqD4qd8D18Bfs= -github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516 h1:ofR1ZdrNSkiWcMsRrubK9tb2/SlZVWttAfqUjJi6QYc= -github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d h1:yKm7XZV6j9Ev6lojP2XaIshpT4ymkqhMeSghO5Ps00E= @@ -56,25 +33,15 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= diff --git a/tags/css.go b/tags/css.go index 556f22b..a438d8d 100644 --- a/tags/css.go +++ b/tags/css.go @@ -3,7 +3,7 @@ package tags import ( "html/template" - "github.com/gobuffalo/tags" + "github.com/gobuffalo/tags/v3" ) // CSS creates html for a css link using `github.com/gobuffalo/tags` diff --git a/tags/css_test.go b/tags/css_test.go index 5ef4212..9fb7b2f 100644 --- a/tags/css_test.go +++ b/tags/css_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/gobuffalo/tags" + "github.com/gobuffalo/tags/v3" ) func TestCSS(t *testing.T) { diff --git a/tags/img.go b/tags/img.go index a1c893e..04f3ed4 100644 --- a/tags/img.go +++ b/tags/img.go @@ -3,7 +3,7 @@ package tags import ( "html/template" - "github.com/gobuffalo/tags" + "github.com/gobuffalo/tags/v3" ) // Img creates html for a `` tag using `github.com/gobuffalo/tags` diff --git a/tags/img_test.go b/tags/img_test.go index 117a13d..56a1b69 100644 --- a/tags/img_test.go +++ b/tags/img_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/gobuffalo/tags" + "github.com/gobuffalo/tags/v3" ) func TestImg(t *testing.T) { diff --git a/tags/js.go b/tags/js.go index 7b10cd1..27575de 100644 --- a/tags/js.go +++ b/tags/js.go @@ -3,7 +3,7 @@ package tags import ( "html/template" - "github.com/gobuffalo/tags" + "github.com/gobuffalo/tags/v3" ) // JS creates html for a `