aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/golangci-lint.yml9
-rw-r--r--.golangci.yml4
-rw-r--r--coremain/run.go1
-rw-r--r--test/presubmit_test.go37
4 files changed, 7 insertions, 44 deletions
diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml
index 381993616..6b1a3ebf3 100644
--- a/.github/workflows/golangci-lint.yml
+++ b/.github/workflows/golangci-lint.yml
@@ -10,8 +10,7 @@ jobs:
with:
go-version: '1.19.0'
- uses: actions/checkout@v3
- # See https://github.com/golangci/golangci-lint-action/issues/442#issuecomment-1203786890
- - name: Install golangci-lint
- run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.3
- - name: Run golangci-lint
- run: golangci-lint run --version --verbose --out-format=github-actions
+ - name: golangci-lint
+ uses: golangci/golangci-lint-action@v3.2.0
+ with:
+ version: v1.49.0
diff --git a/.golangci.yml b/.golangci.yml
index 475ae82b9..ea8f22c17 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -3,11 +3,9 @@ run:
linters:
disable-all: true
enable:
- - deadcode
- govet
- ineffassign
- staticcheck
- - structcheck
- typecheck
- - varcheck
- whitespace
+ - unused
diff --git a/coremain/run.go b/coremain/run.go
index fa7657886..5a9d68988 100644
--- a/coremain/run.go
+++ b/coremain/run.go
@@ -170,6 +170,7 @@ var (
// Build information obtained with the help of -ldflags
var (
+ // nolint
appVersion = "(untracked dev build)" // inferred at startup
devBuild = true // inferred at startup
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)