From 9aa1216a15eb55128d42857e0ee92cbeef2fd444 Mon Sep 17 00:00:00 2001 From: Sergey Solodyagin Date: Tue, 2 Apr 2024 14:36:18 +0300 Subject: [PATCH] rename --- README.md | 27 ++++------ auth.go | 2 +- binding/binding_test.go | 2 +- binding/form_mapping.go | 4 +- binding/json.go | 2 +- context.go | 4 +- context_test.go | 6 +-- debug_test.go | 4 +- deprecated.go | 2 +- deprecated_test.go | 2 +- doc.go | 2 +- docs/doc.md | 110 +++++++++++++++++++--------------------- errors.go | 2 +- errors_test.go | 2 +- gin.go | 10 ++-- ginS/README.md | 4 +- ginS/gins.go | 2 +- gin_test.go | 18 +++---- go.mod | 2 +- mode.go | 2 +- mode_test.go | 2 +- render/json.go | 4 +- render/render_test.go | 4 +- render/text.go | 2 +- tree.go | 2 +- utils_test.go | 2 +- 26 files changed, 108 insertions(+), 117 deletions(-) diff --git a/README.md b/README.md index e007bf2..f771b53 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ Gin is a web framework written in [Go](https://go.dev/). It features a martini-l - Rendering built-in - Extendable - ## Getting started ### Prerequisites @@ -37,7 +36,7 @@ Gin is a web framework written in [Go](https://go.dev/). It features a martini-l With [Go module](https://github.com/golang/go/wiki/Modules) support, simply add the following import ``` -import "github.com/gin-gonic/gin" +import "git.company.lan/gopkg/gin" ``` to your code, and then `go [build|run|test]` will automatically fetch the necessary dependencies. @@ -45,7 +44,7 @@ to your code, and then `go [build|run|test]` will automatically fetch the necess Otherwise, run the following Go command to install the `gin` package: ```sh -$ go get -u github.com/gin-gonic/gin +$ go get -u git.company.lan/gopkg/gin ``` ### Running Gin @@ -58,7 +57,7 @@ package main import ( "net/http" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) func main() { @@ -89,7 +88,6 @@ Learn and practice more examples, please read the [Gin Quick Start](docs/doc.md) A number of ready-to-run examples demonstrating various use cases of Gin on the [Gin examples](https://github.com/gin-gonic/examples) repository. - ## Documentation See [API documentation and descriptions](https://godoc.org/github.com/gin-gonic/gin) for package. @@ -116,7 +114,7 @@ A curated list of awesome Gin framework. Gin uses a custom version of [HttpRouter](https://github.com/julienschmidt/httprouter), [see all benchmarks details](/BENCHMARKS.md). | Benchmark name | (1) | (2) | (3) | (4) | -| ------------------------------ | ---------:| ---------------:| ------------:| ---------------:| +| ------------------------------ | --------: | --------------: | -----------: | --------------: | | BenchmarkGin_GithubAll | **43550** | **27364 ns/op** | **0 B/op** | **0 allocs/op** | | BenchmarkAce_GithubAll | 40543 | 29670 ns/op | 0 B/op | 0 allocs/op | | BenchmarkAero_GithubAll | 57632 | 20648 ns/op | 0 B/op | 0 allocs/op | @@ -153,23 +151,20 @@ Gin uses a custom version of [HttpRouter](https://github.com/julienschmidt/httpr - (3): Heap Memory (B/op), lower is better - (4): Average Allocations per Repetition (allocs/op), lower is better - ## Middlewares -You can find many useful Gin middlewares at [gin-contrib](https://github.com/gin-contrib). - +You can find many useful Gin middlewares at [gin-contrib](https://git.company.lan/gopkg/gin-contrib). ## Users Awesome project lists using [Gin](https://github.com/gin-gonic/gin) web framework. -* [gorush](https://github.com/appleboy/gorush): A push notification server written in Go. -* [fnproject](https://github.com/fnproject/fn): The container native, cloud agnostic serverless platform. -* [photoprism](https://github.com/photoprism/photoprism): Personal photo management powered by Go and Google TensorFlow. -* [lura](https://github.com/luraproject/lura): Ultra performant API Gateway with middlewares. -* [picfit](https://github.com/thoas/picfit): An image resizing server written in Go. -* [dkron](https://github.com/distribworks/dkron): Distributed, fault tolerant job scheduling system. - +- [gorush](https://github.com/appleboy/gorush): A push notification server written in Go. +- [fnproject](https://github.com/fnproject/fn): The container native, cloud agnostic serverless platform. +- [photoprism](https://github.com/photoprism/photoprism): Personal photo management powered by Go and Google TensorFlow. +- [lura](https://github.com/luraproject/lura): Ultra performant API Gateway with middlewares. +- [picfit](https://github.com/thoas/picfit): An image resizing server written in Go. +- [dkron](https://github.com/distribworks/dkron): Distributed, fault tolerant job scheduling system. ## Contributing diff --git a/auth.go b/auth.go index 5d3222d..826313e 100644 --- a/auth.go +++ b/auth.go @@ -10,7 +10,7 @@ import ( "net/http" "strconv" - "github.com/gin-gonic/gin/internal/bytesconv" + "git.company.lan/gopkg/gin/internal/bytesconv" ) // AuthUserKey is the cookie name for user credential in basic auth. diff --git a/binding/binding_test.go b/binding/binding_test.go index feb8eed..1d2bf3f 100644 --- a/binding/binding_test.go +++ b/binding/binding_test.go @@ -18,7 +18,7 @@ import ( "testing" "time" - "github.com/gin-gonic/gin/testdata/protoexample" + "git.company.lan/gopkg/gin/testdata/protoexample" "github.com/stretchr/testify/assert" "google.golang.org/protobuf/proto" ) diff --git a/binding/form_mapping.go b/binding/form_mapping.go index 77a1bde..d3c9464 100644 --- a/binding/form_mapping.go +++ b/binding/form_mapping.go @@ -13,8 +13,8 @@ import ( "strings" "time" - "github.com/gin-gonic/gin/internal/bytesconv" - "github.com/gin-gonic/gin/internal/json" + "git.company.lan/gopkg/gin/internal/bytesconv" + "git.company.lan/gopkg/gin/internal/json" ) var ( diff --git a/binding/json.go b/binding/json.go index e21c2ee..cabacb4 100644 --- a/binding/json.go +++ b/binding/json.go @@ -10,7 +10,7 @@ import ( "io" "net/http" - "github.com/gin-gonic/gin/internal/json" + "git.company.lan/gopkg/gin/internal/json" ) // EnableDecoderUseNumber is used to call the UseNumber method on the JSON diff --git a/context.go b/context.go index afc3c35..129208b 100644 --- a/context.go +++ b/context.go @@ -19,9 +19,9 @@ import ( "sync" "time" + "git.company.lan/gopkg/gin/binding" + "git.company.lan/gopkg/gin/render" "github.com/gin-contrib/sse" - "github.com/gin-gonic/gin/binding" - "github.com/gin-gonic/gin/render" ) // Content-Type MIME of the most common data formats. diff --git a/context_test.go b/context_test.go index e9bbae5..9da2549 100644 --- a/context_test.go +++ b/context_test.go @@ -23,9 +23,9 @@ import ( "testing" "time" + "git.company.lan/gopkg/gin/binding" + testdata "git.company.lan/gopkg/gin/testdata/protoexample" "github.com/gin-contrib/sse" - "github.com/gin-gonic/gin/binding" - testdata "github.com/gin-gonic/gin/testdata/protoexample" "github.com/stretchr/testify/assert" "google.golang.org/protobuf/proto" ) @@ -344,7 +344,7 @@ func TestContextHandlerName(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder()) c.handlers = HandlersChain{func(c *Context) {}, handlerNameTest} - assert.Regexp(t, "^(.*/vendor/)?github.com/gin-gonic/gin.handlerNameTest$", c.HandlerName()) + assert.Regexp(t, "^(.*/vendor/)?git.company.lan/gopkg/gin.handlerNameTest$", c.HandlerName()) } func TestContextHandlerNames(t *testing.T) { diff --git a/debug_test.go b/debug_test.go index 2d5e9a5..b28d2f7 100644 --- a/debug_test.go +++ b/debug_test.go @@ -62,7 +62,7 @@ func TestDebugPrintRoutes(t *testing.T) { debugPrintRoute("GET", "/path/to/route/:param", HandlersChain{func(c *Context) {}, handlerNameTest}) SetMode(TestMode) }) - assert.Regexp(t, `^\[GIN-debug\] GET /path/to/route/:param --> (.*/vendor/)?github.com/gin-gonic/gin.handlerNameTest \(2 handlers\)\n$`, re) + assert.Regexp(t, `^\[GIN-debug\] GET /path/to/route/:param --> (.*/vendor/)?git.company.lan/gopkg/gin.handlerNameTest \(2 handlers\)\n$`, re) } func TestDebugPrintRouteFunc(t *testing.T) { @@ -74,7 +74,7 @@ func TestDebugPrintRouteFunc(t *testing.T) { debugPrintRoute("GET", "/path/to/route/:param1/:param2", HandlersChain{func(c *Context) {}, handlerNameTest}) SetMode(TestMode) }) - assert.Regexp(t, `^\[GIN-debug\] GET /path/to/route/:param1/:param2 --> (.*/vendor/)?github.com/gin-gonic/gin.handlerNameTest \(2 handlers\)\n$`, re) + assert.Regexp(t, `^\[GIN-debug\] GET /path/to/route/:param1/:param2 --> (.*/vendor/)?git.company.lan/gopkg/gin.handlerNameTest \(2 handlers\)\n$`, re) } func TestDebugPrintLoadTemplate(t *testing.T) { diff --git a/deprecated.go b/deprecated.go index b4c6cd8..96cc5c0 100644 --- a/deprecated.go +++ b/deprecated.go @@ -7,7 +7,7 @@ package gin import ( "log" - "github.com/gin-gonic/gin/binding" + "git.company.lan/gopkg/gin/binding" ) // BindWith binds the passed struct pointer using the specified binding engine. diff --git a/deprecated_test.go b/deprecated_test.go index 0240b2e..ee34452 100644 --- a/deprecated_test.go +++ b/deprecated_test.go @@ -10,7 +10,7 @@ import ( "net/http/httptest" "testing" - "github.com/gin-gonic/gin/binding" + "git.company.lan/gopkg/gin/binding" "github.com/stretchr/testify/assert" ) diff --git a/doc.go b/doc.go index 1bd0386..28150ba 100644 --- a/doc.go +++ b/doc.go @@ -3,4 +3,4 @@ Package gin implements a HTTP web framework called gin. See https://gin-gonic.com/ for more information about gin. */ -package gin // import "github.com/gin-gonic/gin" +package gin // import "git.company.lan/gopkg/gin" diff --git a/docs/doc.md b/docs/doc.md index 70c9f27..71b2c9b 100644 --- a/docs/doc.md +++ b/docs/doc.md @@ -513,19 +513,19 @@ Sample Output ```go func main() { router := gin.New() - + // skip logging for desired paths by setting SkipPaths in LoggerConfig loggerConfig := gin.LoggerConfig{SkipPaths: []string{"/metrics"}} - + // skip logging based on your logic by setting Skip func in LoggerConfig loggerConfig.Skip = func(c *gin.Context) bool { // as an example skip non server side errors return c.Writer.Status() < http.StatusInternalServerError } - + engine.Use(gin.LoggerWithConfig(loggerConfig)) router.Use(gin.Recovery()) - + // skipped router.GET("/metrics", func(c *gin.Context) { c.Status(http.StatusNotImplemented) @@ -540,7 +540,7 @@ func main() { router.GET("/data", func(c *gin.Context) { c.Status(http.StatusNotImplemented) }) - + router.Run(":8080") } @@ -714,8 +714,8 @@ import ( "net/http" "time" - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" + "git.company.lan/gopkg/gin" + "git.company.lan/gopkg/gin/binding" "github.com/go-playground/validator/v10" ) @@ -782,7 +782,7 @@ import ( "log" "net/http" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) type Person struct { @@ -820,7 +820,7 @@ import ( "net/http" "time" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) type Person struct { @@ -870,7 +870,7 @@ package main import ( "net/http" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) type Person struct { @@ -908,7 +908,7 @@ import ( "fmt" "net/http" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) type testHeader struct { @@ -967,21 +967,21 @@ form.html ```html
-

Check some colors

- - - - - - - +

Check some colors

+ + + + + + +
``` result: ```json -{"color":["red","green","blue"]} +{ "color": ["red", "green", "blue"] } ``` ### Multipart/Urlencoded binding @@ -1109,7 +1109,7 @@ func main() { #### JSONP -Using JSONP to request data from a server in a different domain. Add callback to response body if the query parameter callback exists. +Using JSONP to request data from a server in a different domain. Add callback to response body if the query parameter callback exists. ```go func main() { @@ -1158,7 +1158,7 @@ func main() { #### PureJSON -Normally, JSON replaces special HTML characters with their unicode entities, e.g. `<` becomes `\u003c`. If you want to encode such characters literally, you can use PureJSON instead. +Normally, JSON replaces special HTML characters with their unicode entities, e.g. `<` becomes `\u003c`. If you want to encode such characters literally, you can use PureJSON instead. This feature is unavailable in Go 1.6 and lower. ```go @@ -1193,7 +1193,7 @@ func main() { router.StaticFS("/more_static", http.Dir("my_file_system")) router.StaticFile("/favicon.ico", "./resources/favicon.ico") router.StaticFileFS("/more_favicon.ico", "more_favicon.ico", http.Dir("my_file_system")) - + // Listen and serve on 0.0.0.0:8080 router.Run(":8080") } @@ -1266,9 +1266,7 @@ templates/index.tmpl ```html -

- {{ .title }} -

+

{{ .title }}

``` @@ -1296,10 +1294,9 @@ templates/posts/index.tmpl ```html {{ define "posts/index.tmpl" }} -

- {{ .title }} -

-

Using posts/index.tmpl

+ +

{{ .title }}

+

Using posts/index.tmpl

{{ end }} ``` @@ -1308,10 +1305,9 @@ templates/users/index.tmpl ```html {{ define "users/index.tmpl" }} -

- {{ .title }} -

-

Using users/index.tmpl

+ +

{{ .title }}

+

Using users/index.tmpl

{{ end }} ``` @@ -1354,7 +1350,7 @@ import ( "net/http" "time" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) func formatAsDate(t time.Time) string { @@ -1417,7 +1413,7 @@ r.POST("/test", func(c *gin.Context) { Issuing a Router redirect, use `HandleContext` like below. -``` go +```go r.GET("/test", func(c *gin.Context) { c.Request.URL.Path = "/test2" r.HandleContext(c) @@ -1579,7 +1575,7 @@ import ( "net/http" "github.com/gin-gonic/autotls" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) func main() { @@ -1604,7 +1600,7 @@ import ( "net/http" "github.com/gin-gonic/autotls" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" "golang.org/x/crypto/acme/autocert" ) @@ -1638,7 +1634,7 @@ import ( "net/http" "time" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" "golang.org/x/sync/errgroup" ) @@ -1732,9 +1728,9 @@ endless.ListenAndServe(":4242", router) Alternatives: -* [grace](https://github.com/facebookgo/grace): Graceful restart & zero downtime deploy for Go servers. -* [graceful](https://github.com/tylerb/graceful): Graceful is a Go package enabling graceful shutdown of an http.Handler server. -* [manners](https://github.com/braintree/manners): A polite Go HTTP server that shuts down gracefully. +- [grace](https://github.com/facebookgo/grace): Graceful restart & zero downtime deploy for Go servers. +- [graceful](https://github.com/tylerb/graceful): Graceful is a Go package enabling graceful shutdown of an http.Handler server. +- [manners](https://github.com/braintree/manners): A polite Go HTTP server that shuts down gracefully. #### Manually @@ -1754,7 +1750,7 @@ import ( "syscall" "time" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) func main() { @@ -1812,7 +1808,7 @@ import ( "html/template" "net/http" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) //go:embed assets/* templates/* @@ -1983,12 +1979,12 @@ func SomeHandler(c *gin.Context) { ``` 1. `c.ShouldBindBodyWith` stores body into the context before binding. This has -a slight impact to performance, so you should not use this method if you are -enough to call binding at once. + a slight impact to performance, so you should not use this method if you are + enough to call binding at once. 2. This feature is only needed for some formats -- `JSON`, `XML`, `MsgPack`, -`ProtoBuf`. For other formats, `Query`, `Form`, `FormPost`, `FormMultipart`, -can be called by `c.ShouldBind()` multiple times without any damage to -performance (See [#1341](https://github.com/gin-gonic/gin/pull/1341)). + `ProtoBuf`. For other formats, `Query`, `Form`, `FormPost`, `FormMultipart`, + can be called by `c.ShouldBind()` multiple times without any damage to + performance (See [#1341](https://github.com/gin-gonic/gin/pull/1341)). ### Bind form-data request with custom struct and custom tag @@ -2057,7 +2053,7 @@ import ( "log" "net/http" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) var html = template.Must(template.New("https").Parse(` @@ -2112,7 +2108,7 @@ import ( "log" "net/http" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) func main() { @@ -2144,7 +2140,7 @@ func main() { import ( "fmt" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) func main() { @@ -2177,7 +2173,7 @@ or network CIDRs from where clients which their request headers related to clien IP can be trusted. They can be IPv4 addresses, IPv4 CIDRs, IPv6 addresses or IPv6 CIDRs. -**Attention:** Gin trust all proxies by default if you don't specify a trusted +**Attention:** Gin trust all proxies by default if you don't specify a trusted proxy using the function above, **this is NOT safe**. At the same time, if you don't use any proxy, you can disable this feature by using `Engine.SetTrustedProxies(nil)`, then `Context.ClientIP()` will return the remote address directly to avoid some @@ -2187,7 +2183,7 @@ unnecessary computation. import ( "fmt" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) func main() { @@ -2206,14 +2202,14 @@ func main() { ``` **Notice:** If you are using a CDN service, you can set the `Engine.TrustedPlatform` -to skip TrustedProxies check, it has a higher priority than TrustedProxies. +to skip TrustedProxies check, it has a higher priority than TrustedProxies. Look at the example below: ```go import ( "fmt" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) func main() { @@ -2249,7 +2245,7 @@ package main import ( "net/http" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) func setupRouter() *gin.Engine { diff --git a/errors.go b/errors.go index 06b53c2..55fef97 100644 --- a/errors.go +++ b/errors.go @@ -9,7 +9,7 @@ import ( "reflect" "strings" - "github.com/gin-gonic/gin/internal/json" + "git.company.lan/gopkg/gin/internal/json" ) // ErrorType is an unsigned 64-bit error code as defined in the gin spec. diff --git a/errors_test.go b/errors_test.go index f77a634..6546f9b 100644 --- a/errors_test.go +++ b/errors_test.go @@ -9,7 +9,7 @@ import ( "fmt" "testing" - "github.com/gin-gonic/gin/internal/json" + "git.company.lan/gopkg/gin/internal/json" "github.com/stretchr/testify/assert" ) diff --git a/gin.go b/gin.go index 1633fe1..72214e3 100644 --- a/gin.go +++ b/gin.go @@ -15,8 +15,8 @@ import ( "strings" "sync" - "github.com/gin-gonic/gin/internal/bytesconv" - "github.com/gin-gonic/gin/render" + "git.company.lan/gopkg/gin/internal/bytesconv" + "git.company.lan/gopkg/gin/render" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" ) @@ -528,7 +528,7 @@ func (engine *Engine) RunUnix(file string) (err error) { if engine.isUnsafeTrustedProxies() { debugPrint("[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\n" + - "Please check https://github.com/gin-gonic/gin/blob/master/docs/doc.md#dont-trust-all-proxies for details.") + "Please check https://git.company.lan/gopkg/gin/content/master/docs/doc.md#dont-trust-all-proxies for details.") } listener, err := net.Listen("unix", file) @@ -551,7 +551,7 @@ func (engine *Engine) RunFd(fd int) (err error) { if engine.isUnsafeTrustedProxies() { debugPrint("[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\n" + - "Please check https://github.com/gin-gonic/gin/blob/master/docs/doc.md#dont-trust-all-proxies for details.") + "Please check https://git.company.lan/gopkg/gin/content/master/docs/doc.md#dont-trust-all-proxies for details.") } f := os.NewFile(uintptr(fd), fmt.Sprintf("fd@%d", fd)) @@ -572,7 +572,7 @@ func (engine *Engine) RunListener(listener net.Listener) (err error) { if engine.isUnsafeTrustedProxies() { debugPrint("[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\n" + - "Please check https://github.com/gin-gonic/gin/blob/master/docs/doc.md#dont-trust-all-proxies for details.") + "Please check https://git.company.lan/gopkg/gin/content/master/docs/doc.md#dont-trust-all-proxies for details.") } err = http.Serve(listener, engine.Handler()) diff --git a/ginS/README.md b/ginS/README.md index ef9225e..c14b788 100644 --- a/ginS/README.md +++ b/ginS/README.md @@ -6,8 +6,8 @@ This is API experiment for Gin. package main import ( - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/ginS" + "git.company.lan/gopkg/gin" + "git.company.lan/gopkg/gin/ginS" ) func main() { diff --git a/ginS/gins.go b/ginS/gins.go index ea38c61..8835c68 100644 --- a/ginS/gins.go +++ b/ginS/gins.go @@ -9,7 +9,7 @@ import ( "net/http" "sync" - "github.com/gin-gonic/gin" + "git.company.lan/gopkg/gin" ) var once sync.Once diff --git a/gin_test.go b/gin_test.go index 4550a7e..cd6833c 100644 --- a/gin_test.go +++ b/gin_test.go @@ -493,27 +493,27 @@ func TestListOfRoutes(t *testing.T) { assertRoutePresent(t, list, RouteInfo{ Method: "GET", Path: "/favicon.ico", - Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$", + Handler: "^(.*/vendor/)?git.company.lan/gopkg/gin.handlerTest1$", }) assertRoutePresent(t, list, RouteInfo{ Method: "GET", Path: "/", - Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$", + Handler: "^(.*/vendor/)?git.company.lan/gopkg/gin.handlerTest1$", }) assertRoutePresent(t, list, RouteInfo{ Method: "GET", Path: "/users/", - Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest2$", + Handler: "^(.*/vendor/)?git.company.lan/gopkg/gin.handlerTest2$", }) assertRoutePresent(t, list, RouteInfo{ Method: "GET", Path: "/users/:id", - Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$", + Handler: "^(.*/vendor/)?git.company.lan/gopkg/gin.handlerTest1$", }) assertRoutePresent(t, list, RouteInfo{ Method: "POST", Path: "/users/:id", - Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest2$", + Handler: "^(.*/vendor/)?git.company.lan/gopkg/gin.handlerTest2$", }) } @@ -710,8 +710,8 @@ func TestNewOptionFunc(t *testing.T) { r := New(fc) routes := r.Routes() - assertRoutePresent(t, routes, RouteInfo{Path: "/test1", Method: "GET", Handler: "github.com/gin-gonic/gin.handlerTest1"}) - assertRoutePresent(t, routes, RouteInfo{Path: "/test2", Method: "GET", Handler: "github.com/gin-gonic/gin.handlerTest2"}) + assertRoutePresent(t, routes, RouteInfo{Path: "/test1", Method: "GET", Handler: "git.company.lan/gopkg/gin.handlerTest1"}) + assertRoutePresent(t, routes, RouteInfo{Path: "/test2", Method: "GET", Handler: "git.company.lan/gopkg/gin.handlerTest2"}) } func TestWithOptionFunc(t *testing.T) { @@ -727,6 +727,6 @@ func TestWithOptionFunc(t *testing.T) { }) routes := r.Routes() - assertRoutePresent(t, routes, RouteInfo{Path: "/test1", Method: "GET", Handler: "github.com/gin-gonic/gin.handlerTest1"}) - assertRoutePresent(t, routes, RouteInfo{Path: "/test2", Method: "GET", Handler: "github.com/gin-gonic/gin.handlerTest2"}) + assertRoutePresent(t, routes, RouteInfo{Path: "/test1", Method: "GET", Handler: "git.company.lan/gopkg/gin.handlerTest1"}) + assertRoutePresent(t, routes, RouteInfo{Path: "/test2", Method: "GET", Handler: "git.company.lan/gopkg/gin.handlerTest2"}) } diff --git a/go.mod b/go.mod index 11ce23e..a092863 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/gin-gonic/gin +module git.company.lan/gopkg/gin go 1.20 diff --git a/mode.go b/mode.go index fd26d90..667f6ee 100644 --- a/mode.go +++ b/mode.go @@ -9,7 +9,7 @@ import ( "io" "os" - "github.com/gin-gonic/gin/binding" + "git.company.lan/gopkg/gin/binding" ) // EnvGinMode indicates environment name for gin mode. diff --git a/mode_test.go b/mode_test.go index 2407f46..1ed9908 100644 --- a/mode_test.go +++ b/mode_test.go @@ -9,7 +9,7 @@ import ( "os" "testing" - "github.com/gin-gonic/gin/binding" + "git.company.lan/gopkg/gin/binding" "github.com/stretchr/testify/assert" ) diff --git a/render/json.go b/render/json.go index fc8dea4..eb7597b 100644 --- a/render/json.go +++ b/render/json.go @@ -10,8 +10,8 @@ import ( "html/template" "net/http" - "github.com/gin-gonic/gin/internal/bytesconv" - "github.com/gin-gonic/gin/internal/json" + "git.company.lan/gopkg/gin/internal/bytesconv" + "git.company.lan/gopkg/gin/internal/json" ) // JSON contains the given interface object. diff --git a/render/render_test.go b/render/render_test.go index 145f131..bf74852 100644 --- a/render/render_test.go +++ b/render/render_test.go @@ -15,8 +15,8 @@ import ( "strings" "testing" - "github.com/gin-gonic/gin/internal/json" - testdata "github.com/gin-gonic/gin/testdata/protoexample" + "git.company.lan/gopkg/gin/internal/json" + testdata "git.company.lan/gopkg/gin/testdata/protoexample" "github.com/stretchr/testify/assert" "google.golang.org/protobuf/proto" ) diff --git a/render/text.go b/render/text.go index 77eafdf..605ceb3 100644 --- a/render/text.go +++ b/render/text.go @@ -8,7 +8,7 @@ import ( "fmt" "net/http" - "github.com/gin-gonic/gin/internal/bytesconv" + "git.company.lan/gopkg/gin/internal/bytesconv" ) // String contains the given interface object slice and its format. diff --git a/tree.go b/tree.go index 878023d..2b3edb4 100644 --- a/tree.go +++ b/tree.go @@ -11,7 +11,7 @@ import ( "unicode" "unicode/utf8" - "github.com/gin-gonic/gin/internal/bytesconv" + "git.company.lan/gopkg/gin/internal/bytesconv" ) var ( diff --git a/utils_test.go b/utils_test.go index 058ddb9..fc0e8b4 100644 --- a/utils_test.go +++ b/utils_test.go @@ -86,7 +86,7 @@ func TestFilterFlags(t *testing.T) { } func TestFunctionName(t *testing.T) { - assert.Regexp(t, `^(.*/vendor/)?github.com/gin-gonic/gin.somefunction$`, nameOfFunction(somefunction)) + assert.Regexp(t, `^(.*/vendor/)?git.company.lan/gopkg/gin.somefunction$`, nameOfFunction(somefunction)) } func somefunction() {