This commit is contained in:
2024-04-02 14:36:18 +03:00
parent 7a865dcf1d
commit 9aa1216a15
26 changed files with 108 additions and 117 deletions
+11 -16
View File
@@ -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
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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"
)
+2 -2
View File
@@ -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 (
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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.
+3 -3
View File
@@ -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) {
+2 -2
View File
@@ -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) {
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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"
)
+1 -1
View File
@@ -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"
+53 -57
View File
@@ -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
<form action="/" method="POST">
<p>Check some colors</p>
<label for="red">Red</label>
<input type="checkbox" name="colors[]" value="red" id="red">
<label for="green">Green</label>
<input type="checkbox" name="colors[]" value="green" id="green">
<label for="blue">Blue</label>
<input type="checkbox" name="colors[]" value="blue" id="blue">
<input type="submit">
<p>Check some colors</p>
<label for="red">Red</label>
<input type="checkbox" name="colors[]" value="red" id="red" />
<label for="green">Green</label>
<input type="checkbox" name="colors[]" value="green" id="green" />
<label for="blue">Blue</label>
<input type="checkbox" name="colors[]" value="blue" id="blue" />
<input type="submit" />
</form>
```
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
<html>
<h1>
{{ .title }}
</h1>
<h1>{{ .title }}</h1>
</html>
```
@@ -1296,10 +1294,9 @@ templates/posts/index.tmpl
```html
{{ define "posts/index.tmpl" }}
<html><h1>
{{ .title }}
</h1>
<p>Using posts/index.tmpl</p>
<html>
<h1>{{ .title }}</h1>
<p>Using posts/index.tmpl</p>
</html>
{{ end }}
```
@@ -1308,10 +1305,9 @@ templates/users/index.tmpl
```html
{{ define "users/index.tmpl" }}
<html><h1>
{{ .title }}
</h1>
<p>Using users/index.tmpl</p>
<html>
<h1>{{ .title }}</h1>
<p>Using users/index.tmpl</p>
</html>
{{ 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 {
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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"
)
+5 -5
View File
@@ -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())
+2 -2
View File
@@ -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() {
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"net/http"
"sync"
"github.com/gin-gonic/gin"
"git.company.lan/gopkg/gin"
)
var once sync.Once
+9 -9
View File
@@ -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"})
}
+1 -1
View File
@@ -1,4 +1,4 @@
module github.com/gin-gonic/gin
module git.company.lan/gopkg/gin
go 1.20
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"os"
"testing"
"github.com/gin-gonic/gin/binding"
"git.company.lan/gopkg/gin/binding"
"github.com/stretchr/testify/assert"
)
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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"
)
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"unicode"
"unicode/utf8"
"github.com/gin-gonic/gin/internal/bytesconv"
"git.company.lan/gopkg/gin/internal/bytesconv"
)
var (
+1 -1
View File
@@ -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() {