diff options
author | 2022-09-19 14:53:43 +0200 | |
---|---|---|
committer | 2022-09-19 05:53:43 -0700 | |
commit | 257ca65a17f3f3b5cca3ef70650b77cd615572a6 (patch) | |
tree | 3795231aad90db56fc2b65e57eebcb723cfabdf4 /test | |
parent | 596a9f9e67dd9b01e15bc04a999460422fe65166 (diff) | |
download | coredns-257ca65a17f3f3b5cca3ef70650b77cd615572a6.tar.gz coredns-257ca65a17f3f3b5cca3ef70650b77cd615572a6.tar.zst coredns-257ca65a17f3f3b5cca3ef70650b77cd615572a6.zip |
GO linting bump and removal of deprecated linters (#5624)
* bump golangci-lint with support of go 1.19
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
* remove deprecated usage of varcheck, deadcode, and structcheck
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/presubmit_test.go | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/test/presubmit_test.go b/test/presubmit_test.go index 79f612732..a0b712e85 100644 --- a/test/presubmit_test.go +++ b/test/presubmit_test.go @@ -125,7 +125,7 @@ func (l logfmt) Visit(n ast.Node) ast.Visitor { if !ok { return l } - if id.Name != "t" { //t *testing.T + if id.Name != "t" { // t *testing.T return l } @@ -182,41 +182,6 @@ func TestImportTesting(t *testing.T) { } } -type hasImportTestingWalker struct { - Errors []error -} - -func (w *hasImportTestingWalker) walk(path string, info os.FileInfo, _ error) error { - // only for regular files, not starting with a . and those that are go files. - if !info.Mode().IsRegular() { - return nil - } - if strings.HasPrefix(path, "../.") { - return nil - } - if strings.Contains(path, "/vendor") { - return nil - } - if strings.HasSuffix(path, "_test.go") { - return nil - } - - if strings.HasSuffix(path, ".go") { - fs := token.NewFileSet() - f, err := parser.ParseFile(fs, path, nil, parser.AllErrors) - if err != nil { - return err - } - for _, im := range f.Imports { - if im.Path.Value == `"testing"` { - absPath, _ := filepath.Abs(path) - w.Errors = append(w.Errors, fmt.Errorf("file %q is importing %q", absPath, "testing")) - } - } - } - return nil -} - func TestImportOrdering(t *testing.T) { walker := testImportOrderingWalker{} err := filepath.Walk("..", walker.walk) |