From 59bfc70974340e88dc6f9d113b27a03566141f9e Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Mon, 26 Nov 2018 14:32:42 -0600 Subject: [PATCH] Bump module version to v3 again --- .travis.yml | 7 +++--- README.md | 6 ++--- _examples/custom-handler/main.go | 2 +- _examples/custom-method/main.go | 4 ++-- _examples/fileserver/main.go | 2 +- _examples/graceful/main.go | 4 ++-- _examples/hello-world/main.go | 4 ++-- _examples/limits/main.go | 4 ++-- _examples/logging/main.go | 4 ++-- _examples/rest/main.go | 6 ++--- _examples/router-walk/main.go | 2 +- _examples/todos-resource/main.go | 4 ++-- _examples/todos-resource/todos.go | 2 +- _examples/todos-resource/users.go | 2 +- _examples/versions/main.go | 24 +++++++++---------- .../presenter/{v1 => apiv1}/article.go | 4 ++-- .../presenter/{v2 => apiv2}/article.go | 4 ++-- .../presenter/{v3 => apiv3}/article.go | 4 ++-- chi.go | 4 ++-- go.mod | 6 +++++ go.sum | 4 ++++ middleware/content_charset_test.go | 2 +- middleware/get_head.go | 2 +- middleware/get_head_test.go | 2 +- middleware/profiler.go | 2 +- middleware/realip_test.go | 2 +- middleware/strip.go | 2 +- middleware/strip_test.go | 2 +- middleware/throttle_test.go | 2 +- middleware/url_format.go | 2 +- 30 files changed, 66 insertions(+), 55 deletions(-) rename _examples/versions/presenter/{v1 => apiv1}/article.go (83%) rename _examples/versions/presenter/{v2 => apiv2}/article.go (89%) rename _examples/versions/presenter/{v3 => apiv3}/article.go (93%) create mode 100644 go.mod create mode 100644 go.sum diff --git a/.travis.yml b/.travis.yml index ae95387a..3cf4af30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,15 @@ language: go go: - - 1.7.x - - 1.8.x - 1.9.x - 1.10.x - 1.11.x install: - - go get -u golang.org/x/tools/cmd/goimports + - GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports + +env: + - GO111MODULE=on script: - go get -d -t ./... diff --git a/README.md b/README.md index fcb43c22..bd932040 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ package main import ( "net/http" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) func main() { @@ -77,8 +77,8 @@ of chi and serve as a good form of documentation. import ( //... "context" - "github.com/go-chi/chi" - "github.com/go-chi/chi/middleware" + "github.com/go-chi/chi/v3" + "github.com/go-chi/chi/v3/middleware" ) func main() { diff --git a/_examples/custom-handler/main.go b/_examples/custom-handler/main.go index 81b63dde..5434473b 100644 --- a/_examples/custom-handler/main.go +++ b/_examples/custom-handler/main.go @@ -4,7 +4,7 @@ import ( "errors" "net/http" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) type Handler func(w http.ResponseWriter, r *http.Request) error diff --git a/_examples/custom-method/main.go b/_examples/custom-method/main.go index 95555e54..7a66b8a7 100644 --- a/_examples/custom-method/main.go +++ b/_examples/custom-method/main.go @@ -3,8 +3,8 @@ package main import ( "net/http" - "github.com/go-chi/chi" - "github.com/go-chi/chi/middleware" + "github.com/go-chi/chi/v3" + "github.com/go-chi/chi/v3/middleware" ) func init() { diff --git a/_examples/fileserver/main.go b/_examples/fileserver/main.go index 50e4b091..99672e94 100644 --- a/_examples/fileserver/main.go +++ b/_examples/fileserver/main.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) func main() { diff --git a/_examples/graceful/main.go b/_examples/graceful/main.go index d74a2266..b8cfbab3 100644 --- a/_examples/graceful/main.go +++ b/_examples/graceful/main.go @@ -8,8 +8,8 @@ import ( "os/signal" "time" - "github.com/go-chi/chi" - "github.com/go-chi/chi/middleware" + "github.com/go-chi/chi/v3" + "github.com/go-chi/chi/v3/middleware" "github.com/go-chi/valve" ) diff --git a/_examples/hello-world/main.go b/_examples/hello-world/main.go index 79e403ea..d89644ba 100644 --- a/_examples/hello-world/main.go +++ b/_examples/hello-world/main.go @@ -3,8 +3,8 @@ package main import ( "net/http" - "github.com/go-chi/chi" - "github.com/go-chi/chi/middleware" + "github.com/go-chi/chi/v3" + "github.com/go-chi/chi/v3/middleware" ) func main() { diff --git a/_examples/limits/main.go b/_examples/limits/main.go index db0369df..0d1e0af4 100644 --- a/_examples/limits/main.go +++ b/_examples/limits/main.go @@ -24,8 +24,8 @@ import ( "net/http" "time" - "github.com/go-chi/chi" - "github.com/go-chi/chi/middleware" + "github.com/go-chi/chi/v3" + "github.com/go-chi/chi/v3/middleware" ) func main() { diff --git a/_examples/logging/main.go b/_examples/logging/main.go index 3780fc85..e5dd0cf5 100644 --- a/_examples/logging/main.go +++ b/_examples/logging/main.go @@ -17,8 +17,8 @@ import ( "net/http" "time" - "github.com/go-chi/chi" - "github.com/go-chi/chi/middleware" + "github.com/go-chi/chi/v3" + "github.com/go-chi/chi/v3/middleware" "github.com/sirupsen/logrus" ) diff --git a/_examples/rest/main.go b/_examples/rest/main.go index 0992cab5..691af5b1 100644 --- a/_examples/rest/main.go +++ b/_examples/rest/main.go @@ -47,8 +47,8 @@ import ( "net/http" "strings" - "github.com/go-chi/chi" - "github.com/go-chi/chi/middleware" + "github.com/go-chi/chi/v3" + "github.com/go-chi/chi/v3/middleware" "github.com/go-chi/docgen" "github.com/go-chi/render" ) @@ -105,7 +105,7 @@ func main() { if *routes { // fmt.Println(docgen.JSONRoutesDoc(r)) fmt.Println(docgen.MarkdownRoutesDoc(r, docgen.MarkdownOpts{ - ProjectPath: "github.com/go-chi/chi", + ProjectPath: "github.com/go-chi/chi/v3", Intro: "Welcome to the chi/_examples/rest generated docs.", })) return diff --git a/_examples/router-walk/main.go b/_examples/router-walk/main.go index 0826aa07..5102a53d 100644 --- a/_examples/router-walk/main.go +++ b/_examples/router-walk/main.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) func main() { diff --git a/_examples/todos-resource/main.go b/_examples/todos-resource/main.go index 2e3bf381..1fcffbf9 100644 --- a/_examples/todos-resource/main.go +++ b/_examples/todos-resource/main.go @@ -11,8 +11,8 @@ package main import ( "net/http" - "github.com/go-chi/chi" - "github.com/go-chi/chi/middleware" + "github.com/go-chi/chi/v3" + "github.com/go-chi/chi/v3/middleware" ) func main() { diff --git a/_examples/todos-resource/todos.go b/_examples/todos-resource/todos.go index c6cfbb3e..f84a3263 100644 --- a/_examples/todos-resource/todos.go +++ b/_examples/todos-resource/todos.go @@ -3,7 +3,7 @@ package main import ( "net/http" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) type todosResource struct{} diff --git a/_examples/todos-resource/users.go b/_examples/todos-resource/users.go index 5b00442c..da24b1d1 100644 --- a/_examples/todos-resource/users.go +++ b/_examples/todos-resource/users.go @@ -3,7 +3,7 @@ package main import ( "net/http" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) type usersResource struct{} diff --git a/_examples/versions/main.go b/_examples/versions/main.go index 2f3cda44..d8d42f34 100644 --- a/_examples/versions/main.go +++ b/_examples/versions/main.go @@ -14,12 +14,12 @@ import ( "net/http" "time" - "github.com/go-chi/chi" - "github.com/go-chi/chi/_examples/versions/data" - "github.com/go-chi/chi/_examples/versions/presenter/v1" - "github.com/go-chi/chi/_examples/versions/presenter/v2" - "github.com/go-chi/chi/_examples/versions/presenter/v3" - "github.com/go-chi/chi/middleware" + "github.com/go-chi/chi/v3" + "github.com/go-chi/chi/v3/_examples/versions/data" + "github.com/go-chi/chi/v3/_examples/versions/presenter/apiv1" + "github.com/go-chi/chi/v3/_examples/versions/presenter/apiv2" + "github.com/go-chi/chi/v3/_examples/versions/presenter/apiv3" + "github.com/go-chi/chi/v3/middleware" "github.com/go-chi/render" ) @@ -88,11 +88,11 @@ func listArticles(w http.ResponseWriter, r *http.Request) { apiVersion := r.Context().Value("api.version").(string) switch apiVersion { case "v1": - articles <- v1.NewArticleResponse(article) + articles <- apiv1.NewArticleResponse(article) case "v2": - articles <- v2.NewArticleResponse(article) + articles <- apiv2.NewArticleResponse(article) default: - articles <- v3.NewArticleResponse(article) + articles <- apiv3.NewArticleResponse(article) } time.Sleep(100 * time.Millisecond) @@ -133,11 +133,11 @@ func getArticle(w http.ResponseWriter, r *http.Request) { apiVersion := r.Context().Value("api.version").(string) switch apiVersion { case "v1": - payload = v1.NewArticleResponse(article) + payload = apiv1.NewArticleResponse(article) case "v2": - payload = v2.NewArticleResponse(article) + payload = apiv2.NewArticleResponse(article) default: - payload = v3.NewArticleResponse(article) + payload = apiv3.NewArticleResponse(article) } render.Render(w, r, payload) diff --git a/_examples/versions/presenter/v1/article.go b/_examples/versions/presenter/apiv1/article.go similarity index 83% rename from _examples/versions/presenter/v1/article.go rename to _examples/versions/presenter/apiv1/article.go index ccabb5df..6a5295b7 100644 --- a/_examples/versions/presenter/v1/article.go +++ b/_examples/versions/presenter/apiv1/article.go @@ -1,9 +1,9 @@ -package v1 +package apiv1 import ( "net/http" - "github.com/go-chi/chi/_examples/versions/data" + "github.com/go-chi/chi/v3/_examples/versions/data" ) // Article presented in API version 1. diff --git a/_examples/versions/presenter/v2/article.go b/_examples/versions/presenter/apiv2/article.go similarity index 89% rename from _examples/versions/presenter/v2/article.go rename to _examples/versions/presenter/apiv2/article.go index 98696428..725dd2c7 100644 --- a/_examples/versions/presenter/v2/article.go +++ b/_examples/versions/presenter/apiv2/article.go @@ -1,10 +1,10 @@ -package v2 +package apiv2 import ( "fmt" "net/http" - "github.com/go-chi/chi/_examples/versions/data" + "github.com/go-chi/chi/v3/_examples/versions/data" ) // Article presented in API version 2. diff --git a/_examples/versions/presenter/v3/article.go b/_examples/versions/presenter/apiv3/article.go similarity index 93% rename from _examples/versions/presenter/v3/article.go rename to _examples/versions/presenter/apiv3/article.go index b627270b..34cd323c 100644 --- a/_examples/versions/presenter/v3/article.go +++ b/_examples/versions/presenter/apiv3/article.go @@ -1,11 +1,11 @@ -package v3 +package apiv3 import ( "fmt" "math/rand" "net/http" - "github.com/go-chi/chi/_examples/versions/data" + "github.com/go-chi/chi/v3/_examples/versions/data" ) // Article presented in API version 2. diff --git a/chi.go b/chi.go index 9962229d..3c683f1a 100644 --- a/chi.go +++ b/chi.go @@ -9,8 +9,8 @@ // import ( // "net/http" // -// "github.com/go-chi/chi" -// "github.com/go-chi/chi/middleware" +// "github.com/go-chi/chi/v3" +// "github.com/go-chi/chi/v3/middleware" // ) // // func main() { diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..4f464abb --- /dev/null +++ b/go.mod @@ -0,0 +1,6 @@ +module github.com/go-chi/chi/v3 + +require ( + golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 + golang.org/x/text v0.3.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..f988df84 --- /dev/null +++ b/go.sum @@ -0,0 +1,4 @@ +golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 h1:dgd4x4kJt7G4k4m93AYLzM8Ni6h2qLTfh9n9vXJT3/0= +golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/middleware/content_charset_test.go b/middleware/content_charset_test.go index 6095cb00..2b9b78d3 100644 --- a/middleware/content_charset_test.go +++ b/middleware/content_charset_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "testing" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) func TestContentCharset(t *testing.T) { diff --git a/middleware/get_head.go b/middleware/get_head.go index 86068a96..09120ba3 100644 --- a/middleware/get_head.go +++ b/middleware/get_head.go @@ -3,7 +3,7 @@ package middleware import ( "net/http" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) // GetHead automatically route undefined HEAD requests to GET handlers. diff --git a/middleware/get_head_test.go b/middleware/get_head_test.go index edfeb5b7..bc53bdd5 100644 --- a/middleware/get_head_test.go +++ b/middleware/get_head_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "testing" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) func TestGetHead(t *testing.T) { diff --git a/middleware/profiler.go b/middleware/profiler.go index 1d44b825..67b2f9cb 100644 --- a/middleware/profiler.go +++ b/middleware/profiler.go @@ -6,7 +6,7 @@ import ( "net/http" "net/http/pprof" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) // Profiler is a convenient subrouter used for mounting net/http/pprof. ie. diff --git a/middleware/realip_test.go b/middleware/realip_test.go index 84700735..a9941ad2 100644 --- a/middleware/realip_test.go +++ b/middleware/realip_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "testing" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) func TestXRealIP(t *testing.T) { diff --git a/middleware/strip.go b/middleware/strip.go index 8f19766b..d49a3326 100644 --- a/middleware/strip.go +++ b/middleware/strip.go @@ -3,7 +3,7 @@ package middleware import ( "net/http" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) // StripSlashes is a middleware that will match request paths with a trailing diff --git a/middleware/strip_test.go b/middleware/strip_test.go index 5cbb8923..0ffdd45c 100644 --- a/middleware/strip_test.go +++ b/middleware/strip_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "testing" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) func TestStripSlashes(t *testing.T) { diff --git a/middleware/throttle_test.go b/middleware/throttle_test.go index 626397ee..96af8779 100644 --- a/middleware/throttle_test.go +++ b/middleware/throttle_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) var testContent = []byte("Hello world!") diff --git a/middleware/url_format.go b/middleware/url_format.go index 5749e4f3..ce497872 100644 --- a/middleware/url_format.go +++ b/middleware/url_format.go @@ -5,7 +5,7 @@ import ( "net/http" "strings" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v3" ) var (