mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-11 07:56:20 +00:00
chore: enable forcetypeassert linter, fix issues (#38804)
Enable [`forcetypeassert`](https://github.com/gostaticanalysis/forcetypeassert) linter to prevent unchecked type assertions. ~650 issues fixed, most fixes were clean, some use `setting.PanicInDevOrTesting`. The only behaviour changes are where code would previously send a 500 error or panic, a 4xx error is now emitted. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -174,8 +174,10 @@ func TestGlob(t *testing.T) {
|
||||
} {
|
||||
g, err := Compile(test.pattern, test.delimiters...)
|
||||
require.NoError(t, err)
|
||||
compiler, ok := g.(*globCompiler)
|
||||
require.True(t, ok)
|
||||
result := g.Match(test.match)
|
||||
assert.Equal(t, test.should, result, "pattern %q matching %q should be %v but got %v, compiled=%s", test.pattern, test.match, test.should, result, g.(*globCompiler).regexpPattern)
|
||||
assert.Equal(t, test.should, result, "pattern %q matching %q should be %v but got %v, compiled=%s", test.pattern, test.match, test.should, result, compiler.regexpPattern)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user