From 9c3beffe13c2bcc41c6a17378156e76279733f2d Mon Sep 17 00:00:00 2001 From: Ivan Korolev Date: Tue, 19 Jun 2018 19:48:07 +0300 Subject: [PATCH] add go.mod, assuming current master is a v3 branch Import paths are changed according to Semantic Import Versions rationale. Otherwise `vgo test ./middleware` fails bacause of import path interpretation - it assumes that "github.com/go-chi/chi" points to v1, fails to find some public functions from v3 and dies. As semantic import versioning seems to be the official way, we should respect it. This is an experimental way of implementing #302 without major version bump. Backwards compatibility is done via `v3` symlink - old go is OK with it. --- go.mod | 6 ++++++ 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 +- v3 | 1 + 11 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 go.mod create mode 120000 v3 diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..562e6b12 --- /dev/null +++ b/go.mod @@ -0,0 +1,6 @@ +module github.com/go-chi/chi/v3 + +require ( + golang.org/x/net v0.0.0-20180611182652-db08ff08e862 + golang.org/x/text v0.3.0 +) 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 ( diff --git a/v3 b/v3 new file mode 120000 index 00000000..945c9b46 --- /dev/null +++ b/v3 @@ -0,0 +1 @@ +. \ No newline at end of file