Showing 1000 of 2879 detailed findings. The summary includes all 2879 findings.
auth_test.go1
25:10add-constant
auth_test.go:25:10
assert.Contains(t, pairs, authPair{ user: "bar", value: "Basic YmFyOmZvbw==",tree_test.go1
709:5boolean-literal-comparison
tree_test.go:709:5
value := node.getValue("/hello/abx/", nil, getSkippedNodes(), false) if value.tsr != true { t.Fatalf("want true, is false")binding/default_validator.go1
47:28cognitive-complexity
binding/default_validator.go:47:28
// ValidateStruct receives any kind of type, but only performed struct or pointer to struct type.func (v *defaultValidator) ValidateStruct(obj any) error { if obj == nil {binding/binding_test.go1
1054:6confusing-naming
binding/binding_test.go:1054:6
func testFormBindingIgnoreField(t *testing.T, method, path, badPath, body, badBody string) { b := Formbinding/form_mapping.go1
84:6cyclomatic-complexity
binding/form_mapping.go:84:6
func mapping(value reflect.Value, field reflect.StructField, setter setter, tag string) (bool, error) { if field.Tag.Get(tag) == "-" { // just ignoring this fieldgin.go1
22:2deprecated-api-usage
gin.go:22:2
"golang.org/x/net/http2" "golang.org/x/net/http2/h2c")auth_test.go1
93:12discarded-error-result
auth_test.go:93:12
w := httptest.NewRecorder() req, _ := http.NewRequest(http.MethodGet, "/login", nil) req.Header.Set("Authorization", authorizationHeader("admin", "password"))auth.go1
44:1doc-comment-period
auth.go:44:1
// BasicAuthForRealm returns a Basic HTTP Authorization middleware. It takes as arguments a map[string]string where// the key is the user name and the value is the password, as well as the name of the Realm.errors.go1
40:5error-naming
errors.go:40:5
var _ error = (*Error)(nil)binding/default_validator_test.go1
45:14error-strings
binding/default_validator_test.go:45:14
if got := tt.err.Error(); got != tt.want { t.Errorf("SliceValidationError.Error() = %v, want %v", got, tt.want) }errors_test.go1
110:6error-type-naming
errors_test.go:110:6
type TestErr stringauth.go1
48:6exported-declaration-comment
auth.go:48:6
// (see http://tools.ietf.org/html/rfc2617#section-1.2)func BasicAuthForRealm(accounts Accounts, realm string) HandlerFunc { if realm == "" {render/reader.go1
44:16external-call-in-loop
render/reader.go:44:16
for k, v := range r.Headers { if header.Get(k) == "" { header.Set(k, v)binding/binding_test.go1
1:1file-length-limit
binding/binding_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT stylefs.go1
42:23flag-parameter
fs.go:42:23
// otherwise it returns a filesystem that prevents http.FileServer() to list the directory files.func Dir(root string, listDirectory bool) http.FileSystem { fs := http.Dir(root)auth_test.go1
1:1format
auth_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt auth_test.go`
binding/form_mapping.go1
245:6function-length
binding/form_mapping.go:245:6
func setByForm(value reflect.Value, field reflect.StructField, form map[string][]string, tagValue string, opt setOptions) (isSet bool, err error) { vs, ok := form[tagValue]internal/bytesconv/bytesconv_test.go1
9:2import-alias-naming
internal/bytesconv/bytesconv_test.go:9:2
"bytes" cRand "crypto/rand" "math/rand"context.go1
1336:24import-shadowing
context.go:1336:24
// File writes the specified file into the body stream in an efficient way.func (c *Context) File(filepath string) { http.ServeFile(c.Writer, c.Request, filepath)errors.go1
71:3inefficient-map-lookup
errors.go:71:3
if _, ok := jsonData["error"]; !ok { jsonData["error"] = msg.Error() }context_test.go1
816:49insecure-url-scheme
context_test.go:816:49
c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest(http.MethodGet, "http://example.com/?foo=bar&page=10&id=", nil)response_writer.go1
23:21interface-method-limit
response_writer.go:23:21
// ResponseWriter ...type ResponseWriter interface { http.ResponseWritertree.go1
433:7max-control-nesting
tree.go:433:7
// strings.HasPrefix(n.children[len(n.children)-1].path, ":") == n.wildChild if n.wildChild { index := len(*skippedNodes)binding/binding_test.go1
57:6max-public-structs
binding/binding_test.go:57:6
type FooDefaultBarStruct struct { FooStructauth.go1
50:3modifies-parameter
auth.go:50:3
if realm == "" { realm = "Authorization Required" }render/html.go1
73:3modifies-value-receiver
render/html.go:73:3
if r.FuncMap == nil { r.FuncMap = template.FuncMap{} }benchmarks_test.go1
53:10nested-structs
benchmarks_test.go:53:10
router := New() data := struct { Status string `json:"status"`context_test.go1
3291:44nil-context
context_test.go:3291:44
assert.True(t, c.hasRequestContext(), "has request, has fallback") c.Request, _ = http.NewRequestWithContext(nil, "", "", nil) //nolint:staticcheck assert.False(t, c.hasRequestContext(), "has request with nil ctx, has fallback")binding/form_mapping.go1
268:5no-else-after-return
binding/form_mapping.go:268:5
return ok, err } else if ok, err = trySetCustom(vs[0], value); ok { return ok, errbinding/json_test.go1
78:6no-init
binding/json_test.go:78:6
func init() { customConfig.RegisterExtension(&TimeEx{})binding/binding_test.go1
1433:2no-naked-return
binding/binding_test.go:1433:2
req, _ = http.NewRequest(method, path, bytes.NewBufferString(body)) return}binding/binding.go1
72:5no-package-var
binding/binding.go:72:5
// under the hood.var Validator StructValidator = &defaultValidator{}binding/form_mapping.go1
108:5optimize-operands-order
binding/form_mapping.go:108:5
if vKind != reflect.Struct || !field.Anonymous { ok, err := tryToSetValue(value, field, setter, tag)auth.go1
5:9package-comments
auth.go:5:9
package ginginS/gins.go1
5:9package-naming
ginS/gins.go:5:9
package ginSbinding/multipart_form_mapping_test.go1
65:32range-value-address
binding/multipart_form_mapping_test.go:65:32
for i, file := range files { assertMultipartFileHeader(t, &s.SliceValues[i], file) assertMultipartFileHeader(t, s.SlicePtrs[i], file)binding/binding_test.go1
648:20redundant-conversion
binding/binding_test.go:648:20
require.NoError(t, err) assert.InDelta(t, float64(123), obj.MapFoo["bar"].(float64), 0.01)}binding/binding.go1
100:2single-case-switch
binding/binding.go:100:2
switch contentType { case MIMEJSON:context_test.go1
44:1task-comment
context_test.go:44:1
// Unit tests TODO// func (c *Context) File(filepath string) {auth_test.go1
16:6test-parallelism
auth_test.go:16:6
func TestBasicAuth(t *testing.T) { pairs := processAccounts(Accounts{benchmarks_test.go1
124:1top-level-declaration-order
benchmarks_test.go:124:1
type mockWriter struct { headers http.Headerauth_test.go1
89:49unchecked-type-assertion
auth_test.go:89:49
router.GET("/login", func(c *Context) { c.String(http.StatusOK, c.MustGet(AuthUserKey).(string)) })context_test.go1
3452:16unclosed-http-response-body
context_test.go:3452:16
res, err := http.DefaultClient.Do(req) if err != nil {errors.go1
98:42unexported-return
errors.go:98:42
// ie ByType(gin.ErrorTypePublic) returns a slice of errors with type=ErrorTypePublic.func (a errorMsgs) ByType(typ ErrorType) errorMsgs { if len(a) == 0 {context_test.go1
3475:35unsafe-formatted-url-host-port
context_test.go:3475:35
addr := strings.Split(l.Addr().String(), ":") res, err := http.Get(fmt.Sprintf("http://%s:%s/", localhostIP, addr[len(addr)-1])) if err != nil {binding/binding_test.go1
858:64unused-parameter
binding/binding_test.go:858:64
func testFormBindingEmbeddedStruct(t *testing.T, method, path, badPath, body, badBody string) { b := Formbenchmarks_test.go1
138:7unused-receiver
benchmarks_test.go:138:7
func (m *mockWriter) Write(p []byte) (n int, err error) { return len(p), niltree.go1
63:2var-naming
tree.go:63:2
i := 0 max_ := min(len(a), len(b)) for i < max_ && a[i] == b[i] {auth_test.go1
29:10add-constant
auth_test.go:29:10
assert.Contains(t, pairs, authPair{ user: "foo", value: "Basic Zm9vOmJhcg==",binding/form_mapping.go1
84:6cognitive-complexity
binding/form_mapping.go:84:6
func mapping(value reflect.Value, field reflect.StructField, setter setter, tag string) (bool, error) { if field.Tag.Get(tag) == "-" { // just ignoring this fieldbinding/default_validator.go1
79:28confusing-naming
binding/default_validator.go:79:28
// validateStruct receives struct typefunc (v *defaultValidator) validateStruct(obj any) error { v.lazyinit()binding/form_mapping.go1
145:6cyclomatic-complexity
binding/form_mapping.go:145:6
func tryToSetValue(value reflect.Value, field reflect.StructField, setter setter, tag string) (bool, error) { var tagValue stringgin.go1
249:9deprecated-api-usage
gin.go:249:9
h2s := &http2.Server{} return h2c.NewHandler(engine, h2s)}auth_test.go1
112:12discarded-error-result
auth_test.go:112:12
w := httptest.NewRecorder() req, _ := http.NewRequest(http.MethodGet, "/login", nil) req.Header.Set("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte("admin:password")))binding/default_validator.go1
84:1doc-comment-period
binding/default_validator.go:84:1
// Engine returns the underlying validator engine which powers the default// Validator instance. This is useful if you want to register custom validationscontext_test.go1
42:32error-strings
context_test.go:42:32
var errTestRender = errors.New("TestRender")auth.go1
72:6exported-declaration-comment
auth.go:72:6
// the key is the user name and the value is the password.func BasicAuth(accounts Accounts) HandlerFunc { return BasicAuthForRealm(accounts, "")routes_test.go1
563:47external-call-in-loop
routes_test.go:563:47
if w.Code != http.StatusNotFound { assert.Equal(t, tr.location, w.Header().Get("Location")) }binding/form_mapping.go1
1:1file-length-limit
binding/form_mapping.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT stylegin_test.go1
32:48flag-parameter
gin_test.go:32:48
func setupHTMLFiles(t *testing.T, mode string, tls bool, loadMethod func(*Engine)) *httptest.Server { SetMode(mode)benchmarks_test.go1
1:1format
benchmarks_test.go:1:1
// Copyright 2017 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt benchmarks_test.go`
binding/form_mapping_test.go1
1068:6function-length
binding/form_mapping_test.go:1068:6
func TestMappingEmptyValues(t *testing.T) { t.Run("slice with default", func(t *testing.T) {context.go1
1341:30import-shadowing
context.go:1341:30
// FileFromFS writes the specified file from http.FileSystem into the body stream in an efficient way.func (c *Context) FileFromFS(filepath string, fs http.FileSystem) { defer func(old string) {context_test.go1
1165:49insecure-url-scheme
context_test.go:1165:49
c, _ := CreateTestContext(w) c.Request, _ = http.NewRequest(http.MethodGet, "http://example.com/?callback=x", nil)routergroup.go1
27:14interface-method-limit
routergroup.go:27:14
// IRouter defines all router handle interface includes single and group router.type IRouter interface { IRoutestree.go1
460:7max-control-nesting
tree.go:460:7
if path != "/" { for length := len(*skippedNodes); length > 0; length-- { skippedNode := (*skippedNodes)[length-1]binding/binding_test.go1
62:6max-public-structs
binding/binding_test.go:62:6
type FooStructUseNumber struct { Foo any `json:"foo" binding:"required"`auth.go1
52:2modifies-parameter
auth.go:52:2
} realm = "Basic realm=" + strconv.Quote(realm) pairs := processAccounts(accounts)render/reader.go1
26:4modifies-value-receiver
render/reader.go:26:4
if r.Headers == nil { r.Headers = map[string]string{} }binding/binding_test.go1
111:11nested-structs
binding/binding_test.go:111:11
type InvalidNameMapType struct { TestName struct { MapFoo map[string]any `form:"map_foo"`binding/form_mapping.go1
293:5no-else-after-return
binding/form_mapping.go:293:5
return ok, err } else if ok, err = trySetCustom(vs[0], value); ok { return ok, errcodec/json/go_json.go1
18:6no-init
codec/json/go_json.go:18:6
func init() { API = gojsonApi{}context.go1
302:2no-naked-return
context.go:302:2
value, exists = c.Keys[key] return}binding/binding.go1
77:2no-package-var
binding/binding.go:77:2
var ( JSON BindingBody = jsonBinding{} XML BindingBody = xmlBinding{}binding/form_mapping.go1
124:7optimize-operands-order
binding/form_mapping.go:124:7
sf := tValue.Field(i) if sf.PkgPath != "" && !sf.Anonymous { // unexported continuebinding/binding.go1
7:9package-comments
binding/binding.go:7:9
package bindingginS/gins_test.go1
5:9package-naming
ginS/gins_test.go:5:9
package ginSbinding/multipart_form_mapping_test.go1
67:32range-value-address
binding/multipart_form_mapping_test.go:67:32
assertMultipartFileHeader(t, s.SlicePtrs[i], file) assertMultipartFileHeader(t, &s.ArrayValues[i], file) assertMultipartFileHeader(t, s.ArrayPtrs[i], file)binding/binding_test.go1
702:20redundant-conversion
binding/binding_test.go:702:20
require.NoError(t, err) assert.InDelta(t, float64(123), obj.MapFoo["bar"].(float64), 0.01) assert.Equal(t, "thinkerou", obj.MapFoo["name"].(string))binding/binding_nomsgpack.go1
96:2single-case-switch
binding/binding_nomsgpack.go:96:2
switch contentType { case MIMEJSON:context_test.go1
1667:1task-comment
context_test.go:1667:1
// TODOfunc TestContextRenderRedirectWithRelativePath(t *testing.T) {auth_test.go1
38:6test-parallelism
auth_test.go:38:6
func TestBasicAuthFails(t *testing.T) { assert.Panics(t, func() { processAccounts(nil) })binding/binding.go1
72:1top-level-declaration-order
binding/binding.go:72:1
// under the hood.var Validator StructValidator = &defaultValidator{}auth_test.go1
108:49unchecked-type-assertion
auth_test.go:108:49
called = true c.String(http.StatusOK, c.MustGet(AuthUserKey).(string)) })context_test.go1
3475:14unclosed-http-response-body
context_test.go:3475:14
addr := strings.Split(l.Addr().String(), ":") res, err := http.Get(fmt.Sprintf("http://%s:%s/", localhostIP, addr[len(addr)-1])) if err != nil {binding/binding_test.go1
858:79unused-parameter
binding/binding_test.go:858:79
func testFormBindingEmbeddedStruct(t *testing.T, method, path, badPath, body, badBody string) { b := Formbenchmarks_test.go1
142:7unused-receiver
benchmarks_test.go:142:7
func (m *mockWriter) WriteString(s string) (n int, err error) { return len(s), niltree.go1
191:11var-naming
tree.go:191:11
// Check if a child with the next path byte exists for i, max_ := 0, len(n.indices); i < max_; i++ { if c == n.indices[i] {auth_test.go1
50:3add-constant
auth_test.go:50:3
pairs := processAccounts(Accounts{ "admin": "password", "foo": "bar",binding/form_mapping.go1
145:6cognitive-complexity
binding/form_mapping.go:145:6
func tryToSetValue(value reflect.Value, field reflect.StructField, setter setter, tag string) (bool, error) { var tagValue stringcontext.go1
72:2confusing-naming
context.go:72:2
engine *Engine params *Params skippedNodes *[]skippedNodebinding/form_mapping.go1
245:6cyclomatic-complexity
binding/form_mapping.go:245:6
func setByForm(value reflect.Value, field reflect.StructField, form map[string][]string, tagValue string, opt setOptions) (isSet bool, err error) { vs, ok := form[tagValue]gin_test.go1
108:4deprecated-api-usage
gin_test.go:108:4
AllowHTTP: true, DialTLS: func(netw, addr string, cfg *tls.Config) (net.Conn, error) { return net.Dial(netw, addr)auth_test.go1
132:12discarded-error-result
auth_test.go:132:12
w := httptest.NewRecorder() req, _ := http.NewRequest(http.MethodGet, "/login", nil) req.Header.Set("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte("admin:password")))binding/form_mapping.go1
25:2doc-comment-period
binding/form_mapping.go:25:2
// ErrConvertMapStringSlice can not convert to map[string][]string ErrConvertMapStringSlice = errors.New("can not convert to map slices of strings")tree_test.go1
65:14error-strings
tree_test.go:65:14
if !reflect.DeepEqual(*value.params, request.ps) { t.Errorf("Params mismatch for route '%s'", request.path) }auth.go1
98:6exported-declaration-comment
auth.go:98:6
// If the realm is empty, "Proxy Authorization Required" will be used by default.func BasicAuthForProxy(accounts Accounts, realm string) HandlerFunc { if realm == "" {routes_test.go1
593:47external-call-in-loop
routes_test.go:593:47
if w.Code != http.StatusNotFound { assert.Equal(t, tr.location, w.Header().Get("Location")) }binding/form_mapping_test.go1
1:1file-length-limit
binding/form_mapping_test.go:1:1
// Copyright 2019 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT styletree.go1
418:83flag-parameter
tree.go:418:83
// given path.func (n *node) getValue(path string, params *Params, skippedNodes *[]skippedNode, unescape bool) (value nodeValue) { var globalParamsCount int16binding/binding.go1
1:1format
binding/binding.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/binding.go`
context_test.go1
906:6function-length
context_test.go:906:6
func TestContextQueryAndPostForm(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder())context.go1
1341:47import-shadowing
context.go:1341:47
// FileFromFS writes the specified file from http.FileSystem into the body stream in an efficient way.func (c *Context) FileFromFS(filepath string, fs http.FileSystem) { defer func(old string) {context_test.go1
1179:49insecure-url-scheme
context_test.go:1179:49
c, _ := CreateTestContext(w) c.Request, _ = http.NewRequest(http.MethodGet, "http://example.com", nil)routergroup.go1
33:14interface-method-limit
routergroup.go:33:14
// IRoutes defines all router handle interface.type IRoutes interface { Use(...HandlerFunc) IRoutestree.go1
463:8max-control-nesting
tree.go:463:8
*skippedNodes = (*skippedNodes)[:length-1] if strings.HasSuffix(skippedNode.path, path) { path = skippedNode.pathbinding/binding_test.go1
66:6max-public-structs
binding/binding_test.go:66:6
type FooStructDisallowUnknownFields struct { Foo any `json:"foo" binding:"required"`auth.go1
100:3modifies-parameter
auth.go:100:3
if realm == "" { realm = "Proxy Authorization Required" }render/reader.go1
28:3modifies-value-receiver
render/reader.go:28:3
} r.Headers["Content-Length"] = strconv.FormatInt(r.ContentLength, 10) }binding/binding_test.go1
121:12nested-structs
binding/binding_test.go:121:12
type FooStructForStructType struct { StructFoo struct { Idx int `form:"idx"`binding/form_mapping.go1
316:5no-else-after-return
binding/form_mapping.go:316:5
return ok, err } else if ok, err = trySetCustom(val, value); ok { return ok, errcodec/json/json.go1
17:6no-init
codec/json/json.go:17:6
func init() { API = jsonApi{}context.go1
317:2no-naked-return
context.go:317:2
} return}binding/binding.go1
78:2no-package-var
binding/binding.go:78:2
JSON BindingBody = jsonBinding{} XML BindingBody = xmlBinding{} Form Binding = formBinding{}binding/form_mapping.go1
170:8optimize-operands-order
binding/form_mapping.go:170:8
cfTag := field.Tag.Get("collection_format") if cfTag == "" || cfTag == "multi" || cfTag == "csv" { setOpt.defaultValue = strings.ReplaceAll(v, ";", ",")binding/binding_nomsgpack.go1
7:9package-comments
binding/binding_nomsgpack.go:7:9
package bindinggin.go1
424:18range-value-address
gin.go:424:18
if ip == nil { return cidr, &net.ParseError{Type: "IP address", Text: trustedProxy} }binding/binding_test.go2
704:20redundant-conversion
binding/binding_test.go:704:20
assert.Equal(t, "thinkerou", obj.MapFoo["name"].(string)) assert.InDelta(t, float64(3.14), obj.MapFoo["pai"].(float64), 0.01)}1114:2single-case-switch
binding/binding_test.go:1114:2
} switch typ { case "Slice":auth_test.go1
48:6test-parallelism
auth_test.go:48:6
func TestBasicAuthSearchCredential(t *testing.T) { pairs := processAccounts(Accounts{binding/binding_test.go1
1360:1top-level-declaration-order
binding/binding_test.go:1360:1
type hook struct{}auth_test.go1
128:49unchecked-type-assertion
auth_test.go:128:49
called = true c.String(http.StatusOK, c.MustGet(AuthUserKey).(string)) })gin_test.go1
76:14unclosed-http-response-body
gin_test.go:76:14
res, err := http.Get(ts.URL + "/test") if err != nil {binding/binding_test.go1
1054:61unused-parameter
binding/binding_test.go:1054:61
func testFormBindingIgnoreField(t *testing.T, method, path, badPath, body, badBody string) { b := Formbenchmarks_test.go1
146:7unused-receiver
benchmarks_test.go:146:7
func (m *mockWriter) WriteHeader(int) {}tree.go1
763:9var-naming
tree.go:763:9
var off int for max_ := min(npLen, 3); off < max_; off++ { if i := npLen - off; utf8.RuneStart(oldPath[i]) {auth_test.go1
50:12add-constant
auth_test.go:50:12
pairs := processAccounts(Accounts{ "admin": "password", "foo": "bar",binding/form_mapping.go1
245:6cognitive-complexity
binding/form_mapping.go:245:6
func setByForm(value reflect.Value, field reflect.StructField, form map[string][]string, tagValue string, opt setOptions) (isSet bool, err error) { vs, ok := form[tagValue]routergroup.go1
103:27confusing-naming
routergroup.go:103:27
// communication with a proxy).func (group *RouterGroup) Handle(httpMethod, relativePath string, handlers ...HandlerFunc) IRoutes { if matched := regEnLetter.MatchString(httpMethod); !matched {binding/form_mapping.go1
323:6cyclomatic-complexity
binding/form_mapping.go:323:6
func setWithProperType(val string, value reflect.Value, field reflect.StructField, opt setOptions) error { // this if-check is required for parsing nested types like []MyId, where MyId is [12]byteauth_test.go1
150:12discarded-error-result
auth_test.go:150:12
w := httptest.NewRecorder() req, _ := http.NewRequest(http.MethodGet, "/test", nil) req.Header.Set("Proxy-Authorization", authorizationHeader("admin", "password"))binding/form_mapping.go1
28:2doc-comment-period
binding/form_mapping.go:28:2
// ErrConvertToMapString can not convert to map[string]string ErrConvertToMapString = errors.New("can not convert to map of strings")tree_test.go1
770:13error-strings
tree_test.go:770:13
if !found { t.Errorf("Route '%s' not found!", route) } else if string(out) != route {benchmarks_test.go1
134:22exported-declaration-comment
benchmarks_test.go:134:22
func (m *mockWriter) Header() (h http.Header) { return m.headerstest_helpers.go1
45:26external-call-in-loop
test_helpers.go:45:26
for i := 0; i < maxAttempts; i++ { resp, err := client.Get(url) if err == nil {context.go1
1:1file-length-limit
context.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT styletree.go1
703:83flag-parameter
tree.go:703:83
// Recursive case-insensitive lookup function used by n.findCaseInsensitivePathfunc (n *node) findCaseInsensitivePathRec(path string, ciPath []byte, rb [4]byte, fixTrailingSlash bool) []byte { npLen := len(n.path)binding/binding_msgpack_test.go1
1:1format
binding/binding_msgpack_test.go:1:1
// Copyright 2020 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/binding_msgpack_test.go`
context_test.go1
1004:6function-length
context_test.go:1004:6
func TestContextPostFormMultipart(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder())context.go1
1359:34import-shadowing
context.go:1359:34
// On the client side, the file will typically be downloaded with the given filenamefunc (c *Context) FileAttachment(filepath, filename string) { if isASCII(filename) {context_test.go1
1672:50insecure-url-scheme
context_test.go:1672:50
c.Request, _ = http.NewRequest(http.MethodPost, "http://example.com", nil) assert.Panics(t, func() { c.Redirect(299, "/new_path") })tree.go1
466:9max-control-nesting
tree.go:466:9
n = skippedNode.node if value.params != nil { *value.params = (*value.params)[:skippedNode.paramsCount]binding/binding_test.go1
70:6max-public-structs
binding/binding_test.go:70:6
type FooBarStructForTimeType struct { TimeFoo time.Time `form:"time_foo" time_format:"2006-01-02" time_utc:"1" time_location:"Asia/Chongqing"`auth.go1
102:2modifies-parameter
auth.go:102:2
} realm = "Basic realm=" + strconv.Quote(realm) pairs := processAccounts(accounts)binding/binding_test.go1
127:20nested-structs
binding/binding_test.go:127:20
type FooStructForStructPointerType struct { StructPointerFoo *struct { Name string `form:"name"`binding/form_mapping.go1
327:4no-else-after-return
binding/form_mapping.go:327:4
return err } else if ok, err = trySetCustom(val, value); ok { return errcodec/json/jsoniter.go1
18:6no-init
codec/json/jsoniter.go:18:6
func init() { API = jsoniterApi{}context.go1
537:2no-naked-return
context.go:537:2
value, _ = c.GetQuery(key) return}binding/binding.go1
79:2no-package-var
binding/binding.go:79:2
XML BindingBody = xmlBinding{} Form Binding = formBinding{} Query Binding = queryBinding{}binding/form_mapping.go1
308:30optimize-operands-order
binding/form_mapping.go:308:30
var val string if !ok || len(vs) == 0 || (len(vs) > 0 && vs[0] == "") { val = opt.defaultValuebinding/bson.go1
5:9package-comments
binding/bson.go:5:9
package bindingrecovery_test.go1
119:10range-value-address
recovery_test.go:119:10
// Oops. Client connection closed e := &net.OpError{Err: &os.SyscallError{Err: errno}} panic(e)binding/binding_test.go1
967:18redundant-conversion
binding/binding_test.go:967:18
require.NoError(t, err) assert.Equal(t, int64(1510675200), obj.TimeFoo.Unix()) assert.Equal(t, "Asia/Chongqing", obj.TimeFoo.Location().String())binding/default_validator.go1
53:2single-case-switch
binding/default_validator.go:53:2
value := reflect.ValueOf(obj) switch value.Kind() { case reflect.Ptr:auth_test.go1
80:6test-parallelism
auth_test.go:80:6
func TestBasicAuthAuthorizationHeader(t *testing.T) { assert.Equal(t, "Basic YWRtaW46cGFzc3dvcmQ=", authorizationHeader("admin", "password"))binding/default_validator.go1
44:1top-level-declaration-order
binding/default_validator.go:44:1
var _ StructValidator = (*defaultValidator)(nil)auth_test.go1
146:54unchecked-type-assertion
auth_test.go:146:54
router.Any("/*proxyPath", func(c *Context) { c.String(http.StatusOK, c.MustGet(AuthProxyUserKey).(string)) })gin_test.go1
114:14unclosed-http-response-body
gin_test.go:114:14
res, err := httpClient.Get(url) if err != nil {binding/binding_test.go2
1054:76unused-parameter
binding/binding_test.go:1054:76
func testFormBindingIgnoreField(t *testing.T, method, path, badPath, body, badBody string) { b := Form1362:7unused-receiver
binding/binding_test.go:1362:7
func (h hook) Read([]byte) (int, error) { return 0, errors.New("error")tree.go1
843:9var-naming
tree.go:843:9
var off int for max_ := min(npLen, 3); off < max_; off++ { if i := npLen - off; utf8.RuneStart(oldPath[i]) {auth_test.go1
106:13add-constant
auth_test.go:106:13
router.Use(BasicAuth(accounts)) router.GET("/login", func(c *Context) { called = truebinding/form_mapping.go1
323:6cognitive-complexity
binding/form_mapping.go:323:6
func setWithProperType(val string, value reflect.Value, field reflect.StructField, opt setOptions) error { // this if-check is required for parsing nested types like []MyId, where MyId is [12]byteroutes_test.go1
121:6confusing-naming
routes_test.go:121:6
func TestRouteNotOK(t *testing.T) { testRouteNotOK(http.MethodGet, t)binding/form_mapping.go1
434:6cyclomatic-complexity
binding/form_mapping.go:434:6
func setTimeField(val string, structField reflect.StructField, value reflect.Value) error { timeFormat := structField.Tag.Get("time_format")auth_test.go1
169:12discarded-error-result
auth_test.go:169:12
w := httptest.NewRecorder() req, _ := http.NewRequest(http.MethodGet, "/test", nil) req.Header.Set("Proxy-Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte("admin:password")))binding/form_mapping.go1
74:1doc-comment-period
binding/form_mapping.go:74:1
// TrySet tries to set a value by request's form source (like map[string][]string)func (form formSource) TrySet(value reflect.Value, field reflect.StructField, tagValue string, opt setOptions) (isSet bool, err error) {tree_test.go1
772:13error-strings
tree_test.go:772:13
} else if string(out) != route { t.Errorf("Wrong result for route '%s': %s", route, string(out)) }benchmarks_test.go1
142:22exported-declaration-comment
benchmarks_test.go:142:22
func (m *mockWriter) WriteString(s string) (n int, err error) { return len(s), nilcontext_test.go1
1:1file-length-limit
context_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT styletree_test.go1
41:69flag-parameter
tree_test.go:41:69
func checkRequests(t *testing.T, tree *node, requests testRequests, unescapes ...bool) { unescape := falsebinding/binding_nomsgpack.go1
1:1format
binding/binding_nomsgpack.go:1:1
// Copyright 2020 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/binding_nomsgpack.go`
context_test.go1
2062:6function-length
context_test.go:2062:6
func TestContextClientIP(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder())gin.go1
364:40import-shadowing
gin.go:364:40
func (engine *Engine) addRoute(method, path string, handlers HandlersChain) { assert1(path[0] == '/', "path must begin with '/'")context_test.go1
1686:50insecure-url-scheme
context_test.go:1686:50
c.Request, _ = http.NewRequest(http.MethodPost, "http://example.com", nil) c.Redirect(http.StatusFound, "http://google.com")tree.go1
500:7max-control-nesting
tree.go:500:7
// Preallocate capacity if necessary if cap(*params) < int(globalParamsCount) { newParams := make(Params, len(*params), globalParamsCount)binding/binding_test.go1
79:6max-public-structs
binding/binding_test.go:79:6
type FooStructForTimeTypeNotUnixFormat struct { CreateTime time.Time `form:"createTime" time_format:"unixNano"`binding/form_mapping.go1
57:4modifies-parameter
binding/form_mapping.go:57:4
if pointed != nil { ptr = pointed }binding/binding_test.go1
839:8nested-structs
binding/binding_test.go:839:8
Name string `uri:"name"` S struct { Age int `uri:"age"`codec/json/sonic.go1
18:6no-init
codec/json/sonic.go:18:6
func init() { API = sonicApi{}context.go1
575:2no-naked-return
context.go:575:2
values, _ = c.GetQueryArray(key) return}binding/binding.go1
80:2no-package-var
binding/binding.go:80:2
Form Binding = formBinding{} Query Binding = queryBinding{} FormPost Binding = formPostBinding{}binding/multipart_form_mapping.go1
52:6optimize-operands-order
binding/multipart_form_mapping.go:52:6
isSet, err = setArrayOfMultipartFormFiles(slice, field, files) if err != nil || !isSet { return isSet, errbinding/default_validator.go1
5:9package-comments
binding/default_validator.go:5:9
package bindingrecovery_test.go1
119:28range-value-address
recovery_test.go:119:28
// Oops. Client connection closed e := &net.OpError{Err: &os.SyscallError{Err: errno}} panic(e)binding/binding_test.go1
969:18redundant-conversion
binding/binding_test.go:969:18
assert.Equal(t, "Asia/Chongqing", obj.TimeFoo.Location().String()) assert.Equal(t, int64(-62135596800), obj.TimeBar.Unix()) assert.Equal(t, "UTC", obj.TimeBar.Location().String())binding/form_mapping.go1
192:2single-case-switch
binding/form_mapping.go:192:2
func trySetCustom(val string, value reflect.Value) (isSet bool, err error) { switch v := value.Addr().Interface().(type) { case BindUnmarshaler:auth_test.go1
84:6test-parallelism
auth_test.go:84:6
func TestBasicAuthSucceed(t *testing.T) { accounts := Accounts{"admin": "password"}binding/form_mapping.go1
44:1top-level-declaration-order
binding/form_mapping.go:44:1
var emptyField = reflect.StructField{}auth_test.go1
165:54unchecked-type-assertion
auth_test.go:165:54
called = true c.String(http.StatusOK, c.MustGet(AuthProxyUserKey).(string)) })gin_test.go1
134:14unclosed-http-response-body
gin_test.go:134:14
res, err := http.Get(ts.URL + "/test") if err != nil {binding/binding_test.go2
1176:51unused-parameter
binding/binding_test.go:1176:51
func testQueryBinding(t *testing.T, method, path, badPath, body, badBody string) { b := Query1368:7unused-receiver
binding/binding_test.go:1368:7
func (f *failRead) Read(b []byte) (n int, err error) { return 0, errors.New("my fail")auth_test.go1
133:17add-constant
auth_test.go:133:17
req, _ := http.NewRequest(http.MethodGet, "/login", nil) req.Header.Set("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte("admin:password"))) router.ServeHTTP(w, req)binding/form_mapping.go1
434:6cognitive-complexity
binding/form_mapping.go:434:6
func setTimeField(val string, structField reflect.StructField, value reflect.Value) error { timeFormat := structField.Tag.Get("time_format")routes_test.go1
133:6confusing-naming
routes_test.go:133:6
func TestRouteNotOK2(t *testing.T) { testRouteNotOK2(http.MethodGet, t)binding/multipart_form_mapping.go1
35:6cyclomatic-complexity
binding/multipart_form_mapping.go:35:6
func setByMultipartFormFile(value reflect.Value, field reflect.StructField, files []*multipart.FileHeader) (isSet bool, err error) { switch value.Kind() {binding/binding_test.go1
183:12discarded-error-result
binding/binding_test.go:183:12
var obj FooStruct req, _ := http.NewRequest(http.MethodPost, "/", nil) err := JSON.Bind(req, &obj)binding/form_mapping_test.go1
1019:1doc-comment-period
binding/form_mapping_test.go:1019:1
// If someone does not specify parser=TextUnmarshaler even when it's defined for the type, gin should ignore the// UnmarshalText logic and continue using its default binding logic. (This ensures gin does not break backwardstree_test.go1
779:13error-strings
tree_test.go:779:13
if !found { t.Errorf("Route '%s' not found!", route) } else if string(out) != route {benchmarks_test.go1
146:22exported-declaration-comment
benchmarks_test.go:146:22
func (m *mockWriter) WriteHeader(int) {}gin.go1
1:1file-length-limit
gin.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT styleutils.go1
85:14flag-parameter
utils.go:85:14
func assert1(guard bool, text string) { if !guard {binding/binding_test.go1
1:1format
binding/binding_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/binding_test.go`
context_test.go1
2596:6function-length
context_test.go:2596:6
func TestContextShouldBindBodyWith(t *testing.T) { type typeA struct {gin.go1
397:14import-shadowing
gin.go:397:14
func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo { path += root.pathcontext_test.go1
1687:31insecure-url-scheme
context_test.go:1687:31
c.Request, _ = http.NewRequest(http.MethodPost, "http://example.com", nil) c.Redirect(http.StatusFound, "http://google.com") c.Writer.WriteHeaderNow()tree.go1
506:7max-control-nesting
tree.go:506:7
if value.params == nil { value.params = paramsbinding/binding_test.go1
86:6max-public-structs
binding/binding_test.go:86:6
type FooStructForTimeTypeNotFormat struct { TimeFoo time.Time `form:"time_foo"`binding/form_mapping.go1
333:3modifies-parameter
binding/form_mapping.go:333:3
if value.Kind() != reflect.String { val = strings.TrimSpace(val) }binding/binding_test.go1
1130:4nested-structs
binding/binding_test.go:1130:4
assert.Equal(t, struct { Idx int "form:\"idx\""context_appengine.go1
9:6no-init
context_appengine.go:9:6
func init() { defaultPlatform = PlatformGoogleAppEnginecontext.go1
593:2no-naked-return
context.go:593:2
values, ok = c.queryCache[key] return}binding/binding.go1
81:2no-package-var
binding/binding.go:81:2
Query Binding = queryBinding{} FormPost Binding = formPostBinding{} FormMultipart Binding = formMultipartBinding{}binding/multipart_form_mapping.go1
69:6optimize-operands-order
binding/multipart_form_mapping.go:69:6
set, err := setByMultipartFormFile(value.Index(i), field, files[i:i+1]) if err != nil || !set { return set, errbinding/form.go1
5:9package-comments
binding/form.go:5:9
package bindingbinding/binding_test.go1
971:18redundant-conversion
binding/binding_test.go:971:18
assert.Equal(t, "UTC", obj.TimeBar.Location().String()) assert.Equal(t, int64(1562400033000000123), obj.CreateTime.UnixNano()) assert.Equal(t, int64(1562400033), obj.UnixTime.Unix())binding/form_mapping.go1
202:2single-case-switch
binding/form_mapping.go:202:2
func trySetUsingParser(val string, value reflect.Value, parser string) (isSet bool, err error) { switch parser { case "encoding.TextUnmarshaler":auth_test.go1
101:6test-parallelism
auth_test.go:101:6
func TestBasicAuth401(t *testing.T) { called := falsebinding/form_mapping_benchmark_test.go1
51:1top-level-declaration-order
binding/form_mapping_benchmark_test.go:51:1
type structName struct { Name string `form:"name"`binding/binding_test.go1
648:51unchecked-type-assertion
binding/binding_test.go:648:51
require.NoError(t, err) assert.InDelta(t, float64(123), obj.MapFoo["bar"].(float64), 0.01)}gin_test.go1
154:14unclosed-http-response-body
gin_test.go:154:14
res, err := http.Get(ts.URL + "/test") if err != nil {binding/binding_test.go2
1176:66unused-parameter
binding/binding_test.go:1176:66
func testQueryBinding(t *testing.T, method, path, badPath, body, badBody string) { b := Query1372:7unused-receiver
binding/binding_test.go:1372:7
func (f *failRead) Close() error { return nilauth_test.go1
170:40add-constant
auth_test.go:170:40
req, _ := http.NewRequest(http.MethodGet, "/test", nil) req.Header.Set("Proxy-Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte("admin:password"))) router.ServeHTTP(w, req)context.go2
684:6cognitive-complexity
context.go:684:6
// It parses from data with bracket notation like "key[subkey]=value" into a map.func getMapFromFormData(m map[string][]string, key string) (map[string]string, bool) { d := make(map[string]string)998:19cyclomatic-complexity
context.go:998:19
// the remote IP (coming from Request.RemoteAddr) is returned.func (c *Context) ClientIP() string { // Check if we're running on a trusted platform, continue running backwards if errorbinding/binding_test.go1
665:10discarded-error-result
binding/binding_test.go:665:10
// file from os f, _ := os.Open("form.go") defer f.Close()binding/multipart_form_mapping.go1
19:2doc-comment-period
binding/multipart_form_mapping.go:19:2
var ( // ErrMultiFileHeader multipart.FileHeader invalid ErrMultiFileHeader = errors.New("unsupported field type for multipart.FileHeader")tree_test.go1
781:13error-strings
tree_test.go:781:13
} else if string(out) != route { t.Errorf("Wrong result for route '%s': %s", route, string(out)) }binding/binding.go1
13:2exported-declaration-comment
binding/binding.go:13:2
const ( MIMEJSON = "application/json" MIMEHTML = "text/html"gin_integration_test.go1
1:1file-length-limit
gin_integration_test.go:1:1
// Copyright 2017 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT stylebinding/default_validator.go1
1:1format
binding/default_validator.go:1:1
// Copyright 2017 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/default_validator.go`
context_test.go1
3599:6function-length
context_test.go:3599:6
func TestContextSetCookieData(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder())gin_test.go1
32:48import-shadowing
gin_test.go:32:48
func setupHTMLFiles(t *testing.T, mode string, tls bool, loadMethod func(*Engine)) *httptest.Server { SetMode(mode)context_test.go1
1691:18insecure-url-scheme
context_test.go:1691:18
assert.Equal(t, http.StatusFound, w.Code) assert.Equal(t, "http://google.com", w.Header().Get("Location"))}tree.go1
513:7max-control-nesting
tree.go:513:7
val := path[:end] if unescape { if v, err := url.QueryUnescape(val); err == nil {binding/binding_test.go1
90:6max-public-structs
binding/binding_test.go:90:6
type FooStructForTimeTypeFailFormat struct { TimeFoo time.Time `form:"time_foo" time_format:"2017-11-15"`binding/form_mapping.go1
392:3modifies-parameter
binding/form_mapping.go:392:3
if val == "" { val = "0" }binding/binding_test.go1
1139:4nested-structs
binding/binding_test.go:1139:4
assert.Equal(t, struct { Name string "form:\"name\""ginS/gins_test.go1
17:6no-init
ginS/gins_test.go:17:6
func init() { gin.SetMode(gin.TestMode)context.go1
599:2no-naked-return
context.go:599:2
dicts, _ = c.GetQueryMap(key) return}binding/binding.go1
82:2no-package-var
binding/binding.go:82:2
FormPost Binding = formPostBinding{} FormMultipart Binding = formMultipartBinding{} ProtoBuf BindingBody = protobufBinding{}context.go1
1066:5optimize-operands-order
context.go:1066:5
func (c *Context) IsWebsocket() bool { if strings.Contains(strings.ToLower(c.requestHeader("Connection")), "upgrade") && strings.EqualFold(c.requestHeader("Upgrade"), "websocket") {binding/form_mapping.go1
5:9package-comments
binding/form_mapping.go:5:9
package bindingbinding/binding_test.go1
972:18redundant-conversion
binding/binding_test.go:972:18
assert.Equal(t, int64(1562400033000000123), obj.CreateTime.UnixNano()) assert.Equal(t, int64(1562400033), obj.UnixTime.Unix()) assert.Equal(t, int64(1562400033001), obj.UnixMilliTime.UnixMilli())binding/form_mapping.go1
220:2single-case-switch
binding/form_mapping.go:220:2
var sep string switch cfTag { case "csv":auth_test.go1
121:6test-parallelism
auth_test.go:121:6
func TestBasicAuth401WithCustomRealm(t *testing.T) { called := falsebinding/form_mapping_test.go1
230:1top-level-declaration-order
binding/form_mapping_test.go:230:1
type bindTestData struct { need anybinding/binding_test.go1
702:51unchecked-type-assertion
binding/binding_test.go:702:51
require.NoError(t, err) assert.InDelta(t, float64(123), obj.MapFoo["bar"].(float64), 0.01) assert.Equal(t, "thinkerou", obj.MapFoo["name"].(string))gin_test.go1
181:14unclosed-http-response-body
gin_test.go:181:14
client := &http.Client{Transport: tr} res, err := client.Get(ts.URL + "/test") if err != nil {binding/binding_test.go1
1191:55unused-parameter
binding/binding_test.go:1191:55
func testQueryBindingFail(t *testing.T, method, path, badPath, body, badBody string) { b := Querybinding/form_mapping_test.go1
1039:7unused-receiver
binding/form_mapping_test.go:1039:7
func (f *customHexUnmarshalParamAndUnmarshalText) UnmarshalParam(param string) error { return errors.New("should not be called in unit test if parser tag present")auth_test.go1
170:90add-constant
auth_test.go:170:90
req, _ := http.NewRequest(http.MethodGet, "/test", nil) req.Header.Set("Proxy-Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte("admin:password"))) router.ServeHTTP(w, req)context.go2
998:19cognitive-complexity
context.go:998:19
// the remote IP (coming from Request.RemoteAddr) is returned.func (c *Context) ClientIP() string { // Check if we're running on a trusted platform, continue running backwards if error1450:19cyclomatic-complexity
context.go:1450:19
// NegotiateFormat returns an acceptable Accept format.func (c *Context) NegotiateFormat(offered ...string) string { assert1(len(offered) > 0, "you must provide at least one offer")binding/binding_test.go1
667:19discarded-error-result
binding/binding_test.go:667:19
defer f.Close() fileActual, _ := io.ReadAll(f)binding/multipart_form_mapping.go1
22:2doc-comment-period
binding/multipart_form_mapping.go:22:2
// ErrMultiFileHeaderLenInvalid array for []*multipart.FileHeader len invalid ErrMultiFileHeaderLenInvalid = errors.New("unsupported len of array for []*multipart.FileHeader")tree_test.go1
852:13error-strings
tree_test.go:852:13
if found != test.found || (found && (string(out) != test.out)) { t.Errorf("Wrong result for '%s': got %s, %t; want %s, %t", test.in, string(out), found, test.out, test.found)binding/binding.go1
14:2exported-declaration-comment
binding/binding.go:14:2
MIMEJSON = "application/json" MIMEHTML = "text/html" MIMEXML = "application/xml"gin_test.go1
1:1file-length-limit
gin_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT stylebinding/default_validator_test.go1
1:1format
binding/default_validator_test.go:1:1
// Copyright 2020 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/default_validator_test.go`
context_test.go2
3743:6function-length
context_test.go:3743:6
func TestGetMapFromFormData(t *testing.T) { testCases := []struct {1698:50insecure-url-scheme
context_test.go:1698:50
c.Request, _ = http.NewRequest(http.MethodPost, "http://example.com", nil) c.Redirect(http.StatusCreated, "/resource")tree.go1
514:8max-control-nesting
tree.go:514:8
if unescape { if v, err := url.QueryUnescape(val); err == nil { val = vbinding/binding_test.go1
94:6max-public-structs
binding/binding_test.go:94:6
type FooStructForTimeTypeFailLocation struct { TimeFoo time.Time `form:"time_foo" time_format:"2006-01-02" time_location:"/asia/chongqing"`binding/form_mapping.go1
403:3modifies-parameter
binding/form_mapping.go:403:3
if val == "" { val = "0" }binding/default_validator_test.go1
13:13nested-structs
binding/default_validator_test.go:13:13
func TestSliceValidationError(t *testing.T) { tests := []struct { name stringgin_test.go1
210:6no-init
gin_test.go:210:6
func init() { SetMode(TestMode)context.go1
613:2no-naked-return
context.go:613:2
value, _ = c.GetPostForm(key) return}binding/binding.go1
83:2no-package-var
binding/binding.go:83:2
FormMultipart Binding = formMultipartBinding{} ProtoBuf BindingBody = protobufBinding{} MsgPack BindingBody = msgpackBinding{}gin.go1
801:6optimize-operands-order
gin.go:801:6
return strings.Map(func(r rune) rune { if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '/' || r == '-' { return rbinding/header.go1
5:9package-comments
binding/header.go:5:9
package bindingbinding/binding_test.go1
973:18redundant-conversion
binding/binding_test.go:973:18
assert.Equal(t, int64(1562400033), obj.UnixTime.Unix()) assert.Equal(t, int64(1562400033001), obj.UnixMilliTime.UnixMilli()) assert.Equal(t, int64(1562400033000012), obj.UnixMicroTime.UnixMicro())binding/form_mapping.go1
251:2single-case-switch
binding/form_mapping.go:251:2
switch value.Kind() { case reflect.Slice:auth_test.go1
141:6test-parallelism
auth_test.go:141:6
func TestBasicAuthForProxySucceed(t *testing.T) { accounts := Accounts{"admin": "password"}binding/header.go1
31:1top-level-declaration-order
binding/header.go:31:1
type headerSource map[string][]stringbinding/binding_test.go1
703:49unchecked-type-assertion
binding/binding_test.go:703:49
assert.InDelta(t, float64(123), obj.MapFoo["bar"].(float64), 0.01) assert.Equal(t, "thinkerou", obj.MapFoo["name"].(string)) assert.InDelta(t, float64(3.14), obj.MapFoo["pai"].(float64), 0.01)gin_test.go1
201:14unclosed-http-response-body
gin_test.go:201:14
res, err := http.Get(ts.URL + "/raw") if err != nil {binding/binding_test.go1
1191:70unused-parameter
binding/binding_test.go:1191:70
func testQueryBindingFail(t *testing.T, method, path, badPath, body, badBody string) { b := Querybinding/json_test.go1
85:7unused-receiver
binding/json_test.go:85:7
func (j customJsonApi) Marshal(v any) ([]byte, error) { return customConfig.Marshal(v)benchmarks_test.go1
30:13add-constant
benchmarks_test.go:30:13
router.Use(LoggerWithWriter(newMockWriter())) router.GET("/", func(c *Context) {}) runRequest(B, router, http.MethodGet, "/")context.go1
1450:19cognitive-complexity
context.go:1450:19
// NegotiateFormat returns an acceptable Accept format.func (c *Context) NegotiateFormat(offered ...string) string { assert1(len(offered) > 0, "you must provide at least one offer")gin.go1
690:23cyclomatic-complexity
gin.go:690:23
func (engine *Engine) handleHTTPRequest(c *Context) { httpMethod := c.Request.Methodbinding/binding_test.go1
670:11discarded-error-result
binding/binding_test.go:670:11
// file from multipart mf, _ := obj.File.Open() defer mf.Close()binding/multipart_form_mapping.go1
26:1doc-comment-period
binding/multipart_form_mapping.go:26:1
// TrySet tries to set a value by the multipart request with the binding a form filefunc (r *multipartRequest) TrySet(value reflect.Value, field reflect.StructField, key string, opt setOptions) (bool, error) {tree_test.go1
862:14error-strings
tree_test.go:862:14
if found { // test needs a trailingSlash fix. It must not be found! t.Errorf("Found without fixTrailingSlash: %s; got %s", test.in, string(out)) }binding/binding.go1
15:2exported-declaration-comment
binding/binding.go:15:2
MIMEHTML = "text/html" MIMEXML = "application/xml" MIMEXML2 = "text/xml"render/render_test.go1
1:1file-length-limit
render/render_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT stylebinding/form_mapping.go1
1:1format
binding/form_mapping.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/form_mapping.go`
context_test.go2
3874:6function-length
context_test.go:3874:6
func BenchmarkGetMapFromFormData(b *testing.B) { // Test case 1: Small dataset with bracket notation1708:50insecure-url-scheme
context_test.go:1708:50
c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest(http.MethodPost, "http://example.com", nil) assert.Panics(t, func() { c.Redirect(http.StatusOK, "/resource") })tree.go1
526:7max-control-nesting
tree.go:526:7
if end < len(path) { if len(n.children) > 0 { path = path[end:]binding/binding_test.go1
98:6max-public-structs
binding/binding_test.go:98:6
type FooStructForMapType struct { MapFoo map[string]any `form:"map_foo"`binding/form_mapping.go1
414:3modifies-parameter
binding/form_mapping.go:414:3
if val == "" { val = "false" }binding/default_validator_test.go1
56:13nested-structs
binding/default_validator_test.go:56:13
} tests := []struct { name stringlogger_test.go1
18:6no-init
logger_test.go:18:6
func init() { SetMode(TestMode)context.go1
645:2no-naked-return
context.go:645:2
values, _ = c.GetPostFormArray(key) return}binding/binding.go1
84:2no-package-var
binding/binding.go:84:2
ProtoBuf BindingBody = protobufBinding{} MsgPack BindingBody = msgpackBinding{} YAML BindingBody = yamlBinding{}gin.go1
801:6optimize-operands-order
gin.go:801:6
return strings.Map(func(r rune) rune { if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '/' || r == '-' { return rbinding/json.go1
5:9package-comments
binding/json.go:5:9
package bindingbinding/binding_test.go1
974:18redundant-conversion
binding/binding_test.go:974:18
assert.Equal(t, int64(1562400033001), obj.UnixMilliTime.UnixMilli()) assert.Equal(t, int64(1562400033000012), obj.UnixMicroTime.UnixMicro())binding/form_mapping.go1
336:2single-case-switch
binding/form_mapping.go:336:2
switch value.Kind() { case reflect.Int:auth_test.go1
158:6test-parallelism
auth_test.go:158:6
func TestBasicAuthForProxy407(t *testing.T) { called := falsebinding/json_test.go1
65:1top-level-declaration-order
binding/json_test.go:65:1
type customReq struct { TimeEmpty time.Time `json:"time_empty"`binding/binding_test.go1
704:52unchecked-type-assertion
binding/binding_test.go:704:52
assert.Equal(t, "thinkerou", obj.MapFoo["name"].(string)) assert.InDelta(t, float64(3.14), obj.MapFoo["pai"].(float64), 0.01)}gin_test.go1
232:14unclosed-http-response-body
gin_test.go:232:14
res, err := http.Get(ts.URL + "/test") if err != nil {binding/binding_test.go1
1204:59unused-parameter
binding/binding_test.go:1204:59
func testQueryBindingBoolFail(t *testing.T, method, path, badPath, body, badBody string) { b := Querybinding/json_test.go1
89:7unused-receiver
binding/json_test.go:89:7
func (j customJsonApi) Unmarshal(data []byte, v any) error { return customConfig.Unmarshal(data, v)benchmarks_test.go1
39:13add-constant
benchmarks_test.go:39:13
router.Use(func(c *Context) {}) router.GET("/ping", func(c *Context) {}) runRequest(B, router, http.MethodGet, "/ping")context_test.go1
2675:6cognitive-complexity
context_test.go:2675:6
func TestContextShouldBindBodyWithJSON(t *testing.T) { for _, tt := range []struct {logger.go1
245:6cyclomatic-complexity
logger.go:245:6
// LoggerWithConfig instance a Logger middleware with config.func LoggerWithConfig(conf LoggerConfig) HandlerFunc { formatter := conf.Formatterbinding/binding_test.go1
672:19discarded-error-result
binding/binding_test.go:672:19
defer mf.Close() fileExpect, _ := io.ReadAll(mf)context.go1
163:1doc-comment-period
context.go:163:1
// HandlerNames returns a list of all registered handlers for this context in descending order,// following the semantics of HandlerName()tree_test.go1
866:14error-strings
tree_test.go:866:14
if found != test.found || (found && (string(out) != test.out)) { t.Errorf("Wrong result for '%s': got %s, %t; want %s, %t", test.in, string(out), found, test.out, test.found)binding/binding.go1
16:2exported-declaration-comment
binding/binding.go:16:2
MIMEXML = "application/xml" MIMEXML2 = "text/xml" MIMEPlain = "text/plain"routes_test.go1
1:1file-length-limit
routes_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT stylebinding/form_mapping_benchmark_test.go1
1:1format
binding/form_mapping_benchmark_test.go:1:1
// Copyright 2019 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/form_mapping_benchmark_test.go`
gin_integration_test.go1
434:6function-length
gin_integration_test.go:434:6
func TestTreeRunDynamicRouting(t *testing.T) { router := New()context_test.go1
2407:50insecure-url-scheme
context_test.go:2407:50
c.Request, _ = http.NewRequest(http.MethodPost, "http://example.com", strings.NewReader("\"foo\":\"bar\", \"bar\":\"foo\"}")) c.Request.Header.Add("Content-Type", MIMEJSON)tree.go1
553:7max-control-nesting
tree.go:553:7
// Preallocate capacity if necessary if cap(*params) < int(globalParamsCount) { newParams := make(Params, len(*params), globalParamsCount)binding/binding_test.go1
102:6max-public-structs
binding/binding_test.go:102:6
type FooStructForIgnoreFormTag struct { Foo *string `form:"-"`binding/form_mapping.go1
425:3modifies-parameter
binding/form_mapping.go:425:3
if val == "" { val = "0.0" }binding/form_mapping_benchmark_test.go1
25:11nested-structs
binding/form_mapping_benchmark_test.go:25:11
Friends []string `form:"friends"` ID *struct { Number string `form:"id_number"`mode.go1
52:6no-init
mode.go:52:6
func init() { mode := os.Getenv(EnvGinMode)context.go1
666:2no-naked-return
context.go:666:2
values, ok = c.formCache[key] return}binding/binding.go1
85:2no-package-var
binding/binding.go:85:2
MsgPack BindingBody = msgpackBinding{} YAML BindingBody = yamlBinding{} Uri BindingUri = uriBinding{}gin.go1
801:6optimize-operands-order
gin.go:801:6
return strings.Map(func(r rune) rune { if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '/' || r == '-' { return rbinding/msgpack.go1
7:9package-comments
binding/msgpack.go:7:9
package bindingbinding/binding_test.go1
1147:21redundant-conversion
binding/binding_test.go:1147:21
require.NoError(t, err) assert.InDelta(t, float64(123), obj.MapFoo["bar"].(float64), 0.01) case "SliceMap":binding/form_mapping.go1
346:3single-case-switch
binding/form_mapping.go:346:3
case reflect.Int64: switch value.Interface().(type) { case time.Duration:binding/binding_msgpack_test.go1
19:6test-parallelism
binding/binding_msgpack_test.go:19:6
func TestBindingMsgPack(t *testing.T) { test := FooStruct{binding/multipart_form_mapping.go1
16:1top-level-declaration-order
binding/multipart_form_mapping.go:16:1
var _ setter = (*multipartRequest)(nil)binding/binding_test.go1
1147:52unchecked-type-assertion
binding/binding_test.go:1147:52
require.NoError(t, err) assert.InDelta(t, float64(123), obj.MapFoo["bar"].(float64), 0.01) case "SliceMap":gin_test.go1
252:14unclosed-http-response-body
gin_test.go:252:14
res, err := http.Get(ts.URL + "/test") if err != nil {binding/binding_test.go1
1204:74unused-parameter
binding/binding_test.go:1204:74
func testQueryBindingBoolFail(t *testing.T, method, path, badPath, body, badBody string) { b := Querybinding/json_test.go1
93:7unused-receiver
binding/json_test.go:93:7
func (j customJsonApi) MarshalIndent(v any, prefix, indent string) ([]byte, error) { return customConfig.MarshalIndent(v, prefix, indent)binding/binding_test.go1
191:8add-constant
binding/binding_test.go:191:8
JSON, "json", "/", "/", `{"foo": "bar"}`, `{"bar": "foo"}`)context_test.go1
2739:6cognitive-complexity
context_test.go:2739:6
func TestContextShouldBindBodyWithXML(t *testing.T) { for _, tt := range []struct {path.go1
23:6cyclomatic-complexity
path.go:23:6
// If the result of this process is an empty string, "/" is returned.func cleanPath(p string) string { // Turn empty string into "/"binding/binding_test.go1
718:13discarded-error-result
binding/binding_test.go:718:13
} data, _ := proto.Marshal(test)context.go1
181:1doc-comment-period
context.go:181:1
// FullPath returns a matched route full path. For not found routes// returns an empty string.tree_test.go1
930:13error-strings
tree_test.go:930:13
if value.params == nil { t.Errorf("Expected %s params to be set, but they weren't", item.path) continuebinding/binding.go1
17:2exported-declaration-comment
binding/binding.go:17:2
MIMEXML2 = "text/xml" MIMEPlain = "text/plain" MIMEPOSTForm = "application/x-www-form-urlencoded"tree.go1
1:1file-length-limit
tree.go:1:1
// Copyright 2013 Julien Schmidt. All rights reserved.// Use of this source code is governed by a BSD-style license that can be foundbinding/form_mapping_test.go1
1:1format
binding/form_mapping_test.go:1:1
// Copyright 2019 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/form_mapping_test.go`
gin_test.go1
867:6function-length
gin_test.go:867:6
func TestPrepareTrustedCIRDsWith(t *testing.T) { r := New()context_test.go1
2581:50insecure-url-scheme
context_test.go:2581:50
c.Request, _ = http.NewRequest(http.MethodPost, "http://example.com", strings.NewReader(`"foo":"bar", "bar":"foo"}`)) c.Request.Header.Add("Content-Type", MIMEJSON)tree.go1
559:7max-control-nesting
tree.go:559:7
if value.params == nil { value.params = paramsbinding/binding_test.go1
106:6max-public-structs
binding/binding_test.go:106:6
type InvalidNameType struct { TestName string `invalid_name:"test_name"`binding/form_mapping.go1
512:3modifies-parameter
binding/form_mapping.go:512:3
if val == "" { val = "0" }binding/form_mapping_test.go1
26:23nested-structs
binding/form_mapping_test.go:26:23
} for _, tt := range []struct { name stringmode_test.go1
16:6no-init
mode_test.go:16:6
func init() { os.Setenv(EnvGinMode, TestMode)context.go1
672:2no-naked-return
context.go:672:2
dicts, _ = c.GetPostFormMap(key) return}binding/binding.go1
86:2no-package-var
binding/binding.go:86:2
YAML BindingBody = yamlBinding{} Uri BindingUri = uriBinding{} Header Binding = headerBinding{}gin_integration_test.go1
51:5optimize-operands-order
gin_integration_test.go:51:5
responseStatus := "200 OK" if len(params) > 1 && params[1] != "" { responseStatus = params[1]binding/multipart_form_mapping.go1
5:9package-comments
binding/multipart_form_mapping.go:5:9
package bindingbinding/binding_test.go1
1283:18redundant-conversion
binding/binding_test.go:1283:18
require.NoError(t, e) assert.Equal(t, int64(123), v)binding/form_mapping.go1
453:3single-case-switch
binding/form_mapping.go:453:3
var t time.Time switch tf { case "unix":binding/binding_msgpack_test.go1
56:6test-parallelism
binding/binding_msgpack_test.go:56:6
func TestBindingDefaultMsgPack(t *testing.T) { assert.Equal(t, MsgPack, Default(http.MethodPost, MIMEMSGPACK))binding/multipart_form_mapping_test.go1
98:1top-level-declaration-order
binding/multipart_form_mapping_test.go:98:1
type testFile struct { Fieldname stringbinding/binding_test.go1
1281:17unchecked-type-assertion
binding/binding_test.go:1281:17
// we hope it is int64(123) v, e := obj.Foo.(json.Number).Int64() require.NoError(t, e)gin_test.go1
272:14unclosed-http-response-body
gin_test.go:272:14
res, err := http.Get(ts.URL + "/test") if err != nil {binding/binding_test.go1
1368:25unused-parameter
binding/binding_test.go:1368:25
func (f *failRead) Read(b []byte) (n int, err error) { return 0, errors.New("my fail")binding/json_test.go1
97:7unused-receiver
binding/json_test.go:97:7
func (j customJsonApi) NewEncoder(writer io.Writer) json.Encoder { return customConfig.NewEncoder(writer)binding/binding_test.go1
202:32add-constant
binding/binding_test.go:202:32
testBodyBindingSlice(t, JSON, "json", "/", "/", `[]`, ``) testBodyBindingSlice(t, JSON, "json", "/", "/", `[{"foo": "123"}]`, `[{}]`) testBodyBindingSlice(t, JSON, "json", "/", "/", `[{"foo": "123"}]`, `[{"foo": ""}]`)context_test.go1
2803:6cognitive-complexity
context_test.go:2803:6
func TestContextShouldBindBodyWithYAML(t *testing.T) { for _, tt := range []struct {tree.go1
135:16cyclomatic-complexity
tree.go:135:16
// Not concurrency-safe!func (n *node) addRoute(path string, handlers HandlersChain) { fullPath := pathbinding/binding_test.go1
730:13discarded-error-result
binding/binding_test.go:730:13
} data, _ := proto.Marshal(test)context.go1
296:1doc-comment-period
context.go:296:1
// Get returns the value for the given key, ie: (value, true).// If the value does not exist it returns (nil, false)tree_test.go1
935:13error-strings
tree_test.go:935:13
if len(*value.params) != 1 { t.Errorf("Wrong number of %s params: got %d, want %d", item.path, len(*value.params), 1)binding/binding.go1
18:2exported-declaration-comment
binding/binding.go:18:2
MIMEPlain = "text/plain" MIMEPOSTForm = "application/x-www-form-urlencoded" MIMEMultipartPOSTForm = "multipart/form-data"tree_test.go1
1:1file-length-limit
tree_test.go:1:1
// Copyright 2013 Julien Schmidt. All rights reserved.// Use of this source code is governed by a BSD-style license that can be foundbinding/header.go1
1:1format
binding/header.go:1:1
// Copyright 2022 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/header.go`
path.go1
23:6function-length
path.go:23:6
// If the result of this process is an empty string, "/" is returned.func cleanPath(p string) string { // Turn empty string into "/"context_test.go1
2645:22insecure-url-scheme
context_test.go:2645:22
c.Request, _ = http.NewRequest( http.MethodPost, "http://example.com", strings.NewReader(tt.bodyA), )tree.go1
566:7max-control-nesting
tree.go:566:7
val := path if unescape { if v, err := url.QueryUnescape(path); err == nil {binding/binding_test.go1
110:6max-public-structs
binding/binding_test.go:110:6
type InvalidNameMapType struct { TestName struct {context.go1
1161:3modifies-parameter
context.go:1161:3
if path == "" { path = "/" }binding/form_mapping_test.go1
32:17nested-structs
binding/form_mapping_test.go:32:17
}{ {"base type", struct{ F int }{}, "9", int(9)}, {"base type", struct{ F int8 }{}, "9", int8(9)},response_writer_test.go1
55:6no-init
response_writer_test.go:55:6
func init() { SetMode(TestMode)context.go1
1499:3no-naked-return
context.go:1499:3
if !c.hasRequestContext() { return }binding/binding.go1
87:2no-package-var
binding/binding.go:87:2
Uri BindingUri = uriBinding{} Header Binding = headerBinding{} Plain BindingBody = plainBinding{}gin_integration_test.go1
56:5optimize-operands-order
gin_integration_test.go:56:5
responseBody := "it worked" if len(params) > 2 && params[2] != "" { responseBody = params[2]binding/plain.go1
1:9package-comments
binding/plain.go:1:9
package bindingbinding/binding_test.go1
1301:20redundant-conversion
binding/binding_test.go:1301:20
// maybe it is not hoped assert.InDelta(t, float64(123), obj.Foo, 0.01)binding/multipart_form_mapping.go1
36:2single-case-switch
binding/multipart_form_mapping.go:36:2
func setByMultipartFormFile(value reflect.Value, field reflect.StructField, files []*multipart.FileHeader) (isSet bool, err error) { switch value.Kind() { case reflect.Ptr:binding/binding_test.go1
150:6test-parallelism
binding/binding_test.go:150:6
func TestBindingDefault(t *testing.T) { assert.Equal(t, Form, Default(http.MethodGet, ""))binding/validate_test.go2
125:1top-level-declaration-order
binding/validate_test.go:125:1
type structNoValidationPointer struct { substructNoValidation201:27unchecked-type-assertion
binding/validate_test.go:201:27
func toZero(sl validator.StructLevel) { s := sl.Top().Interface().(*structModifyValidation) s.Integer = 0gin_test.go1
299:14unclosed-http-response-body
gin_test.go:299:14
client := &http.Client{Transport: tr} res, err := client.Get(ts.URL + "/test") if err != nil {binding/form_mapping_test.go1
1039:66unused-parameter
binding/form_mapping_test.go:1039:66
func (f *customHexUnmarshalParamAndUnmarshalText) UnmarshalParam(param string) error { return errors.New("should not be called in unit test if parser tag present")binding/json_test.go1
101:7unused-receiver
binding/json_test.go:101:7
func (j customJsonApi) NewDecoder(reader io.Reader) json.Decoder { return customConfig.NewDecoder(reader)binding/binding_test.go1
204:50add-constant
binding/binding_test.go:204:50
testBodyBindingSlice(t, JSON, "json", "/", "/", `[{"foo": "123"}]`, `[{"foo": ""}]`) testBodyBindingSlice(t, JSON, "json", "/", "/", `[{"foo": "123"}]`, `[{"foo": 123}]`) testBodyBindingSlice(t, JSON, "json", "/", "/", `[{"foo": "123"}]`, `[{"bar": 123}]`)context_test.go1
2868:6cognitive-complexity
context_test.go:2868:6
func TestContextShouldBindBodyWithTOML(t *testing.T) { for _, tt := range []struct {tree.go1
288:16cyclomatic-complexity
tree.go:288:16
func (n *node) insertChild(path string, fullPath string, handlers HandlersChain) { for {binding/binding_test.go1
741:13discarded-error-result
binding/binding_test.go:741:13
obj.Foo = "bar" data, _ := bson.Marshal(&obj) testBodyBinding(t,context.go1
490:1doc-comment-period
context.go:490:1
// Delete deletes the key from the Context's Key map, if it exists.// This operation is safe to be used by concurrent go-routinestree_test.go1
1049:12error-strings
tree_test.go:1049:12
if found { t.Errorf("Expected no match for '/aa', but got: %s", string(out)) }binding/binding.go1
19:2exported-declaration-comment
binding/binding.go:19:2
MIMEPOSTForm = "application/x-www-form-urlencoded" MIMEMultipartPOSTForm = "multipart/form-data" MIMEPROTOBUF = "application/x-protobuf"binding/json_test.go1
1:1format
binding/json_test.go:1:1
// Copyright 2019 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/json_test.go`
routes_test.go1
145:6function-length
routes_test.go:145:6
func TestRouteRedirectTrailingSlash(t *testing.T) { router := New()context_test.go1
2663:22insecure-url-scheme
context_test.go:2663:22
c.Request, _ = http.NewRequest( http.MethodPost, "http://example.com", strings.NewReader(tt.bodyB), )tree.go1
567:8max-control-nesting
tree.go:567:8
if unescape { if v, err := url.QueryUnescape(path); err == nil { val = vbinding/binding_test.go1
116:6max-public-structs
binding/binding_test.go:116:6
type FooStructForSliceType struct { SliceFoo []int `form:"slice_foo"`context.go1
1180:3modifies-parameter
context.go:1180:3
if cookie.Path == "" { cookie.Path = "/" }binding/form_mapping_test.go1
33:17nested-structs
binding/form_mapping_test.go:33:17
{"base type", struct{ F int }{}, "9", int(9)}, {"base type", struct{ F int8 }{}, "9", int8(9)}, {"base type", struct{ F int16 }{}, "9", int16(9)},routergroup_test.go1
16:6no-init
routergroup_test.go:16:6
func init() { SetMode(TestMode)gin.go1
555:2no-naked-return
gin.go:555:2
err = server.ListenAndServe() return}binding/binding.go1
88:2no-package-var
binding/binding.go:88:2
Header Binding = headerBinding{} Plain BindingBody = plainBinding{} TOML BindingBody = tomlBinding{}logger.go1
163:44optimize-operands-order
logger.go:163:44
func (p *LogFormatterParams) IsOutputColor() bool { return consoleColorMode == forceColor || (consoleColorMode == autoColor && p.isTerm)}binding/protobuf.go1
5:9package-comments
binding/protobuf.go:5:9
package bindingbinding/form_mapping_test.go1
32:41redundant-conversion
binding/form_mapping_test.go:32:41
}{ {"base type", struct{ F int }{}, "9", int(9)}, {"base type", struct{ F int8 }{}, "9", int8(9)},binding/multipart_form_mapping.go1
38:3single-case-switch
binding/multipart_form_mapping.go:38:3
case reflect.Ptr: switch value.Interface().(type) { case *multipart.FileHeader:binding/binding_test.go1
181:6test-parallelism
binding/binding_test.go:181:6
func TestBindingJSONNilBody(t *testing.T) { var obj FooStructcodec/json/json.go1
21:1top-level-declaration-order
codec/json/json.go:21:1
type jsonApi struct{}context_test.go1
341:26unchecked-type-assertion
context_test.go:341:26
assert.EqualValues(t, -1, c.index) assert.Equal(t, c.Writer.(*responseWriter), &c.writermem)}gin_test.go1
319:14unclosed-http-response-body
gin_test.go:319:14
res, err := http.Get(ts.URL + "/raw") if err != nil {context_test.go1
798:22unused-parameter
context_test.go:798:22
func handlerNameTest(c *Context) {}binding/json_test.go1
117:7unused-receiver
binding/json_test.go:117:7
func (te *TimeEx) CreateDecoder(typ reflect2.Type) jsoniter.ValDecoder { if typ == timeType {binding/binding_test.go1
220:19add-constant
binding/binding_test.go:220:19
"/", "/", `{"foo": 123}`, `{"bar": "foo"}`)}context_test.go1
2932:6cognitive-complexity
context_test.go:2932:6
func TestContextShouldBindBodyWithPlain(t *testing.T) { for _, tt := range []struct {tree.go1
418:16cyclomatic-complexity
tree.go:418:16
// given path.func (n *node) getValue(path string, params *Params, skippedNodes *[]skippedNode, unescape bool) (value nodeValue) { var globalParamsCount int16binding/binding_test.go1
919:12discarded-error-result
binding/binding_test.go:919:12
obj := FooBarStruct{} req, _ := http.NewRequest(http.MethodPost, "/", nil) err := b.Bind(req, &obj)context.go1
504:1doc-comment-period
context.go:504:1
// Param returns the value of the URL param.// It is a shortcut for c.Params.ByName(key)tree_test.go1
1054:12error-strings
tree_test.go:1054:12
if found { t.Errorf("Expected no match for '/aa/aa/aa/aa', but got: %s", string(out)) }binding/binding.go1
20:2exported-declaration-comment
binding/binding.go:20:2
MIMEMultipartPOSTForm = "multipart/form-data" MIMEPROTOBUF = "application/x-protobuf" MIMEMSGPACK = "application/x-msgpack"binding/msgpack_test.go1
1:1format
binding/msgpack_test.go:1:1
// Copyright 2019 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/msgpack_test.go`
tree.go1
135:16function-length
tree.go:135:16
// Not concurrency-safe!func (n *node) addRoute(path string, handlers HandlersChain) { fullPath := pathcontext_test.go1
3032:33insecure-url-scheme
context_test.go:3032:33
c.Request.Header.Set("Sec-WebSocket-Key", "dGhlIHNhbXBsZSBub25jZQ==") c.Request.Header.Set("Origin", "http://example.com") c.Request.Header.Set("Sec-WebSocket-Protocol", "chat, superchat")tree.go1
597:7max-control-nesting
tree.go:597:7
n = skippedNode.node if value.params != nil { *value.params = (*value.params)[:skippedNode.paramsCount]binding/binding_test.go1
120:6max-public-structs
binding/binding_test.go:120:6
type FooStructForStructType struct { StructFoo struct {context.go1
1183:3modifies-parameter
context.go:1183:3
if cookie.SameSite == http.SameSiteDefaultMode { cookie.SameSite = c.sameSite }binding/form_mapping_test.go1
34:17nested-structs
binding/form_mapping_test.go:34:17
{"base type", struct{ F int8 }{}, "9", int8(9)}, {"base type", struct{ F int16 }{}, "9", int16(9)}, {"base type", struct{ F int32 }{}, "9", int32(9)},utils_test.go1
19:6no-init
utils_test.go:19:6
func init() { SetMode(TestMode)gin.go1
575:2no-naked-return
gin.go:575:2
err = server.ListenAndServeTLS(certFile, keyFile) return}binding/binding.go1
89:2no-package-var
binding/binding.go:89:2
Plain BindingBody = plainBinding{} TOML BindingBody = tomlBinding{} BSON BindingBody = bsonBinding{}logger.go1
306:6optimize-operands-order
logger.go:306:6
if raw != "" && !conf.SkipQueryString { path = path + "?" + rawbinding/query.go1
5:9package-comments
binding/query.go:5:9
package bindingbinding/form_mapping_test.go1
33:42redundant-conversion
binding/form_mapping_test.go:33:42
{"base type", struct{ F int }{}, "9", int(9)}, {"base type", struct{ F int8 }{}, "9", int8(9)}, {"base type", struct{ F int16 }{}, "9", int16(9)},binding/multipart_form_mapping.go1
44:3single-case-switch
binding/multipart_form_mapping.go:44:3
case reflect.Struct: switch value.Interface().(type) { case multipart.FileHeader:binding/binding_test.go1
188:6test-parallelism
binding/binding_test.go:188:6
func TestBindingJSON(t *testing.T) { testBodyBinding(t,context.go1
54:1top-level-declaration-order
context.go:54:1
const ContextRequestKey ContextKeyType = 0context_test.go1
431:59unchecked-type-assertion
context_test.go:431:59
assert.Exactly(t, "this is a string", c.MustGet("string").(string)) assert.Exactly(t, int32(-42), c.MustGet("int32").(int32))gin_test.go1
341:14unclosed-http-response-body
gin_test.go:341:14
res, err := http.Get(ts.URL + "/test") if err != nil {context_test.go1
801:23unused-parameter
context_test.go:801:23
func handlerNameTest2(c *Context) {}binding/json_test.go1
124:7unused-receiver
binding/json_test.go:124:7
func (te *TimeEx) CreateEncoder(typ reflect2.Type) jsoniter.ValEncoder { if typ == timeType {binding/binding_test.go1
262:14add-constant
binding/binding_test.go:262:14
"/", "/", "foo=bar", "bar2=foo")}gin.go1
414:23cognitive-complexity
gin.go:414:23
func (engine *Engine) prepareTrustedCIDRs() ([]*net.IPNet, error) { if engine.trustedProxies == nil {tree.go1
703:16cyclomatic-complexity
tree.go:703:16
// Recursive case-insensitive lookup function used by n.findCaseInsensitivePathfunc (n *node) findCaseInsensitivePathRec(path string, ciPath []byte, rb [4]byte, fixTrailingSlash bool) []byte { npLen := len(n.path)binding/binding_test.go1
940:12discarded-error-result
binding/binding_test.go:940:12
obj := FooBarStruct{} req, _ := http.NewRequest(http.MethodPost, "/", nil) err := b.Bind(req, &obj)context.go1
517:1doc-comment-period
context.go:517:1
// AddParam adds param to context and// replaces path param key with given value for e2e testing purposestree_test.go1
1062:12error-strings
tree_test.go:1062:12
} else if string(out) != "/aa/aa" { t.Errorf("Wrong result for '/AA/AA': expected '/aa/aa', got: %s", string(out)) }binding/binding.go1
21:2exported-declaration-comment
binding/binding.go:21:2
MIMEPROTOBUF = "application/x-protobuf" MIMEMSGPACK = "application/x-msgpack" MIMEMSGPACK2 = "application/msgpack"binding/multipart_form_mapping.go1
1:1format
binding/multipart_form_mapping.go:1:1
// Copyright 2019 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/multipart_form_mapping.go`
tree.go1
288:16function-length
tree.go:288:16
func (n *node) insertChild(path string, fullPath string, handlers HandlersChain) { for {context_test.go1
3475:35insecure-url-scheme
context_test.go:3475:35
addr := strings.Split(l.Addr().String(), ":") res, err := http.Get(fmt.Sprintf("http://%s:%s/", localhostIP, addr[len(addr)-1])) if err != nil {tree.go1
726:7max-control-nesting
tree.go:726:7
n = n.children[i] if (len(n.path) == 1 && n.handlers != nil) || (n.nType == catchAll && n.children[0].handlers != nil) {binding/binding_test.go1
126:6max-public-structs
binding/binding_test.go:126:6
type FooStructForStructPointerType struct { StructPointerFoo *struct {context_test.go1
2209:2modifies-parameter
context_test.go:2209:2
c.Request.Header.Set("Fly-Client-IP", "70.70.70.70") c.Request.RemoteAddr = " 40.40.40.40:42123 " c.engine.TrustedPlatform = ""binding/form_mapping_test.go1
35:17nested-structs
binding/form_mapping_test.go:35:17
{"base type", struct{ F int16 }{}, "9", int16(9)}, {"base type", struct{ F int32 }{}, "9", int32(9)}, {"base type", struct{ F int64 }{}, "9", int64(9)},gin.go1
592:3no-naked-return
gin.go:592:3
if err != nil { return }binding/binding.go1
90:2no-package-var
binding/binding.go:90:2
TOML BindingBody = tomlBinding{} BSON BindingBody = bsonBinding{})recovery.go1
66:21optimize-operands-order
recovery.go:66:21
if ok { isBrokenPipe = errors.Is(err, syscall.EPIPE) || errors.Is(err, syscall.ECONNRESET) ||binding/toml.go1
5:9package-comments
binding/toml.go:5:9
package bindingbinding/form_mapping_test.go1
34:43redundant-conversion
binding/form_mapping_test.go:34:43
{"base type", struct{ F int8 }{}, "9", int8(9)}, {"base type", struct{ F int16 }{}, "9", int16(9)}, {"base type", struct{ F int32 }{}, "9", int32(9)},context.go1
841:3single-case-switch
context.go:841:3
// https://github.com/bytedance/sonic/issues/800 switch { case errors.As(err, &maxBytesErr):binding/binding_test.go1
209:6test-parallelism
binding/binding_test.go:209:6
func TestBindingJSONUseNumber(t *testing.T) { testBodyBindingUseNumber(t,context_test.go2
804:1top-level-declaration-order
context_test.go:804:1
var handlerTest HandlerFunc = func(c *Context) {}432:50unchecked-type-assertion
context_test.go:432:50
assert.Exactly(t, "this is a string", c.MustGet("string").(string)) assert.Exactly(t, int32(-42), c.MustGet("int32").(int32)) assert.Exactly(t, int64(42424242424242), c.MustGet("int64").(int64))gin_test.go2
361:14unclosed-http-response-body
gin_test.go:361:14
res, err := http.Get(ts.URL + "/test") if err != nil {990:19unused-parameter
gin_test.go:990:19
func handlerTest1(c *Context) {}func handlerTest2(c *Context) {}binding/json_test.go1
133:7unused-receiver
binding/json_test.go:133:7
func (tc timeCodec) IsEmpty(ptr unsafe.Pointer) bool { t := *((*time.Time)(ptr))binding/binding_test.go1
267:16add-constant
binding/binding_test.go:267:16
testFormBindingDefaultValue(t, http.MethodGet, "/?foo=bar", "/?bar2=foo", "", "")gin.go1
690:23cognitive-complexity
gin.go:690:23
func (engine *Engine) handleHTTPRequest(c *Context) { httpMethod := c.Request.Methodtree_test.go1
714:6cyclomatic-complexity
tree_test.go:714:6
func TestTreeFindCaseInsensitivePath(t *testing.T) { tree := &node{}binding/binding_test.go1
950:12discarded-error-result
binding/binding_test.go:950:12
obj := FooBarStruct{} req, _ := http.NewRequest(http.MethodPost, "/", nil) err := b.Bind(req, &obj)context.go1
526:1doc-comment-period
context.go:526:1
// Query returns the keyed url query value if it exists,// otherwise it returns an empty string `("")`.tree_test.go1
1087:12error-strings
tree_test.go:1087:12
if found { t.Errorf("Expected no match for '/prefix/a/b/c', but got: %s", string(out)) }binding/binding.go1
22:2exported-declaration-comment
binding/binding.go:22:2
MIMEMSGPACK = "application/x-msgpack" MIMEMSGPACK2 = "application/msgpack" MIMEYAML = "application/x-yaml"binding/multipart_form_mapping_test.go1
1:1format
binding/multipart_form_mapping_test.go:1:1
// Copyright 2019 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/multipart_form_mapping_test.go`
tree.go1
418:16function-length
tree.go:418:16
// given path.func (n *node) getValue(path string, params *Params, skippedNodes *[]skippedNode, unescape bool) (value nodeValue) { var globalParamsCount int16gin_integration_test.go1
75:28insecure-url-scheme
gin_integration_test.go:75:28
// Wait for server to be ready with exponential backoff err := waitForServerReady("http://localhost:8080/example", 10) require.NoError(t, err, "server should start successfully")tree.go1
785:7max-control-nesting
tree.go:785:7
// as an index if out := n.children[i].findCaseInsensitivePathRec( path, ciPath, rb, fixTrailingSlash,binding/binding_test.go1
132:6max-public-structs
binding/binding_test.go:132:6
type FooStructForSliceMapType struct { // Unknown type: not support mapcontext_test.go1
2210:2modifies-parameter
context_test.go:2210:2
c.Request.RemoteAddr = " 40.40.40.40:42123 " c.engine.TrustedPlatform = "" c.engine.trustedCIDRs = defaultTrustedCIDRsbinding/form_mapping_test.go1
36:17nested-structs
binding/form_mapping_test.go:36:17
{"base type", struct{ F int32 }{}, "9", int32(9)}, {"base type", struct{ F int64 }{}, "9", int64(9)}, {"base type", struct{ F uint }{}, "9", uint(9)},gin.go1
601:2no-naked-return
gin.go:601:2
err = server.Serve(listener) return}binding/binding_nomsgpack.go1
69:5no-package-var
binding/binding_nomsgpack.go:69:5
// under the hood.var Validator StructValidator = &defaultValidator{}render/redirect.go1
21:5optimize-operands-order
render/redirect.go:21:5
func (r Redirect) Render(w http.ResponseWriter) error { if (r.Code < http.StatusMultipleChoices || r.Code > http.StatusPermanentRedirect) && r.Code != http.StatusCreated { panic(fmt.Sprintf("Cannot redirect with status code %d", r.Code))binding/uri.go1
5:9package-comments
binding/uri.go:5:9
package bindingbinding/form_mapping_test.go1
35:43redundant-conversion
binding/form_mapping_test.go:35:43
{"base type", struct{ F int16 }{}, "9", int16(9)}, {"base type", struct{ F int32 }{}, "9", int32(9)}, {"base type", struct{ F int64 }{}, "9", int64(9)},context.go1
1111:2single-case-switch
context.go:1111:2
func bodyAllowedForStatus(status int) bool { switch { case status >= http.StatusContinue && status < http.StatusOK:binding/binding_test.go1
216:6test-parallelism
binding/binding_test.go:216:6
func TestBindingJSONUseNumber2(t *testing.T) { testBodyBindingUseNumber2(t,debug.go1
27:1top-level-declaration-order
debug.go:27:1
// DebugPrintRouteFunc indicates debug log output format.var DebugPrintRouteFunc func(httpMethod, absolutePath, handlerName string, nuHandlers int)context_test.go1
433:61unchecked-type-assertion
context_test.go:433:61
assert.Exactly(t, int32(-42), c.MustGet("int32").(int32)) assert.Exactly(t, int64(42424242424242), c.MustGet("int64").(int64)) assert.Exactly(t, uint64(42), c.MustGet("uint64").(uint64))gin_test.go2
381:14unclosed-http-response-body
gin_test.go:381:14
res, err := http.Get(ts.URL + "/test") if err != nil {991:19unused-parameter
gin_test.go:991:19
func handlerTest1(c *Context) {}func handlerTest2(c *Context) {}binding/json_test.go1
138:7unused-receiver
binding/json_test.go:138:7
func (tc timeCodec) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream) { t := *((*time.Time)(ptr))binding/binding_test.go1
286:3add-constant
binding/binding_test.go:286:3
"/", "/", "time_foo=2017-11-15", "bar2=foo")}githubapi_test.go1
405:6cognitive-complexity
githubapi_test.go:405:6
func exampleFromPath(path string) (string, Params) { output := new(strings.Builder)binding/binding_test.go1
1432:11discarded-error-result
binding/binding_test.go:1432:11
func requestWithBody(method, path, body string) (req *http.Request) { req, _ = http.NewRequest(method, path, bytes.NewBufferString(body)) returncontext.go1
540:1doc-comment-period
context.go:540:1
// DefaultQuery returns the keyed url query value if it exists,// otherwise it returns the specified defaultValue string.tree_test.go1
1095:12error-strings
tree_test.go:1095:12
} else if string(out) != "/prefix/xxx" { t.Errorf("Wrong result for '/prefix/xxx': %s", string(out)) }binding/binding.go1
23:2exported-declaration-comment
binding/binding.go:23:2
MIMEMSGPACK2 = "application/msgpack" MIMEYAML = "application/x-yaml" MIMEYAML2 = "application/yaml"binding/validate_test.go1
1:1format
binding/validate_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt binding/validate_test.go`
tree.go1
703:16function-length
tree.go:703:16
// Recursive case-insensitive lookup function used by n.findCaseInsensitivePathfunc (n *node) findCaseInsensitivePathRec(path string, ciPath []byte, rb [4]byte, fixTrailingSlash bool) []byte { npLen := len(n.path)gin_integration_test.go1
79:17insecure-url-scheme
gin_integration_test.go:79:17
require.Error(t, router.Run(":8080")) testRequest(t, "http://localhost:8080/example")}tree.go1
803:7max-control-nesting
tree.go:803:7
// Uppercase matches if c == idxc { // Continue with child nodebinding/binding_test.go1
137:6max-public-structs
binding/binding_test.go:137:6
type FooStructForBoolType struct { BoolFoo bool `form:"bool_foo"`context_test.go1
2211:2modifies-parameter
context_test.go:2211:2
c.engine.TrustedPlatform = "" c.engine.trustedCIDRs = defaultTrustedCIDRs c.engine.AppEngine = falsebinding/form_mapping_test.go1
37:17nested-structs
binding/form_mapping_test.go:37:17
{"base type", struct{ F int64 }{}, "9", int64(9)}, {"base type", struct{ F uint }{}, "9", uint(9)}, {"base type", struct{ F uint8 }{}, "9", uint8(9)},gin.go1
620:3no-naked-return
gin.go:620:3
if err != nil { return }binding/binding_nomsgpack.go1
74:2no-package-var
binding/binding_nomsgpack.go:74:2
var ( JSON = jsonBinding{} XML = xmlBinding{}render/render_test.go1
164:5optimize-operands-order
render/render_test.go:164:5
w.writeCount++ if (w.bufString != "" && string(buf) == w.bufString) || (w.ErrThreshold > 0 && w.writeCount >= w.ErrThreshold) { return 0, errors.New(`write error`)binding/xml.go1
5:9package-comments
binding/xml.go:5:9
package bindingbinding/form_mapping_test.go1
36:43redundant-conversion
binding/form_mapping_test.go:36:43
{"base type", struct{ F int32 }{}, "9", int32(9)}, {"base type", struct{ F int64 }{}, "9", int64(9)}, {"base type", struct{ F uint }{}, "9", uint(9)},context.go1
1415:2single-case-switch
context.go:1415:2
func (c *Context) Negotiate(code int, config Negotiate) { switch c.NegotiateFormat(config.Offered...) { case binding.MIMEJSON:binding/binding_test.go1
223:6test-parallelism
binding/binding_test.go:223:6
func TestBindingJSONDisallowUnknownFields(t *testing.T) { testBodyBindingDisallowUnknownFields(t, JSON,errors.go1
18:1top-level-declaration-order
errors.go:18:1
const ( // ErrorTypeBind is used when Context.Bind() fails.context_test.go1
434:51unchecked-type-assertion
context_test.go:434:51
assert.Exactly(t, int64(42424242424242), c.MustGet("int64").(int64)) assert.Exactly(t, uint64(42), c.MustGet("uint64").(uint64)) assert.InDelta(t, float32(4.2), c.MustGet("float32").(float32), 0.01)gin_test.go1
408:14unclosed-http-response-body
gin_test.go:408:14
client := &http.Client{Transport: tr} res, err := client.Get(ts.URL + "/test") if err != nil {render/render_msgpack_test.go1
67:28unused-parameter
render/render_msgpack_test.go:67:28
func (w *failWriter) Write(data []byte) (int, error) { return 0, errors.New("write error")binding/json_test.go1
147:7unused-receiver
binding/json_test.go:147:7
func (tc timeCodec) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator) { ts := iter.ReadString()binding/binding_test.go1
303:3add-constant
binding/binding_test.go:303:3
testFormBindingForTimeFailLocation(t, http.MethodGet, "/?time_foo=2017-11-15", "/?bar2=foo", "", "")logger.go1
245:6cognitive-complexity
logger.go:245:6
// LoggerWithConfig instance a Logger middleware with config.func LoggerWithConfig(conf LoggerConfig) HandlerFunc { formatter := conf.Formatterbinding/form_mapping.go1
469:17discarded-error-result
binding/form_mapping.go:469:17
l := time.Local if isUTC, _ := strconv.ParseBool(structField.Tag.Get("time_utc")); isUTC { l = time.UTCcontext.go1
555:1doc-comment-period
context.go:555:1
// GetQuery is like Query(), it returns the keyed url query value// if it exists `(value, true)` (even when the value is an empty string),tree_test.go1
1103:12error-strings
tree_test.go:1103:12
} else if string(out) != "/prefix/xxx" { t.Errorf("Wrong result for '/PREFIX/XXX': expected '/prefix/xxx', got: %s", string(out)) }binding/binding.go1
24:2exported-declaration-comment
binding/binding.go:24:2
MIMEYAML = "application/x-yaml" MIMEYAML2 = "application/yaml" MIMETOML = "application/toml"codec/json/go_json.go1
1:1format
codec/json/go_json.go:1:1
// Copyright 2025 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt codec/json/go_json.go`
tree_test.go1
138:6function-length
tree_test.go:138:6
func TestTreeWildcard(t *testing.T) { tree := &node{}gin_integration_test.go1
219:28insecure-url-scheme
gin_integration_test.go:219:28
// Wait for server to be ready with exponential backoff err := waitForServerReady("http://localhost:3123/example", 10) require.NoError(t, err, "server should start successfully")tree.go1
832:7max-control-nesting
tree.go:832:7
if c == idxc { if out := n.children[i].findCaseInsensitivePathRec( path, ciPath, rb, fixTrailingSlash,binding/binding_test.go1
141:6max-public-structs
binding/binding_test.go:141:6
type FooStructForStringPtrType struct { PtrFoo *string `form:"ptr_foo"`context_test.go1
2212:2modifies-parameter
context_test.go:2212:2
c.engine.trustedCIDRs = defaultTrustedCIDRs c.engine.AppEngine = false}binding/form_mapping_test.go1
38:17nested-structs
binding/form_mapping_test.go:38:17
{"base type", struct{ F uint }{}, "9", uint(9)}, {"base type", struct{ F uint8 }{}, "9", uint8(9)}, {"base type", struct{ F uint16 }{}, "9", uint16(9)},gin.go1
624:2no-naked-return
gin.go:624:2
err = engine.RunListener(listener) return}binding/binding_nomsgpack.go1
75:2no-package-var
binding/binding_nomsgpack.go:75:2
JSON = jsonBinding{} XML = xmlBinding{} Form = formBinding{}tree.go1
201:7optimize-operands-order
tree.go:201:7
// Otherwise insert it if c != ':' && c != '*' && n.nType != catchAll { // []byte for proper unicode char conversion, see #65binding/yaml.go1
5:9package-comments
binding/yaml.go:5:9
package bindingbinding/form_mapping_test.go1
37:42redundant-conversion
binding/form_mapping_test.go:37:42
{"base type", struct{ F int64 }{}, "9", int64(9)}, {"base type", struct{ F uint }{}, "9", uint(9)}, {"base type", struct{ F uint8 }{}, "9", uint8(9)},context_test.go1
2228:2single-case-switch
context_test.go:2228:2
var expectedCode int switch json.Package { case "github.com/goccy/go-json":binding/binding_test.go1
229:6test-parallelism
binding/binding_test.go:229:6
func TestBindingJSONStringMap(t *testing.T) { testBodyBindingStringMap(t, JSON,errors_test.go1
110:1top-level-declaration-order
errors_test.go:110:1
type TestErr stringcontext_test.go1
435:54unchecked-type-assertion
context_test.go:435:54
assert.Exactly(t, uint64(42), c.MustGet("uint64").(uint64)) assert.InDelta(t, float32(4.2), c.MustGet("float32").(float32), 0.01) assert.InDelta(t, 4.2, c.MustGet("float64").(float64), 0.01)gin_test.go1
428:14unclosed-http-response-body
gin_test.go:428:14
res, err := http.Get(ts.URL + "/raw") if err != nil {response_writer_test.go1
44:40unused-parameter
response_writer_test.go:44:40
func (w *nonFlusherWriter) Write(b []byte) (int, error) { return len(b), nil }func (w *nonFlusherWriter) WriteHeader(code int) {}binding/json_test.go1
173:7unused-receiver
binding/json_test.go:173:7
func (tpe *TimePointerEx) CreateDecoder(typ reflect2.Type) jsoniter.ValDecoder { if typ == timePointerType {binding/binding_test.go1
410:3add-constant
binding/binding_test.go:410:3
testQueryBinding(t, http.MethodGet, "/?foo=bar&bar=foo", "/?bar2=foo", "foo=unused", "")path.go1
23:6cognitive-complexity
path.go:23:6
// If the result of this process is an empty string, "/" is returned.func cleanPath(p string) string { // Turn empty string into "/"binding/form_mapping_test.go1
700:17discarded-error-result
binding/form_mapping_test.go:700:17
expected, _ := convertTo(val) assert.Equal(t, expected, s.FileData)context.go1
626:1doc-comment-period
context.go:626:1
// GetPostForm is like PostForm(key). It returns the specified key from a POST urlencoded// form or multipart form when it exists `(value, true)` (even when the value is an empty string),tree_test.go1
1111:12error-strings
tree_test.go:1111:12
} else if string(out) != "/prefix/something" { t.Errorf("Wrong result for '/prefix/something': %s", string(out)) }binding/binding.go1
25:2exported-declaration-comment
binding/binding.go:25:2
MIMEYAML2 = "application/yaml" MIMETOML = "application/toml" MIMEBSON = "application/bson"codec/json/json.go1
1:1format
codec/json/json.go:1:1
// Copyright 2025 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt codec/json/json.go`
tree_test.go1
570:6function-length
tree_test.go:570:6
func TestTreeTrailingSlashRedirect(t *testing.T) { tree := &node{}gin_integration_test.go1
223:17insecure-url-scheme
gin_integration_test.go:223:17
require.Error(t, router.Run(":3123")) testRequest(t, "http://localhost:3123/example")}tree.go1
857:7max-control-nesting
tree.go:857:7
if c == idxc { if out := n.children[i].findCaseInsensitivePathRec( path, ciPath, rb, fixTrailingSlash,binding/binding_test.go1
146:6max-public-structs
binding/binding_test.go:146:6
type FooStructForMapPtrType struct { PtrBar *map[string]any `form:"ptr_bar"`debug.go1
67:3modifies-parameter
debug.go:67:3
if !strings.HasSuffix(format, "\n") { format += "\n" }binding/form_mapping_test.go1
39:17nested-structs
binding/form_mapping_test.go:39:17
{"base type", struct{ F uint8 }{}, "9", uint8(9)}, {"base type", struct{ F uint16 }{}, "9", uint16(9)}, {"base type", struct{ F uint32 }{}, "9", uint32(9)},gin.go1
640:2no-naked-return
gin.go:640:2
err = http3.ListenAndServeQUIC(addr, certFile, keyFile, engine.Handler()) return}binding/binding_nomsgpack.go1
76:2no-package-var
binding/binding_nomsgpack.go:76:2
XML = xmlBinding{} Form = formBinding{} Query = queryBinding{}tree.go1
216:8optimize-operands-order
tree.go:216:8
// Check if the wildcard matches if len(path) >= len(n.path) && n.path == path[:len(n.path)] && // Adding a child to a catchAll is not possiblecodec/json/api.go1
5:9package-comments
codec/json/api.go:5:9
package jsonbinding/form_mapping_test.go1
38:43redundant-conversion
binding/form_mapping_test.go:38:43
{"base type", struct{ F uint }{}, "9", uint(9)}, {"base type", struct{ F uint8 }{}, "9", uint8(9)}, {"base type", struct{ F uint16 }{}, "9", uint16(9)},errors.go1
59:3single-case-switch
errors.go:59:3
value := reflect.ValueOf(msg.Meta) switch value.Kind() { case reflect.Struct:binding/binding_test.go1
235:6test-parallelism
binding/binding_test.go:235:6
func TestBindingForm(t *testing.T) { testFormBinding(t, http.MethodPost,fs.go1
28:1top-level-declaration-order
fs.go:28:1
// neutralizedReaddirFile wraps http.File with a specific implementation of `Readdir`.type neutralizedReaddirFile struct { http.Filecontext_test.go1
436:45unchecked-type-assertion
context_test.go:436:45
assert.InDelta(t, float32(4.2), c.MustGet("float32").(float32), 0.01) assert.InDelta(t, 4.2, c.MustGet("float64").(float64), 0.01) assert.Exactly(t, 1, c.MustGet("intInterface").(int))response_writer_test.go2
292:15unclosed-http-response-body
response_writer_test.go:292:15
// should return 500 resp, err := http.Get(testServer.URL) require.NoError(t, err)320:41unused-parameter
response_writer_test.go:320:41
func (m *mockPusherResponseWriter) Push(target string, opts *http.PushOptions) error { return nilbinding/json_test.go1
180:7unused-receiver
binding/json_test.go:180:7
func (tpe *TimePointerEx) CreateEncoder(typ reflect2.Type) jsoniter.ValEncoder { if typ == timePointerType {binding/binding_test.go1
450:27add-constant
binding/binding_test.go:450:27
assert.Len(t, obj, 2) assert.Equal(t, "2", obj["foo"]) assert.Equal(t, "world", obj["hello"])path.go1
155:6cognitive-complexity
path.go:155:6
// if s == "/a//b///c////" && char == '/', it returns "/a/b/c/"func removeRepeatedChar(s string, char byte) string { // Check if there are any consecutive charsbinding/form_mapping_test.go1
712:17discarded-error-result
binding/form_mapping_test.go:712:17
expected, _ := convertTo(val) assert.Equal(t, expected, s.FileData)context.go1
866:1doc-comment-period
context.go:866:1
// ShouldBindJSON is a shortcut for c.ShouldBindWith(obj, binding.JSON).//binding/binding.go1
26:2exported-declaration-comment
binding/binding.go:26:2
MIMETOML = "application/toml" MIMEBSON = "application/bson")codec/json/jsoniter.go1
1:1format
codec/json/jsoniter.go:1:1
// Copyright 2025 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt codec/json/jsoniter.go`
tree_test.go1
714:6function-length
tree_test.go:714:6
func TestTreeFindCaseInsensitivePath(t *testing.T) { tree := &node{}gin_integration_test.go1
241:28insecure-url-scheme
gin_integration_test.go:241:28
// Wait for server to be ready with exponential backoff err := waitForServerReady("http://localhost:5150/example", 10) require.NoError(t, err, "server should start successfully")tree.go1
872:7max-control-nesting
tree.go:872:7
for i, c := range []byte(n.indices) { if c == idxc { if out := n.children[i].findCaseInsensitivePathRec(binding/binding_test.go1
769:7max-public-structs
binding/binding_test.go:769:7
func TestRequiredSucceeds(t *testing.T) { type HogeStruct struct { Hoge *int `json:"hoge" binding:"required"`gin.go1
398:2modifies-parameter
gin.go:398:2
func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo { path += root.path if len(root.handlers) > 0 {binding/form_mapping_test.go1
40:17nested-structs
binding/form_mapping_test.go:40:17
{"base type", struct{ F uint16 }{}, "9", uint16(9)}, {"base type", struct{ F uint32 }{}, "9", uint32(9)}, {"base type", struct{ F uint64 }{}, "9", uint64(9)},gin.go1
658:2no-naked-return
gin.go:658:2
err = server.Serve(listener) return}binding/binding_nomsgpack.go1
77:2no-package-var
binding/binding_nomsgpack.go:77:2
Form = formBinding{} Query = queryBinding{} FormPost = formPostBinding{}tree.go1
216:8optimize-operands-order
tree.go:216:8
// Check if the wildcard matches if len(path) >= len(n.path) && n.path == path[:len(n.path)] && // Adding a child to a catchAll is not possiblecodec/json/go_json.go1
7:9package-comments
codec/json/go_json.go:7:9
package jsonbinding/form_mapping_test.go1
39:44redundant-conversion
binding/form_mapping_test.go:39:44
{"base type", struct{ F uint8 }{}, "9", uint8(9)}, {"base type", struct{ F uint16 }{}, "9", uint16(9)}, {"base type", struct{ F uint32 }{}, "9", uint32(9)},errors.go1
142:2single-case-switch
errors.go:142:2
func (a errorMsgs) JSON() any { switch length := len(a); length { case 0:binding/binding_test.go1
241:6test-parallelism
binding/binding_test.go:241:6
func TestBindingForm2(t *testing.T) { testFormBinding(t, http.MethodGet,gin.go1
68:1top-level-declaration-order
gin.go:68:1
// RouteInfo represents a request route's specification which contains method and path and its handler.type RouteInfo struct { Method stringcontext_test.go1
437:48unchecked-type-assertion
context_test.go:437:48
assert.InDelta(t, 4.2, c.MustGet("float64").(float64), 0.01) assert.Exactly(t, 1, c.MustGet("intInterface").(int))}test_helpers.go1
45:16unclosed-http-response-body
test_helpers.go:45:16
for i := 0; i < maxAttempts; i++ { resp, err := client.Get(url) if err == nil {response_writer_test.go1
320:56unused-parameter
response_writer_test.go:320:56
func (m *mockPusherResponseWriter) Push(target string, opts *http.PushOptions) error { return nilbinding/json_test.go1
189:7unused-receiver
binding/json_test.go:189:7
func (tpc timePointerCodec) IsEmpty(ptr unsafe.Pointer) bool { t := *((**time.Time)(ptr))binding/binding_test.go1
451:18add-constant
binding/binding_test.go:451:18
assert.Equal(t, "2", obj["foo"]) assert.Equal(t, "world", obj["hello"])}recovery.go1
53:6cognitive-complexity
recovery.go:53:6
// CustomRecoveryWithWriter returns a middleware for a given writer that recovers from any panics and calls the provided handle func to handle it.func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc { var logger *log.Loggerbinding/form_mapping_test.go1
717:12discarded-error-result
binding/form_mapping_test.go:717:12
func TestMappingCustomArrayOfArrayUri(t *testing.T) { id1, _ := convertTo(`664a062ac74a8ad104e0e80e`) id2, _ := convertTo(`664a062ac74a8ad104e0e80f`)context.go1
1073:1doc-comment-period
context.go:1073:1
// Scheme returns the HTTP scheme of the request ("http" or "https").// When running behind reverse proxies or load balancers `Request.URL.Scheme` is usually empty.binding/binding.go1
32:6exported-declaration-comment
binding/binding.go:32:6
// the form POST.type Binding interface { Name() stringcodec/json/sonic.go1
1:1format
codec/json/sonic.go:1:1
// Copyright 2025 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt codec/json/sonic.go`
gin_integration_test.go1
245:17insecure-url-scheme
gin_integration_test.go:245:17
require.Error(t, router.Run(":5150")) testRequest(t, "http://localhost:5150/example")}tree.go1
873:8max-control-nesting
tree.go:873:8
if c == idxc { if out := n.children[i].findCaseInsensitivePathRec( path, ciPath, rb, fixTrailingSlash,binding/binding_test.go1
780:7max-public-structs
binding/binding_test.go:780:7
func TestRequiredFails(t *testing.T) { type HogeStruct struct { Hoge *int `json:"foo" binding:"required"`gin.go1
401:3modifies-parameter
gin.go:401:3
handlerFunc := root.handlers.Last() routes = append(routes, RouteInfo{ Method: method,binding/form_mapping_test.go1
41:17nested-structs
binding/form_mapping_test.go:41:17
{"base type", struct{ F uint32 }{}, "9", uint32(9)}, {"base type", struct{ F uint64 }{}, "9", uint64(9)}, {"base type", struct{ F bool }{}, "True", true},path_test.go1
123:2no-naked-return
path_test.go:123:2
} return}binding/binding_nomsgpack.go1
78:2no-package-var
binding/binding_nomsgpack.go:78:2
Query = queryBinding{} FormPost = formPostBinding{} FormMultipart = formMultipartBinding{}tree.go1
220:7optimize-operands-order
tree.go:220:7
// Check for longer wildcard, e.g. :name and :names (len(n.path) >= len(path) || path[len(n.path)] == '/') { continue walkcodec/json/json.go1
7:9package-comments
codec/json/json.go:7:9
package jsonbinding/form_mapping_test.go1
40:44redundant-conversion
binding/form_mapping_test.go:40:44
{"base type", struct{ F uint16 }{}, "9", uint16(9)}, {"base type", struct{ F uint32 }{}, "9", uint32(9)}, {"base type", struct{ F uint64 }{}, "9", uint64(9)},gin.go1
427:4single-case-switch
gin.go:427:4
switch len(ip) { case net.IPv4len:binding/binding_test.go1
247:6test-parallelism
binding/binding_test.go:247:6
func TestBindingFormEmbeddedStruct(t *testing.T) { testFormBindingEmbeddedStruct(t, http.MethodPost,gin_test.go1
328:1top-level-declaration-order
gin_test.go:328:1
var tmplFS = http.Dir("testdata/template")context_test.go1
724:42unchecked-type-assertion
context_test.go:724:42
assert.Nil(t, cp.writermem.ResponseWriter) assert.Equal(t, &cp.writermem, cp.Writer.(*responseWriter)) assert.Equal(t, cp.Request, c.Request)tree_test.go1
533:29unused-parameter
tree_test.go:533:29
func TestTreeCatchMaxParams(t *testing.T) { tree := &node{}binding/json_test.go1
194:7unused-receiver
binding/json_test.go:194:7
func (tpc timePointerCodec) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream) { t := *((**time.Time)(ptr))binding/binding_test.go1
451:31add-constant
binding/binding_test.go:451:31
assert.Equal(t, "2", obj["foo"]) assert.Equal(t, "world", obj["hello"])}recovery.go1
119:6cognitive-complexity
recovery.go:119:6
// stack returns a nicely formatted stack frame, skipping skip frames.func stack(skip int) []byte { buf := new(bytes.Buffer) // the returned databinding/form_mapping_test.go1
718:12discarded-error-result
binding/form_mapping_test.go:718:12
id1, _ := convertTo(`664a062ac74a8ad104e0e80e`) id2, _ := convertTo(`664a062ac74a8ad104e0e80f`)context.go1
1127:1doc-comment-period
context.go:1127:1
// Header is an intelligent shortcut for c.Writer.Header().Set(key, value).// It writes a header in the response.binding/binding.go1
39:6exported-declaration-comment
binding/binding.go:39:6
// but it reads the body from supplied bytes instead of req.Body.type BindingBody interface { Bindingcontext.go1
1:1format
context.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt context.go`
gin_test.go1
103:9insecure-url-scheme
gin_test.go:103:9
url := "http://" + ln.Addr().String() + "/"binding/binding_test.go1
819:7max-public-structs
binding/binding_test.go:819:7
type Tag struct { Name string `uri:"name"`gin.go1
409:3modifies-parameter
gin.go:409:3
for _, child := range root.children { routes = iterate(path, method, routes, child) }binding/form_mapping_test.go1
42:17nested-structs
binding/form_mapping_test.go:42:17
{"base type", struct{ F uint64 }{}, "9", uint64(9)}, {"base type", struct{ F bool }{}, "True", true}, {"base type", struct{ F float32 }{}, "9.1", float32(9.1)},render/data.go1
25:2no-naked-return
render/data.go:25:2
_, err = w.Write(r.Data) return}binding/binding_nomsgpack.go1
79:2no-package-var
binding/binding_nomsgpack.go:79:2
FormPost = formPostBinding{} FormMultipart = formMultipartBinding{} ProtoBuf = protobufBinding{}tree.go1
493:10optimize-operands-order
tree.go:493:10
end := 0 for end < len(path) && path[end] != '/' { end++codec/json/jsoniter.go1
7:9package-comments
codec/json/jsoniter.go:7:9
package jsonbinding/form_mapping_test.go1
41:44redundant-conversion
binding/form_mapping_test.go:41:44
{"base type", struct{ F uint32 }{}, "9", uint32(9)}, {"base type", struct{ F uint64 }{}, "9", uint64(9)}, {"base type", struct{ F bool }{}, "True", true},gin_test.go1
689:3single-case-switch
gin_test.go:689:3
switch { case count > 0:binding/binding_test.go1
253:6test-parallelism
binding/binding_test.go:253:6
func TestBindingFormEmbeddedStruct2(t *testing.T) { testFormBindingEmbeddedStruct(t, http.MethodGet,githubapi_test.go1
27:1top-level-declaration-order
githubapi_test.go:27:1
// http://developer.github.com/v3/var githubAPI = []route{ // OAuth Authorizationsfs_test.go1
33:32unchecked-type-assertion
fs_test.go:33:32
require.NoError(t, err) assert.Equal(t, testFile, file.(neutralizedReaddirFile).File)}tree_test.go1
901:32unused-parameter
tree_test.go:901:32
func TestTreeInvalidParamsType(t *testing.T) { tree := &node{}binding/json_test.go1
203:7unused-receiver
binding/json_test.go:203:7
func (tpc timePointerCodec) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator) { ts := iter.ReadString()binding/binding_test.go1
506:17add-constant
binding/binding_test.go:506:17
require.NoError(t, err) req.Header.Set("Content-Type", MIMEPOSTForm) return reqtree.go1
135:16cognitive-complexity
tree.go:135:16
// Not concurrency-safe!func (n *node) addRoute(path string, handlers HandlersChain) { fullPath := pathbinding/form_mapping_test.go1
729:12discarded-error-result
binding/form_mapping_test.go:729:12
func TestMappingCustomArrayOfArrayForm(t *testing.T) { id1, _ := convertTo(`664a062ac74a8ad104e0e80e`) id2, _ := convertTo(`664a062ac74a8ad104e0e80f`)context.go1
1151:1doc-comment-period
context.go:1151:1
// SetSameSite with cookiefunc (c *Context) SetSameSite(samesite http.SameSite) {binding/binding.go1
46:6exported-declaration-comment
binding/binding.go:46:6
// but it reads the Params.type BindingUri interface { Name() stringcontext_test.go1
1:1format
context_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt context_test.go`
recovery_test.go1
313:45insecure-url-scheme
recovery_test.go:313:45
req: func() *http.Request { r, _ := http.NewRequest(http.MethodGet, "http://example.com", nil) r.Header.Set("Authorization", "Bearer secret-token")binding/binding_test.go1
828:7max-public-structs
binding/binding_test.go:828:7
type NotSupportStruct struct { Name map[string]any `uri:"name"`gin.go1
505:2modifies-parameter
gin.go:505:2
func updateRouteTree(n *node) { n.path = strings.ReplaceAll(n.path, escapedColon, colon) n.fullPath = strings.ReplaceAll(n.fullPath, escapedColon, colon)binding/form_mapping_test.go1
43:17nested-structs
binding/form_mapping_test.go:43:17
{"base type", struct{ F bool }{}, "True", true}, {"base type", struct{ F float32 }{}, "9.1", float32(9.1)}, {"base type", struct{ F float64 }{}, "9.1", float64(9.1)},render/reader.go1
32:2no-naked-return
render/reader.go:32:2
_, err = io.Copy(w, r.Reader) return}binding/binding_nomsgpack.go1
80:2no-package-var
binding/binding_nomsgpack.go:80:2
FormMultipart = formMultipartBinding{} ProtoBuf = protobufBinding{} YAML = yamlBinding{}tree.go1
616:7optimize-operands-order
tree.go:616:7
// additional trailing slash if path == "/" && n.wildChild && n.nType != root { value.tsr = truecodec/json/sonic.go1
7:9package-comments
codec/json/sonic.go:7:9
package jsonbinding/form_mapping_test.go1
43:47redundant-conversion
binding/form_mapping_test.go:43:47
{"base type", struct{ F bool }{}, "True", true}, {"base type", struct{ F float32 }{}, "9.1", float32(9.1)}, {"base type", struct{ F float64 }{}, "9.1", float64(9.1)},logger.go1
97:2single-case-switch
logger.go:97:2
switch { case code >= http.StatusContinue && code < http.StatusOK:binding/binding_test.go1
259:6test-parallelism
binding/binding_test.go:259:6
func TestBindingFormDefaultValue(t *testing.T) { testFormBindingDefaultValue(t, http.MethodPost,internal/bytesconv/bytesconv_test.go1
53:1top-level-declaration-order
internal/bytesconv/bytesconv_test.go:53:1
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"const (gin.go1
667:24unchecked-type-assertion
gin.go:667:24
c := engine.pool.Get().(*Context) c.writermem.reset(w)codec/json/go_json.go1
24:7unused-receiver
codec/json/go_json.go:24:7
func (j gojsonApi) Marshal(v any) ([]byte, error) { return json.Marshal(v)binding/binding_test.go1
538:42add-constant
binding/binding_test.go:538:42
require.NoError(t, mw.SetBoundary(boundary)) require.NoError(t, mw.WriteField("foo", "bar")) require.NoError(t, mw.WriteField("bar", "foo"))tree.go1
253:6cognitive-complexity
tree.go:253:6
// Returns -1 as index, if no wildcard was found.func findWildcard(path string) (wildcard string, i int, valid bool) { // Find startbinding/form_mapping_test.go1
730:12discarded-error-result
binding/form_mapping_test.go:730:12
id1, _ := convertTo(`664a062ac74a8ad104e0e80e`) id2, _ := convertTo(`664a062ac74a8ad104e0e80f`)context.go1
1218:1doc-comment-period
context.go:1218:1
// HTML renders the HTTP template specified by its file name.// It also updates the HTTP code and sets the Content-Type as "text/html".binding/binding.go1
55:6exported-declaration-comment
binding/binding.go:55:6
// https://github.com/go-playground/validator/tree/v10.6.1.type StructValidator interface { // ValidateStruct can receive any kind of type and it should never panic, even if the configuration is not right.debug.go1
1:1format
debug.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt debug.go`
recovery_test.go1
323:45insecure-url-scheme
recovery_test.go:323:45
req: func() *http.Request { r, _ := http.NewRequest(http.MethodGet, "http://example.com", nil) r.Header.Set("authorization", "some-secret")binding/binding_test.go1
837:7max-public-structs
binding/binding_test.go:837:7
func TestUriInnerBinding(t *testing.T) { type Tag struct { Name string `uri:"name"`gin.go1
506:2modifies-parameter
gin.go:506:2
n.path = strings.ReplaceAll(n.path, escapedColon, colon) n.fullPath = strings.ReplaceAll(n.fullPath, escapedColon, colon) n.indices = strings.ReplaceAll(n.indices, backslash, colon)binding/form_mapping_test.go1
44:17nested-structs
binding/form_mapping_test.go:44:17
{"base type", struct{ F float32 }{}, "9.1", float32(9.1)}, {"base type", struct{ F float64 }{}, "9.1", float64(9.1)}, {"base type", struct{ F string }{}, "test", string("test")},render/text.go1
37:3no-naked-return
render/text.go:37:3
_, err = fmt.Fprintf(w, format, data...) return }binding/binding_nomsgpack.go1
81:2no-package-var
binding/binding_nomsgpack.go:81:2
ProtoBuf = protobufBinding{} YAML = yamlBinding{} Uri = uriBinding{}tree.go1
616:7optimize-operands-order
tree.go:616:7
// additional trailing slash if path == "/" && n.wildChild && n.nType != root { value.tsr = truecontext.go1
5:9package-comments
context.go:5:9
package ginbinding/form_mapping_test.go1
44:47redundant-conversion
binding/form_mapping_test.go:44:47
{"base type", struct{ F float32 }{}, "9.1", float32(9.1)}, {"base type", struct{ F float64 }{}, "9.1", float64(9.1)}, {"base type", struct{ F string }{}, "test", string("test")},logger.go1
114:2single-case-switch
logger.go:114:2
latency := p.Latency switch { case latency < time.Millisecond*100:binding/binding_test.go1
265:6test-parallelism
binding/binding_test.go:265:6
func TestBindingFormDefaultValue2(t *testing.T) { testFormBindingDefaultValue(t, http.MethodGet,logger.go1
19:1top-level-declaration-order
logger.go:19:1
const ( autoColor consoleColorModeValue = iotamode.go1
99:24unchecked-type-assertion
mode.go:99:24
func Mode() string { return modeName.Load().(string)}codec/json/go_json.go1
28:7unused-receiver
codec/json/go_json.go:28:7
func (j gojsonApi) Unmarshal(data []byte, v any) error { return json.Unmarshal(data, v)binding/binding_test.go1
549:48add-constant
binding/binding_test.go:549:48
req, err2 := http.NewRequest(http.MethodPost, "/?foo=getfoo&bar=getbar", body) require.NoError(t, err2)tree.go1
288:16cognitive-complexity
tree.go:288:16
func (n *node) insertChild(path string, fullPath string, handlers HandlersChain) { for {binding/form_mapping_test.go1
950:17discarded-error-result
binding/form_mapping_test.go:950:17
expected, _ := convertToOidUnmarshalText(val) assert.Equal(t, expected, s.FileData)context.go1
1357:1doc-comment-period
context.go:1357:1
// FileAttachment writes the specified file into the body stream in an efficient way// On the client side, the file will typically be downloaded with the given filenamebinding/binding.go1
72:5exported-declaration-comment
binding/binding.go:72:5
// under the hood.var Validator StructValidator = &defaultValidator{}debug_test.go1
1:1format
debug_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt debug_test.go`
recovery_test.go1
333:45insecure-url-scheme
recovery_test.go:333:45
req: func() *http.Request { r, _ := http.NewRequest(http.MethodGet, "http://example.com", nil) r.Header.Set("AuThOrIzAtIoN", "token123")render/json.go1
46:6max-public-structs
render/json.go:46:6
// PureJSON contains the given interface object.type PureJSON struct { Data anygin.go1
507:2modifies-parameter
gin.go:507:2
n.fullPath = strings.ReplaceAll(n.fullPath, escapedColon, colon) n.indices = strings.ReplaceAll(n.indices, backslash, colon) if n.children == nil {binding/form_mapping_test.go1
45:17nested-structs
binding/form_mapping_test.go:45:17
{"base type", struct{ F float64 }{}, "9.1", float64(9.1)}, {"base type", struct{ F string }{}, "test", string("test")}, {"base type", struct{ F *int }{}, "9", intPtr(9)},render/text.go1
40:2no-naked-return
render/text.go:40:2
_, err = w.Write(bytesconv.StringToBytes(format)) return}binding/binding_nomsgpack.go1
82:2no-package-var
binding/binding_nomsgpack.go:82:2
YAML = yamlBinding{} Uri = uriBinding{} Header = headerBinding{}tree.go1
631:18optimize-operands-order
tree.go:631:18
n = n.children[i] value.tsr = (len(n.path) == 1 && n.handlers != nil) || (n.nType == catchAll && n.children[0].handlers != nil)context_appengine.go1
7:9package-comments
context_appengine.go:7:9
package ginbinding/form_mapping_test.go1
45:47redundant-conversion
binding/form_mapping_test.go:45:47
{"base type", struct{ F float64 }{}, "9.1", float64(9.1)}, {"base type", struct{ F string }{}, "test", string("test")}, {"base type", struct{ F *int }{}, "9", intPtr(9)},logger.go1
136:2single-case-switch
logger.go:136:2
switch method { case http.MethodGet:binding/binding_test.go1
271:6test-parallelism
binding/binding_test.go:271:6
func TestBindingFormForTime(t *testing.T) { testFormBindingForTime(t, http.MethodPost,path_test.go1
20:1top-level-declaration-order
path_test.go:20:1
var cleanTests = []cleanPathTest{ // Already cleanrecovery_test.go1
204:28unchecked-type-assertion
recovery_test.go:204:28
handleRecovery := func(c *Context, err any) { errBuffer.WriteString(err.(string)) c.AbortWithStatus(http.StatusBadRequest)codec/json/go_json.go1
32:7unused-receiver
codec/json/go_json.go:32:7
func (j gojsonApi) MarshalIndent(v any, prefix, indent string) ([]byte, error) { return json.MarshalIndent(v, prefix, indent)binding/binding_test.go1
566:20add-constant
binding/binding_test.go:566:20
f, err := os.Open("form.go") require.NoError(t, err)tree.go1
418:16cognitive-complexity
tree.go:418:16
// given path.func (n *node) getValue(path string, params *Params, skippedNodes *[]skippedNode, unescape bool) (value nodeValue) { var globalParamsCount int16binding/form_mapping_test.go1
962:17discarded-error-result
binding/form_mapping_test.go:962:17
expected, _ := convertToOidUnmarshalText(val) assert.Equal(t, expected, s.FileData)context.go1
1376:1doc-comment-period
context.go:1376:1
// Stream sends a streaming response and returns a boolean// indicates "Is client disconnected in middle of stream"binding/binding.go1
77:2exported-declaration-comment
binding/binding.go:77:2
var ( JSON BindingBody = jsonBinding{} XML BindingBody = xmlBinding{}deprecated.go1
1:1format
deprecated.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt deprecated.go`
recovery_test.go1
343:45insecure-url-scheme
recovery_test.go:343:45
req: func() *http.Request { r, _ := http.NewRequest(http.MethodGet, "http://example.com", nil) r.Header.Set("Content-Type", "application/json")gin.go1
686:2modifies-parameter
gin.go:686:2
c.index = oldIndexValue c.handlers = oldHandlersbinding/form_mapping_test.go1
46:17nested-structs
binding/form_mapping_test.go:46:17
{"base type", struct{ F string }{}, "test", string("test")}, {"base type", struct{ F *int }{}, "9", intPtr(9)},response_writer.go1
88:2no-naked-return
response_writer.go:88:2
w.size += n return}binding/binding_nomsgpack.go1
83:2no-package-var
binding/binding_nomsgpack.go:83:2
Uri = uriBinding{} Header = headerBinding{} TOML = tomlBinding{}tree.go1
631:19optimize-operands-order
tree.go:631:19
n = n.children[i] value.tsr = (len(n.path) == 1 && n.handlers != nil) || (n.nType == catchAll && n.children[0].handlers != nil)debug.go1
5:9package-comments
debug.go:5:9
package ginbinding/form_mapping_test.go1
49:41redundant-conversion
binding/form_mapping_test.go:49:41
// zero values {"zero value", struct{ F int }{}, "", int(0)}, {"zero value", struct{ F uint }{}, "", uint(0)},logger.go1
176:2single-case-switch
logger.go:176:2
switch { case param.Latency > time.Minute:binding/binding_test.go1
289:6test-parallelism
binding/binding_test.go:289:6
func TestBindingFormForTime2(t *testing.T) { testFormBindingForTime(t, http.MethodGet,render/bson.go1
18:1top-level-declaration-order
render/bson.go:18:1
var bsonContentType = []string{"application/bson"}recovery_test.go1
239:28unchecked-type-assertion
recovery_test.go:239:28
handleRecovery := func(c *Context, err any) { errBuffer.WriteString(err.(string)) c.AbortWithStatus(http.StatusBadRequest)codec/json/go_json.go1
36:7unused-receiver
codec/json/go_json.go:36:7
func (j gojsonApi) NewEncoder(writer io.Writer) Encoder { return json.NewEncoder(writer)binding/binding_test.go1
582:14add-constant
binding/binding_test.go:582:14
func createFormMultipartRequest(t *testing.T) *http.Request { boundary := "--testboundary" body := new(bytes.Buffer)tree.go1
703:16cognitive-complexity
tree.go:703:16
// Recursive case-insensitive lookup function used by n.findCaseInsensitivePathfunc (n *node) findCaseInsensitivePathRec(path string, ciPath []byte, rb [4]byte, fixTrailingSlash bool) []byte { npLen := len(n.path)binding/form_mapping_test.go1
967:12discarded-error-result
binding/form_mapping_test.go:967:12
func TestMappingCustomArrayOfArrayUnmarshalTextUri(t *testing.T) { id1, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80e`) id2, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80f`)context_file_test.go1
11:1doc-comment-period
context_file_test.go:11:1
// TestContextFileSimple tests the Context.File() method with a simple casefunc TestContextFileSimple(t *testing.T) {binding/binding.go1
78:2exported-declaration-comment
binding/binding.go:78:2
JSON BindingBody = jsonBinding{} XML BindingBody = xmlBinding{} Form Binding = formBinding{}deprecated_test.go1
1:1format
deprecated_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt deprecated_test.go`
gin.go1
687:2modifies-parameter
gin.go:687:2
c.index = oldIndexValue c.handlers = oldHandlers}binding/form_mapping_test.go1
49:18nested-structs
binding/form_mapping_test.go:49:18
// zero values {"zero value", struct{ F int }{}, "", int(0)}, {"zero value", struct{ F uint }{}, "", uint(0)},response_writer.go1
95:2no-naked-return
response_writer.go:95:2
w.size += n return}binding/binding_nomsgpack.go1
84:2no-package-var
binding/binding_nomsgpack.go:84:2
Header = headerBinding{} TOML = tomlBinding{} Plain = plainBinding{}tree.go1
643:5optimize-operands-order
tree.go:643:5
value.tsr = path == "/" || (len(prefix) == len(path)+1 && prefix[len(path)] == '/' && path == prefix[:len(prefix)-1] && n.handlers != nil)deprecated.go1
5:9package-comments
deprecated.go:5:9
package ginbinding/form_mapping_test.go1
50:42redundant-conversion
binding/form_mapping_test.go:50:42
{"zero value", struct{ F int }{}, "", int(0)}, {"zero value", struct{ F uint }{}, "", uint(0)}, {"zero value", struct{ F bool }{}, "", false},mode.go1
67:2single-case-switch
mode.go:67:2
switch value { case DebugMode:binding/binding_test.go1
307:6test-parallelism
binding/binding_test.go:307:6
func TestFormBindingIgnoreField(t *testing.T) { testFormBindingIgnoreField(t, http.MethodPost,render/html.go1
51:1top-level-declaration-order
render/html.go:51:1
var htmlContentType = []string{"text/html; charset=utf-8"}recovery_test.go1
274:28unchecked-type-assertion
recovery_test.go:274:28
handleRecovery := func(c *Context, err any) { errBuffer.WriteString(err.(string)) c.AbortWithStatus(http.StatusBadRequest)codec/json/go_json.go1
40:7unused-receiver
codec/json/go_json.go:40:7
func (j gojsonApi) NewDecoder(reader io.Reader) Decoder { return json.NewDecoder(reader)binding/binding_test.go1
592:55add-constant
binding/binding_test.go:592:55
require.NoError(t, err) req.Header.Set("Content-Type", MIMEMultipartPOSTForm+"; boundary="+boundary) return reqtree_test.go1
41:6cognitive-complexity
tree_test.go:41:6
func checkRequests(t *testing.T, tree *node, requests testRequests, unescapes ...bool) { unescape := falsebinding/form_mapping_test.go1
968:12discarded-error-result
binding/form_mapping_test.go:968:12
id1, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80e`) id2, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80f`)context_file_test.go1
26:1doc-comment-period
context_file_test.go:26:1
// TestContextFileNotFound tests serving a non-existent filefunc TestContextFileNotFound(t *testing.T) {binding/binding.go1
79:2exported-declaration-comment
binding/binding.go:79:2
XML BindingBody = xmlBinding{} Form Binding = formBinding{} Query Binding = queryBinding{}errors.go1
1:1format
errors.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt errors.go`
gin.go1
717:4modifies-parameter
gin.go:717:4
if value.params != nil { c.Params = *value.params }binding/form_mapping_test.go1
50:18nested-structs
binding/form_mapping_test.go:50:18
{"zero value", struct{ F int }{}, "", int(0)}, {"zero value", struct{ F uint }{}, "", uint(0)}, {"zero value", struct{ F bool }{}, "", false},test_helpers.go1
22:2no-naked-return
test_helpers.go:22:2
c.writermem.reset(w) return}binding/binding_nomsgpack.go1
85:2no-package-var
binding/binding_nomsgpack.go:85:2
TOML = tomlBinding{} Plain = plainBinding{} BSON BindingBody = bsonBinding{}tree.go1
643:5optimize-operands-order
tree.go:643:5
value.tsr = path == "/" || (len(prefix) == len(path)+1 && prefix[len(path)] == '/' && path == prefix[:len(prefix)-1] && n.handlers != nil)errors.go1
5:9package-comments
errors.go:5:9
package ginbinding/form_mapping_test.go1
52:45redundant-conversion
binding/form_mapping_test.go:52:45
{"zero value", struct{ F bool }{}, "", false}, {"zero value", struct{ F float32 }{}, "", float32(0)}, {"file value", struct{ F *multipart.FileHeader }{}, "", &multipart.FileHeader{}},path.go1
62:3single-case-switch
path.go:62:3
for r < n { switch { case p[r] == '/':binding/binding_test.go1
313:6test-parallelism
binding/binding_test.go:313:6
func TestBindingFormInvalidName(t *testing.T) { testFormBindingInvalidName(t, http.MethodPost,render/json.go1
50:1top-level-declaration-order
render/json.go:50:1
var ( jsonContentType = []string{"application/json; charset=utf-8"}render/protobuf.go1
24:36unchecked-type-assertion
render/protobuf.go:24:36
bytes, err := proto.Marshal(r.Data.(proto.Message)) if err != nil {codec/json/json.go1
23:7unused-receiver
codec/json/json.go:23:7
func (j jsonApi) Marshal(v any) ([]byte, error) { return json.Marshal(v)binding/binding_test.go1
604:47add-constant
binding/binding_test.go:604:47
require.NoError(t, mw.WriteField("map_foo", "{\"bar\":123, \"name\":\"thinkerou\", \"pai\": 3.14}")) req, err := http.NewRequest(http.MethodPost, "/?map_foo=getfoo", body) require.NoError(t, err)tree_test.go1
376:6cognitive-complexity
tree_test.go:376:6
func testRoutes(t *testing.T, routes []testRoute) { tree := &node{}binding/form_mapping_test.go1
979:12discarded-error-result
binding/form_mapping_test.go:979:12
func TestMappingCustomArrayOfArrayUnmarshalTextForm(t *testing.T) { id1, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80e`) id2, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80f`)context_test.go1
80:1doc-comment-period
context_test.go:80:1
// TestContextFile tests the Context.File() methodfunc TestContextFile(t *testing.T) {binding/binding.go1
80:2exported-declaration-comment
binding/binding.go:80:2
Form Binding = formBinding{} Query Binding = queryBinding{} FormPost Binding = formPostBinding{}errors_test.go1
1:1format
errors_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt errors_test.go`
gin.go1
720:4modifies-parameter
gin.go:720:4
if value.handlers != nil { c.handlers = value.handlers c.fullPath = value.fullPathbinding/form_mapping_test.go1
51:18nested-structs
binding/form_mapping_test.go:51:18
{"zero value", struct{ F uint }{}, "", uint(0)}, {"zero value", struct{ F bool }{}, "", false}, {"zero value", struct{ F float32 }{}, "", float32(0)},test_helpers.go1
34:2no-naked-return
test_helpers.go:34:2
c.writermem.reset(w) return}binding/binding_nomsgpack.go1
86:2no-package-var
binding/binding_nomsgpack.go:86:2
Plain = plainBinding{} BSON BindingBody = bsonBinding{})tree.go1
643:5optimize-operands-order
tree.go:643:5
value.tsr = path == "/" || (len(prefix) == len(path)+1 && prefix[len(path)] == '/' && path == prefix[:len(prefix)-1] && n.handlers != nil)fs.go1
5:9package-comments
fs.go:5:9
package gincontext_test.go1
312:18redundant-conversion
context_test.go:312:18
require.NoError(t, err) assert.Equal(t, os.FileMode(0o700), info.Mode().Perm(), "permissions of a pre-existing directory must not be modified")routergroup_test.go1
59:2single-case-switch
routergroup_test.go:59:2
switch method { case http.MethodGet:binding/binding_test.go1
319:6test-parallelism
binding/binding_test.go:319:6
func TestBindingFormInvalidName2(t *testing.T) { testFormBindingInvalidName2(t, http.MethodPost,render/msgpack.go1
26:1top-level-declaration-order
render/msgpack.go:26:1
var msgpackContentType = []string{"application/msgpack; charset=utf-8"}utils_test.go1
122:29unchecked-type-assertion
utils_test.go:122:29
called = true value = c.MustGet(BindKey).(*bindTestStruct) })codec/json/json.go1
27:7unused-receiver
codec/json/json.go:27:7
func (j jsonApi) Unmarshal(data []byte, v any) error { return json.Unmarshal(data, v)binding/binding_test.go1
826:18add-constant
binding/binding_test.go:826:18
require.NoError(t, b.BindUri(m, &tag)) assert.Equal(t, "thinkerou", tag.Name)tree_test.go1
570:6cognitive-complexity
tree_test.go:570:6
func TestTreeTrailingSlashRedirect(t *testing.T) { tree := &node{}binding/form_mapping_test.go1
980:12discarded-error-result
binding/form_mapping_test.go:980:12
id1, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80e`) id2, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80f`)context_test.go1
1146:1doc-comment-period
context_test.go:1146:1
// Tests that the response is serialized as JSON// and Content-Type is set to application/jsonbinding/binding.go1
81:2exported-declaration-comment
binding/binding.go:81:2
Query Binding = queryBinding{} FormPost Binding = formPostBinding{} FormMultipart Binding = formMultipartBinding{}fs.go1
1:1format
fs.go:1:1
// Copyright 2017 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt fs.go`
gin.go1
721:4modifies-parameter
gin.go:721:4
c.handlers = value.handlers c.fullPath = value.fullPath c.Next()binding/form_mapping_test.go1
52:18nested-structs
binding/form_mapping_test.go:52:18
{"zero value", struct{ F bool }{}, "", false}, {"zero value", struct{ F float32 }{}, "", float32(0)}, {"file value", struct{ F *multipart.FileHeader }{}, "", &multipart.FileHeader{}},tree.go1
42:2no-naked-return
tree.go:42:2
va, _ = ps.Get(name) return}binding/form_mapping.go1
23:2no-package-var
binding/form_mapping.go:23:2
var ( errUnknownType = errors.New("unknown type")tree.go1
726:10optimize-operands-order
tree.go:726:10
n = n.children[i] if (len(n.path) == 1 && n.handlers != nil) || (n.nType == catchAll && n.children[0].handlers != nil) {gin.go1
5:9package-comments
gin.go:5:9
package gincontext_test.go1
392:4redundant-conversion
context_test.go:392:4
{1}, {int32(1)}, {int64(1)},tree.go1
276:4single-case-switch
tree.go:276:4
for end, c := range []byte(path[start+1:]) { switch c { case '/':binding/binding_test.go1
325:6test-parallelism
binding/binding_test.go:325:6
func TestBindingFormForType(t *testing.T) { testFormBindingForType(t, http.MethodPost,render/pdf.go1
14:1top-level-declaration-order
render/pdf.go:14:1
var pdfContentType = []string{"application/pdf"}codec/json/json.go1
31:7unused-receiver
codec/json/json.go:31:7
func (j jsonApi) MarshalIndent(v any, prefix, indent string) ([]byte, error) { return json.MarshalIndent(v, prefix, indent)binding/binding_test.go1
848:3add-constant
binding/binding_test.go:848:3
m := map[string][]string{ "name": {expectedName}, "age": {strconv.Itoa(expectedAge)},tree_test.go1
714:6cognitive-complexity
tree_test.go:714:6
func TestTreeFindCaseInsensitivePath(t *testing.T) { tree := &node{}binding/form_mapping_test.go1
991:12discarded-error-result
binding/form_mapping_test.go:991:12
func TestMappingCustomArrayOfArrayUnmarshalTextDefault(t *testing.T) { id1, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80e`) id2, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80f`)context_test.go1
1160:1doc-comment-period
context_test.go:1160:1
// Tests that the response is serialized as JSONP// and Content-Type is set to application/javascriptbinding/binding.go1
82:2exported-declaration-comment
binding/binding.go:82:2
FormPost Binding = formPostBinding{} FormMultipart Binding = formMultipartBinding{} ProtoBuf BindingBody = protobufBinding{}fs_test.go1
1:1format
fs_test.go:1:1
package gin- Fix (safe): run `strider fmt fs_test.go`
gin.go1
751:4modifies-parameter
gin.go:751:4
if len(allowed) > 0 { c.handlers = engine.allNoMethod c.writermem.Header().Set("Allow", strings.Join(allowed, ", "))binding/form_mapping_test.go1
53:18nested-structs
binding/form_mapping_test.go:53:18
{"zero value", struct{ F float32 }{}, "", float32(0)}, {"file value", struct{ F *multipart.FileHeader }{}, "", &multipart.FileHeader{}}, } {tree_test.go1
368:2no-naked-return
tree_test.go:368:2
testFunc() return}binding/form_mapping.go1
26:2no-package-var
binding/form_mapping.go:26:2
// ErrConvertMapStringSlice can not convert to map[string][]string ErrConvertMapStringSlice = errors.New("can not convert to map slices of strings")tree.go1
726:11optimize-operands-order
tree.go:726:11
n = n.children[i] if (len(n.path) == 1 && n.handlers != nil) || (n.nType == catchAll && n.children[0].handlers != nil) {ginS/gins.go1
5:9package-comments
ginS/gins.go:5:9
package ginScontext_test.go1
393:4redundant-conversion
context_test.go:393:4
{int32(1)}, {int64(1)}, {uint(1)},tree.go1
486:5single-case-switch
tree.go:486:5
switch n.nType { case param:binding/binding_test.go1
371:6test-parallelism
binding/binding_test.go:371:6
func TestBindingFormStringMap(t *testing.T) { testBodyBindingStringMap(t, Form,render/protobuf.go1
18:1top-level-declaration-order
render/protobuf.go:18:1
var protobufContentType = []string{"application/x-protobuf"}codec/json/json.go1
35:7unused-receiver
codec/json/json.go:35:7
func (j jsonApi) NewEncoder(writer io.Writer) Encoder { return json.NewEncoder(writer)binding/binding_test.go1
896:18add-constant
binding/binding_test.go:896:18
b := Form assert.Equal(t, "form", b.Name())tree_test.go1
1022:6cognitive-complexity
tree_test.go:1022:6
func TestTreeFindCaseInsensitivePathWithMultipleChildrenAndWildcard(t *testing.T) { tree := &node{}binding/form_mapping_test.go1
992:12discarded-error-result
binding/form_mapping_test.go:992:12
id1, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80e`) id2, _ := convertToOidUnmarshalText(`664a062ac74a8ad104e0e80f`)context_test.go1
1174:1doc-comment-period
context_test.go:1174:1
// Tests that the response is serialized as JSONP// and Content-Type is set to application/jsonbinding/binding.go1
83:2exported-declaration-comment
binding/binding.go:83:2
FormMultipart Binding = formMultipartBinding{} ProtoBuf BindingBody = protobufBinding{} MsgPack BindingBody = msgpackBinding{}gin.go2
1:1format
gin.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt gin.go`
758:2modifies-parameter
gin.go:758:2
c.handlers = engine.allNoRoute serveError(c, http.StatusNotFound, default404Body)binding/form_mapping_test.go1
72:8nested-structs
binding/form_mapping_test.go:72:8
func TestMappingDefault(t *testing.T) { var s struct { Str string `form:",default=defaultVal"`binding/form_mapping.go1
29:2no-package-var
binding/form_mapping.go:29:2
// ErrConvertToMapString can not convert to map[string]string ErrConvertToMapString = errors.New("can not convert to map of strings"))tree.go1
815:7optimize-operands-order
tree.go:815:7
// without a trailing slash if a leaf exists for that path if fixTrailingSlash && path == "/" && n.handlers != nil { return ciPathinternal/bytesconv/bytesconv.go1
5:9package-comments
internal/bytesconv/bytesconv.go:5:9
package bytesconvcontext_test.go1
394:4redundant-conversion
context_test.go:394:4
{int64(1)}, {uint(1)}, {float32(1)},tree.go1
688:2single-case-switch
tree.go:688:2
func shiftNRuneBytes(rb [4]byte, n int) [4]byte { switch n { case 0:binding/binding_test.go1
381:6test-parallelism
binding/binding_test.go:381:6
func TestBindingFormStringSliceMap(t *testing.T) { obj := make(map[string][]string)render/render.go1
17:1top-level-declaration-order
render/render.go:17:1
var ( _ Render = (*JSON)(nil)codec/json/json.go1
39:7unused-receiver
codec/json/json.go:39:7
func (j jsonApi) NewDecoder(reader io.Reader) Decoder { return json.NewDecoder(reader)binding/binding_test.go1
926:70add-constant
binding/binding_test.go:926:70
obj := FooBarStruct{} req, err := http.NewRequest(http.MethodPost, "/", strings.NewReader("foo=bar")) require.NoError(t, err)tree_test.go1
1066:6cognitive-complexity
tree_test.go:1066:6
func TestTreeFindCaseInsensitivePathWildcardParamAndStaticChild(t *testing.T) { tree := &node{}context.go1
718:2discarded-error-result
context.go:718:2
} f.Close() return fh, errcontext_test.go1
1188:1doc-comment-period
context_test.go:1188:1
// Tests that no JSON is rendered if code is 204func TestContextRenderNoContentJSON(t *testing.T) {binding/binding.go1
84:2exported-declaration-comment
binding/binding.go:84:2
ProtoBuf BindingBody = protobufBinding{} MsgPack BindingBody = msgpackBinding{} YAML BindingBody = yamlBinding{}ginS/gins_test.go1
1:1format
ginS/gins_test.go:1:1
// Copyright 2025 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt ginS/gins_test.go`
gin.go1
765:2modifies-parameter
gin.go:765:2
func serveError(c *Context, code int, defaultMessage []byte) { c.writermem.status = code c.Next()binding/form_mapping_test.go1
88:8nested-structs
binding/form_mapping_test.go:88:8
func TestMappingSkipField(t *testing.T) { var s struct { A intbinding/form_mapping.go1
44:5no-package-var
binding/form_mapping.go:44:5
var emptyField = reflect.StructField{}tree.go1
891:8optimize-operands-order
tree.go:891:8
end := 0 for end < len(path) && path[end] != '/' { end++internal/fs/fs.go1
1:9package-comments
internal/fs/fs.go:1:9
package fscontext_test.go1
395:4redundant-conversion
context_test.go:395:4
{uint(1)}, {float32(1)}, {key{}},tree.go1
887:3single-case-switch
tree.go:887:3
n = n.children[len(n.children)-1] switch n.nType { case param:binding/binding_test.go1
402:6test-parallelism
binding/binding_test.go:402:6
func TestBindingQuery(t *testing.T) { testQueryBinding(t, http.MethodPost,render/render_msgpack_test.go1
63:1top-level-declaration-order
render/render_msgpack_test.go:63:1
type failWriter struct { *httptest.ResponseRecordercodec/json/jsoniter.go1
26:7unused-receiver
codec/json/jsoniter.go:26:7
func (j jsoniterApi) Marshal(v any) ([]byte, error) { return json.Marshal(v)binding/binding_test.go1
947:18add-constant
binding/binding_test.go:947:18
b := FormMultipart assert.Equal(t, "multipart/form-data", b.Name())context.go1
824:3discarded-error-result
context.go:824:3
if err := c.ShouldBindUri(obj); err != nil { c.AbortWithError(http.StatusBadRequest, err).SetType(ErrorTypeBind) //nolint: errcheck return errcontext_test.go1
1200:1doc-comment-period
context_test.go:1200:1
// Tests that the response is serialized as JSON// we change the content-type beforebinding/binding.go1
85:2exported-declaration-comment
binding/binding.go:85:2
MsgPack BindingBody = msgpackBinding{} YAML BindingBody = yamlBinding{} Uri BindingUri = uriBinding{}gin_integration_test.go1
1:1format
gin_integration_test.go:1:1
// Copyright 2017 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt gin_integration_test.go`
gin.go1
771:3modifies-parameter
gin.go:771:3
if c.writermem.Status() == code { c.writermem.Header()["Content-Type"] = mimePlain _, err := c.Writer.Write(defaultMessage)binding/form_mapping_test.go1
98:8nested-structs
binding/form_mapping_test.go:98:8
func TestMappingIgnoreField(t *testing.T) { var s struct { A int `form:"A"`binding/form_mapping_benchmark_test.go1
14:5no-package-var
binding/form_mapping_benchmark_test.go:14:5
var form = map[string][]string{ "name": {"mike"},tree.go1
944:6optimize-operands-order
tree.go:944:6
} if len(path)+1 == npLen && n.path[len(path)] == '/' && strings.EqualFold(path[1:], n.path[1:len(path)]) && n.handlers != nil {logger.go1
5:9package-comments
logger.go:5:9
package gincontext_test.go1
423:17redundant-conversion
context_test.go:423:17
c.Set("string", "this is a string") c.Set("int32", int32(-42)) c.Set("int64", int64(42424242424242))utils.go1
148:2single-case-switch
utils.go:148:2
func resolveAddress(addr []string) string { switch len(addr) { case 0:binding/binding_test.go1
408:6test-parallelism
binding/binding_test.go:408:6
func TestBindingQuery2(t *testing.T) { testQueryBinding(t, http.MethodGet,render/render_test.go1
139:1top-level-declaration-order
render/render_test.go:139:1
type errorWriter struct { bufString stringcodec/json/jsoniter.go1
30:7unused-receiver
codec/json/jsoniter.go:30:7
func (j jsoniterApi) Unmarshal(data []byte, v any) error { return json.Unmarshal(data, v)binding/binding_test.go1
1115:7add-constant
binding/binding_test.go:1115:7
switch typ { case "Slice": obj := FooStructForSliceType{}context.go1
843:4discarded-error-result
context.go:843:4
case errors.As(err, &maxBytesErr): c.AbortWithError(http.StatusRequestEntityTooLarge, err).SetType(ErrorTypeBind) //nolint: errcheck default:context_test.go1
1214:1doc-comment-period
context_test.go:1214:1
// Tests that no Custom JSON is rendered if code is 204func TestContextRenderNoContentAPIJSON(t *testing.T) {binding/binding.go1
86:2exported-declaration-comment
binding/binding.go:86:2
YAML BindingBody = yamlBinding{} Uri BindingUri = uriBinding{} Header Binding = headerBinding{}gin_test.go1
1:1format
gin_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt gin_test.go`
mode.go1
61:4modifies-parameter
mode.go:61:4
if flag.Lookup("test.v") != nil { value = TestMode } else {binding/form_mapping_test.go1
110:8nested-structs
binding/form_mapping_test.go:110:8
func TestMappingUnexportedField(t *testing.T) { var s struct { A int `form:"a"`binding/json.go1
19:5no-package-var
binding/json.go:19:5
// any as a Number instead of as a float64.var EnableDecoderUseNumber = falsetree.go1
944:6optimize-operands-order
tree.go:944:6
} if len(path)+1 == npLen && n.path[len(path)] == '/' && strings.EqualFold(path[1:], n.path[1:len(path)]) && n.handlers != nil {mode.go1
5:9package-comments
mode.go:5:9
package gincontext_test.go1
424:17redundant-conversion
context_test.go:424:17
c.Set("int32", int32(-42)) c.Set("int64", int64(42424242424242)) c.Set("uint64", uint64(42))binding/binding_test.go1
414:6test-parallelism
binding/binding_test.go:414:6
func TestBindingQueryFail(t *testing.T) { testQueryBindingFail(t, http.MethodPost,render/text.go1
20:1top-level-declaration-order
render/text.go:20:1
var plainContentType = []string{"text/plain; charset=utf-8"}codec/json/jsoniter.go1
34:7unused-receiver
codec/json/jsoniter.go:34:7
func (j jsoniterApi) MarshalIndent(v any, prefix, indent string) ([]byte, error) { return json.MarshalIndent(v, prefix, indent)binding/binding_test.go1
1125:7add-constant
binding/binding_test.go:1125:7
require.Error(t, err) case "Struct": obj := FooStructForStructType{}context.go1
845:4discarded-error-result
context.go:845:4
default: c.AbortWithError(http.StatusBadRequest, err).SetType(ErrorTypeBind) //nolint: errcheck }context_test.go1
1227:1doc-comment-period
context_test.go:1227:1
// Tests that the response is serialized as JSON// and Content-Type is set to application/jsonbinding/binding.go1
87:2exported-declaration-comment
binding/binding.go:87:2
Uri BindingUri = uriBinding{} Header Binding = headerBinding{} Plain BindingBody = plainBinding{}githubapi_test.go1
1:1format
githubapi_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt githubapi_test.go`
mode.go1
63:4modifies-parameter
mode.go:63:4
} else { value = DebugMode }binding/form_mapping_test.go1
122:8nested-structs
binding/form_mapping_test.go:122:8
func TestMappingPrivateField(t *testing.T) { var s struct { f int `form:"field"`binding/json.go1
25:5no-package-var
binding/json.go:25:5
// keys which do not match any non-ignored, exported fields in the destination.var EnableDecoderDisallowUnknownFields = falsepath.go1
6:9package-comments
path.go:6:9
package gincontext_test.go1
425:18redundant-conversion
context_test.go:425:18
c.Set("int64", int64(42424242424242)) c.Set("uint64", uint64(42)) c.Set("float32", float32(4.2))binding/binding_test.go1
420:6test-parallelism
binding/binding_test.go:420:6
func TestBindingQueryFail2(t *testing.T) { testQueryBindingFail(t, http.MethodGet,render/toml.go1
18:1top-level-declaration-order
render/toml.go:18:1
var tomlContentType = []string{"application/toml; charset=utf-8"}codec/json/jsoniter.go1
38:7unused-receiver
codec/json/jsoniter.go:38:7
func (j jsoniterApi) NewEncoder(writer io.Writer) Encoder { return json.NewEncoder(writer)binding/binding_test.go1
1134:7add-constant
binding/binding_test.go:1134:7
obj.StructFoo) case "StructPointer": obj := FooStructForStructPointerType{}context.go1
1197:12discarded-error-result
context.go:1197:12
} val, _ := url.QueryUnescape(cookie.Value) return val, nilcontext_test.go1
1240:1doc-comment-period
context_test.go:1240:1
// Tests that no Custom JSON is rendered if code is 204func TestContextRenderNoContentIndentedJSON(t *testing.T) {binding/binding.go1
88:2exported-declaration-comment
binding/binding.go:88:2
Header Binding = headerBinding{} Plain BindingBody = plainBinding{} TOML BindingBody = tomlBinding{}internal/bytesconv/bytesconv.go1
1:1format
internal/bytesconv/bytesconv.go:1:1
// Copyright 2023 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt internal/bytesconv/bytesconv.go`
path.go1
142:4modifies-parameter
path.go:142:4
if length > cap(b) { *buf = make([]byte, length) } else {binding/form_mapping_test.go1
131:8nested-structs
binding/form_mapping_test.go:131:8
func TestMappingUnknownFieldType(t *testing.T) { var s struct { U uintptrbinding/json_test.go1
72:5no-package-var
binding/json_test.go:72:5
var customConfig = jsoniter.Config{ EscapeHTML: true,recovery.go1
5:9package-comments
recovery.go:5:9
package gincontext_test.go1
426:19redundant-conversion
context_test.go:426:19
c.Set("uint64", uint64(42)) c.Set("float32", float32(4.2)) c.Set("float64", 4.2)binding/binding_test.go1
426:6test-parallelism
binding/binding_test.go:426:6
func TestBindingQueryBoolFail(t *testing.T) { testQueryBindingBoolFail(t, http.MethodGet,render/xml.go1
17:1top-level-declaration-order
render/xml.go:17:1
var xmlContentType = []string{"application/xml; charset=utf-8"}codec/json/jsoniter.go1
42:7unused-receiver
codec/json/jsoniter.go:42:7
func (j jsoniterApi) NewDecoder(reader io.Reader) Decoder { return json.NewDecoder(reader)binding/binding_test.go1
1148:7add-constant
binding/binding_test.go:1148:7
assert.InDelta(t, float64(123), obj.MapFoo["bar"].(float64), 0.01) case "SliceMap": obj := FooStructForSliceMapType{}context.go1
1213:7discarded-error-result
context.go:1213:7
// Pushing error to c.Errors _ = c.Error(err) c.Abort()context_test.go1
1283:1doc-comment-period
context_test.go:1283:1
// Tests that the response is serialized as Secure JSON// and Content-Type is set to application/jsonbinding/binding.go1
89:2exported-declaration-comment
binding/binding.go:89:2
Plain BindingBody = plainBinding{} TOML BindingBody = tomlBinding{} BSON BindingBody = bsonBinding{}internal/bytesconv/bytesconv_test.go1
1:1format
internal/bytesconv/bytesconv_test.go:1:1
// Copyright 2020 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt internal/bytesconv/bytesconv_test.go`
path.go1
144:4modifies-parameter
path.go:144:4
} else { *buf = (*buf)[:length] }binding/form_mapping_test.go1
141:8nested-structs
binding/form_mapping_test.go:141:8
func TestMappingURI(t *testing.T) { var s struct { F int `uri:"field"`binding/json_test.go1
108:2no-package-var
binding/json_test.go:108:2
var ( zeroTime = time.Time{} timeType = reflect2.TypeOfPtr((*time.Time)(nil)).Elem()render/bson.go1
5:9package-comments
render/bson.go:5:9
package rendercontext_test.go1
432:20redundant-conversion
context_test.go:432:20
assert.Exactly(t, "this is a string", c.MustGet("string").(string)) assert.Exactly(t, int32(-42), c.MustGet("int32").(int32)) assert.Exactly(t, int64(42424242424242), c.MustGet("int64").(int64))binding/binding_test.go1
432:6test-parallelism
binding/binding_test.go:432:6
func TestBindingQueryStringMap(t *testing.T) { b := Queryrender/yaml.go1
18:1top-level-declaration-order
render/yaml.go:18:1
var yamlContentType = []string{"application/yaml; charset=utf-8"}codec/json/sonic.go1
26:7unused-receiver
codec/json/sonic.go:26:7
func (j sonicApi) Marshal(v any) ([]byte, error) { return json.Marshal(v)binding/binding_test.go1
1152:7add-constant
binding/binding_test.go:1152:7
require.Error(t, err) case "Ptr": obj := FooStructForStringPtrType{}context.go1
1445:3discarded-error-result
context.go:1445:3
default: c.AbortWithError(http.StatusNotAcceptable, errors.New("the accepted formats are not offered by the server")) //nolint: errcheck }context_test.go1
1297:1doc-comment-period
context_test.go:1297:1
// Tests that no Custom JSON is rendered if code is 204func TestContextRenderNoContentSecureJSON(t *testing.T) {binding/binding.go1
90:2exported-declaration-comment
binding/binding.go:90:2
TOML BindingBody = tomlBinding{} BSON BindingBody = bsonBinding{})internal/fs/fs_test.go1
1:1format
internal/fs/fs_test.go:1:1
package fs- Fix (safe): run `strider fmt internal/fs/fs_test.go`
render/render_test.go1
288:2modifies-parameter
render/render_test.go:288:2
func (h xmlmap) MarshalXML(e *xml.Encoder, start xml.StartElement) error { start.Name = xml.Name{ Space: "",binding/form_mapping_test.go1
150:8nested-structs
binding/form_mapping_test.go:150:8
func TestMappingForm(t *testing.T) { var s struct { F int `form:"field"`binding/json_test.go1
109:2no-package-var
binding/json_test.go:109:2
zeroTime = time.Time{} timeType = reflect2.TypeOfPtr((*time.Time)(nil)).Elem() defaultTimeCodec = &timeCodec{}render/data.go1
5:9package-comments
render/data.go:5:9
package rendercontext_test.go1
433:20redundant-conversion
context_test.go:433:20
assert.Exactly(t, int32(-42), c.MustGet("int32").(int32)) assert.Exactly(t, int64(42424242424242), c.MustGet("int64").(int64)) assert.Exactly(t, uint64(42), c.MustGet("uint64").(uint64))binding/binding_test.go1
454:6test-parallelism
binding/binding_test.go:454:6
func TestBindingXML(t *testing.T) { testBodyBinding(t,response_writer.go1
55:1top-level-declaration-order
response_writer.go:55:1
var _ ResponseWriter = (*responseWriter)(nil)codec/json/sonic.go1
30:7unused-receiver
codec/json/sonic.go:30:7
func (j sonicApi) Unmarshal(data []byte, v any) error { return json.Unmarshal(data, v)binding/binding_test.go1
1206:18add-constant
binding/binding_test.go:1206:18
b := Query assert.Equal(t, "query", b.Name())context_test.go2
160:2discarded-error-result
context_test.go:160:2
require.NoError(t, err) mw.Close() c, _ := CreateTestContext(httptest.NewRecorder())1320:1doc-comment-period
context_test.go:1320:1
// Tests that the response is serialized as JSON// and Content-Type is set to application/jsonbinding/binding.go1
95:6exported-declaration-comment
binding/binding.go:95:6
// and the content type.func Default(method, contentType string) Binding { if method == http.MethodGet {logger.go1
1:1format
logger.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt logger.go`
routergroup.go1
88:2modifies-parameter
routergroup.go:88:2
absolutePath := group.calculateAbsolutePath(relativePath) handlers = group.combineHandlers(handlers) group.engine.addRoute(httpMethod, absolutePath, handlers)binding/form_mapping_test.go1
159:8nested-structs
binding/form_mapping_test.go:159:8
func TestMappingFormFieldNotSent(t *testing.T) { var s struct { F string `form:"field,default=defVal"`binding/json_test.go1
110:2no-package-var
binding/json_test.go:110:2
timeType = reflect2.TypeOfPtr((*time.Time)(nil)).Elem() defaultTimeCodec = &timeCodec{})render/html.go1
5:9package-comments
render/html.go:5:9
package rendercontext_test.go1
434:20redundant-conversion
context_test.go:434:20
assert.Exactly(t, int64(42424242424242), c.MustGet("int64").(int64)) assert.Exactly(t, uint64(42), c.MustGet("uint64").(uint64)) assert.InDelta(t, float32(4.2), c.MustGet("float32").(float32), 0.01)binding/binding_test.go1
461:6test-parallelism
binding/binding_test.go:461:6
func TestBindingXMLFail(t *testing.T) { testBodyBindingFail(t,response_writer_test.go1
38:1top-level-declaration-order
response_writer_test.go:38:1
// nonFlusherWriter is a minimal http.ResponseWriter that does NOT implement http.Flusher.type nonFlusherWriter struct { header http.Headercodec/json/sonic.go1
34:7unused-receiver
codec/json/sonic.go:34:7
func (j sonicApi) MarshalIndent(v any, prefix, indent string) ([]byte, error) { return json.MarshalIndent(v, prefix, indent)binding/binding_test.go1
1351:18add-constant
binding/binding_test.go:1351:18
require.NoError(t, err) assert.Equal(t, "yes", *obj.Label)context_test.go2
162:17discarded-error-result
context_test.go:162:17
c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest(http.MethodPost, "/", buf) c.Request.Header.Set("Content-Type", mw.FormDataContentType())1332:1doc-comment-period
context_test.go:1332:1
// Tests that the response executes the templates// and responds with Content-Type set to text/htmlbinding/binding_nomsgpack.go1
13:2exported-declaration-comment
binding/binding_nomsgpack.go:13:2
const ( MIMEJSON = "application/json" MIMEHTML = "text/html"logger_test.go1
1:1format
logger_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt logger_test.go`
tree.go1
179:4modifies-parameter
tree.go:179:4
if i < len(path) { path = path[i:] c := path[0]binding/form_mapping_test.go1
168:8nested-structs
binding/form_mapping_test.go:168:8
func TestMappingFormWithEmptyToDefault(t *testing.T) { var s struct { F string `form:"field,default=DefVal"`binding/json_test.go1
165:2no-package-var
binding/json_test.go:165:2
var ( timePointerType = reflect2.TypeOfPtr((**time.Time)(nil)).Elem() defaultTimePointerCodec = &timePointerCodec{}render/json.go1
5:9package-comments
render/json.go:5:9
package rendercontext_test.go1
435:20redundant-conversion
context_test.go:435:20
assert.Exactly(t, uint64(42), c.MustGet("uint64").(uint64)) assert.InDelta(t, float32(4.2), c.MustGet("float32").(float32), 0.01) assert.InDelta(t, 4.2, c.MustGet("float64").(float64), 0.01)binding/binding_test.go1
468:6test-parallelism
binding/binding_test.go:468:6
func TestBindingTOML(t *testing.T) { testBodyBinding(t,routergroup.go1
62:1top-level-declaration-order
routergroup.go:62:1
var _ IRouter = (*RouterGroup)(nil)codec/json/sonic.go1
38:7unused-receiver
codec/json/sonic.go:38:7
func (j sonicApi) NewEncoder(writer io.Writer) Encoder { return json.NewEncoder(writer)binding/default_validator_test.go1
68:72add-constant
binding/default_validator_test.go:68:72
{"validate *struct failed-1", &defaultValidator{}, &exampleStruct{A: "123456789", B: 1}, true}, {"validate *struct failed-2", &defaultValidator{}, &exampleStruct{A: "12345678", B: 0}, true}, {"validate *struct passed", &defaultValidator{}, &exampleStruct{A: "12345678", B: 1}, false},context_test.go2
174:2discarded-error-result
context_test.go:174:2
mw := multipart.NewWriter(buf) mw.Close() c, _ := CreateTestContext(httptest.NewRecorder())1372:1doc-comment-period
context_test.go:1372:1
// Tests that no HTML is rendered if code is 204func TestContextRenderNoContentHTML(t *testing.T) {binding/binding_nomsgpack.go1
14:2exported-declaration-comment
binding/binding_nomsgpack.go:14:2
MIMEJSON = "application/json" MIMEHTML = "text/html" MIMEXML = "application/xml"middleware_test.go1
1:1format
middleware_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt middleware_test.go`
tree.go1
311:5modifies-parameter
tree.go:311:5
n.path = path[:i] path = path[i:] }binding/form_mapping_test.go1
177:8nested-structs
binding/form_mapping_test.go:177:8
func TestMapFormWithTag(t *testing.T) { var s struct { F int `externalTag:"field"`binding/json_test.go1
166:2no-package-var
binding/json_test.go:166:2
timePointerType = reflect2.TypeOfPtr((**time.Time)(nil)).Elem() defaultTimePointerCodec = &timePointerCodec{})render/msgpack.go1
7:9package-comments
render/msgpack.go:7:9
package rendercontext_test.go1
474:11redundant-conversion
context_test.go:474:11
key := "int8" value := int8(0x7F) c.Set(key, value)binding/binding_test.go1
475:6test-parallelism
binding/binding_test.go:475:6
func TestBindingTOMLFail(t *testing.T) { testBodyBindingFail(t,tree.go1
45:1top-level-declaration-order
tree.go:45:1
type methodTree struct { method stringcodec/json/sonic.go1
42:7unused-receiver
codec/json/sonic.go:42:7
func (j sonicApi) NewDecoder(reader io.Reader) Decoder { return json.NewDecoder(reader)binding/default_validator_test.go1
70:75add-constant
binding/default_validator_test.go:70:75
{"validate *struct passed", &defaultValidator{}, &exampleStruct{A: "12345678", B: 1}, false}, {"validate []struct failed-1", &defaultValidator{}, []exampleStruct{{A: "123456789", B: 1}}, true}, {"validate []struct failed-2", &defaultValidator{}, []exampleStruct{{A: "12345678", B: 0}}, true},context_test.go2
176:17discarded-error-result
context_test.go:176:17
c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest(http.MethodPost, "/", nil) c.Request.Header.Set("Content-Type", mw.FormDataContentType())1386:1doc-comment-period
context_test.go:1386:1
// TestContextRenderXML tests that the response is serialized as XML// and Content-Type is set to application/xmlbinding/binding_nomsgpack.go1
15:2exported-declaration-comment
binding/binding_nomsgpack.go:15:2
MIMEHTML = "text/html" MIMEXML = "application/xml" MIMEXML2 = "text/xml"mode_test.go1
1:1format
mode_test.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt mode_test.go`
tree.go1
327:5modifies-parameter
tree.go:327:5
if len(wildcard) < len(path) { path = path[len(wildcard):]binding/form_mapping_test.go1
186:8nested-structs
binding/form_mapping_test.go:186:8
func TestMappingTime(t *testing.T) { var s struct { Time time.Timebinding/multipart_form_mapping.go1
20:2no-package-var
binding/multipart_form_mapping.go:20:2
// ErrMultiFileHeader multipart.FileHeader invalid ErrMultiFileHeader = errors.New("unsupported field type for multipart.FileHeader")render/pdf.go1
5:9package-comments
render/pdf.go:5:9
package rendercontext_test.go1
482:11redundant-conversion
context_test.go:482:11
key := "int16" value := int16(0x7FFF) c.Set(key, value)binding/binding_test.go1
482:6test-parallelism
binding/binding_test.go:482:6
func TestBindingYAML(t *testing.T) { testBodyBinding(t,tree_test.go1
24:1top-level-declaration-order
tree_test.go:24:1
type testRequests []struct { path stringcontext.go1
734:7unused-receiver
context.go:734:7
// modified.func (c *Context) SaveUploadedFile(file *multipart.FileHeader, dst string, perm ...fs.FileMode) error { src, err := file.Open()binding/form_mapping.go1
171:55add-constant
binding/form_mapping.go:171:55
if cfTag == "" || cfTag == "multi" || cfTag == "csv" { setOpt.defaultValue = strings.ReplaceAll(v, ";", ",") }context_test.go2
192:2discarded-error-result
context_test.go:192:2
require.NoError(t, err) mw.Close() c, _ := CreateTestContext(httptest.NewRecorder())1399:1doc-comment-period
context_test.go:1399:1
// Tests that no XML is rendered if code is 204func TestContextRenderNoContentXML(t *testing.T) {binding/binding_nomsgpack.go1
16:2exported-declaration-comment
binding/binding_nomsgpack.go:16:2
MIMEXML = "application/xml" MIMEXML2 = "text/xml" MIMEPlain = "text/plain"path_test.go1
1:1format
path_test.go:1:1
// Copyright 2013 Julien Schmidt. All rights reserved.// Based on the path package, Copyright 2009 The Go Authors.- Fix (safe): run `strider fmt path_test.go`
tree.go1
426:5modifies-parameter
tree.go:426:5
if path[:len(prefix)] == prefix { path = path[len(prefix):]binding/form_mapping_test.go1
216:15nested-structs
binding/form_mapping_test.go:216:15
// wrong location var wrongLoc struct { Time time.Time `time_location:"wrong"`binding/multipart_form_mapping.go1
23:2no-package-var
binding/multipart_form_mapping.go:23:2
// ErrMultiFileHeaderLenInvalid array for []*multipart.FileHeader len invalid ErrMultiFileHeaderLenInvalid = errors.New("unsupported len of array for []*multipart.FileHeader"))render/protobuf.go1
5:9package-comments
render/protobuf.go:5:9
package rendercontext_test.go1
490:11redundant-conversion
context_test.go:490:11
key := "int32" value := int32(0x7FFFFFFF) c.Set(key, value)binding/binding_test.go1
489:6test-parallelism
binding/binding_test.go:489:6
func TestBindingYAMLStringMap(t *testing.T) { // YAML is a superset of JSON, so the test below is JSON (to avoid newlines)utils.go1
61:1top-level-declaration-order
utils.go:61:1
// H is a shortcut for map[string]anytype H map[string]anyfs.go1
33:7unused-receiver
fs.go:33:7
// Readdir overrides the http.File default implementation and always returns nil.func (n neutralizedReaddirFile) Readdir(_ int) ([]os.FileInfo, error) { // this disables directory listingbinding/form_mapping.go1
260:27add-constant
binding/form_mapping.go:260:27
// pre-process the default value for multi if present cfTag := field.Tag.Get("collection_format") if cfTag == "" || cfTag == "multi" {context_test.go2
194:17discarded-error-result
context_test.go:194:17
c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest(http.MethodPost, "/", buf) c.Request.Header.Set("Content-Type", mw.FormDataContentType())1411:1doc-comment-period
context_test.go:1411:1
// TestContextRenderPDF tests that the response is serialized as PDF// and Content-Type is set to application/pdfbinding/binding_nomsgpack.go1
17:2exported-declaration-comment
binding/binding_nomsgpack.go:17:2
MIMEXML2 = "text/xml" MIMEPlain = "text/plain" MIMEPOSTForm = "application/x-www-form-urlencoded"recovery.go1
1:1format
recovery.go:1:1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.// Use of this source code is governed by a MIT style- Fix (safe): run `strider fmt recovery.go`
tree.go1
435:8modifies-parameter
tree.go:435:8
index := len(*skippedNodes) *skippedNodes = (*skippedNodes)[:index+1] (*skippedNodes)[index] = skippedNode{binding/form_mapping_test.go1
223:16nested-structs
binding/form_mapping_test.go:223:16
// wrong time value var wrongTime struct { Time time.Timecodec/json/api.go1
10:5no-package-var
codec/json/api.go:10:5
// API the json codec in use.var API Corerender/reader.go1
5:9package-comments
render/reader.go:5:9
package rendercontext_test.go1
497:17redundant-conversion
context_test.go:497:17
c, _ := CreateTestContext(httptest.NewRecorder()) c.Set("int64", int64(42424242424242)) assert.Equal(t, int64(42424242424242), c.GetInt64("int64"))binding/binding_test.go1
496:6test-parallelism
binding/binding_test.go:496:6
func TestBindingYAMLFail(t *testing.T) { testBodyBindingFail(t,utils_test.go1
29:1top-level-declaration-order
utils_test.go:29:1
type testStruct struct { T *testing.Tlogger.go1
157:7unused-receiver
logger.go:157:7
// ResetColor resets all escape attributes.func (p *LogFormatterParams) ResetColor() string { return resetbinding/form_mapping.go1
261:31add-constant
binding/form_mapping.go:261:31
cfTag := field.Tag.Get("collection_format") if cfTag == "" || cfTag == "multi" { vs = strings.Split(opt.defaultValue, ",")