diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a760e7ef0..edb1dc847 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -30,14 +30,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 - - name: Run golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 with: - version: latest - args: --timeout=30m + go-version: 1.23.x - name: Install Task - uses: arduino/setup-task@v1 + uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Check Go module tidiness and generated files @@ -52,6 +51,11 @@ jobs: echo "Run 'go mod tidy' or 'task generate' commit them" exit 1 fi + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v4 + with: + version: latest + args: --timeout=30m test: name: Test diff --git a/.golangci.yml b/.golangci.yml index 479ac8125..65a5ab089 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,6 +6,11 @@ linters-settings: ] nakedret: max-func-lines: 0 # Disallow any unnamed return statement + govet: + disable: + # printf: non-constant format string in call to fmt.Errorf (govet) + # showing up since golangci-lint version 1.60.1 + - printf linters: enable: diff --git a/gen.go b/gen.go index f353b8540..deaa7eae8 100644 --- a/gen.go +++ b/gen.go @@ -4,5 +4,5 @@ package main -//go:generate go install golang.org/x/tools/cmd/goimports@v0.1.10 -//go:generate go run github.com/derision-test/go-mockgen/cmd/go-mockgen@v1.3.3 +//go:generate go install golang.org/x/tools/cmd/goimports@v0.17.0 +//go:generate go run github.com/derision-test/go-mockgen/v2/cmd/go-mockgen@v2.0.1 diff --git a/internal/db/issue.go b/internal/db/issue.go index ef54e1728..53c8132de 100644 --- a/internal/db/issue.go +++ b/internal/db/issue.go @@ -361,7 +361,7 @@ func (issue *Issue) ClearLabels(doer *User) (err error) { err = issue.PullRequest.LoadIssue() if err != nil { log.Error("LoadIssue: %v", err) - return + return err } err = PrepareWebhooks(issue.Repo, HOOK_EVENT_PULL_REQUEST, &api.PullRequestPayload{ Action: api.HOOK_ISSUE_LABEL_CLEARED, diff --git a/internal/db/milestone.go b/internal/db/milestone.go index 0166a2da4..a6e74f517 100644 --- a/internal/db/milestone.go +++ b/internal/db/milestone.go @@ -357,7 +357,7 @@ func ChangeMilestoneAssign(doer *User, issue *Issue, oldMilestoneID int64) (err err = issue.PullRequest.LoadIssue() if err != nil { log.Error("LoadIssue: %v", err) - return + return err } err = PrepareWebhooks(issue.Repo, HOOK_EVENT_PULL_REQUEST, &api.PullRequestPayload{ Action: hookAction, diff --git a/internal/db/mocks_test.go b/internal/db/mocks_test.go index 491e1da2f..6ba677706 100644 --- a/internal/db/mocks_test.go +++ b/internal/db/mocks_test.go @@ -1,4 +1,4 @@ -// Code generated by go-mockgen 1.3.3; DO NOT EDIT. +// Code generated by go-mockgen 1.3.7; DO NOT EDIT. // // This file was generated by running `go-mockgen` at the root of this repository. // To add additional mocks to this or another package, add a new entry to the diff --git a/internal/route/lfs/mocks_test.go b/internal/route/lfs/mocks_test.go index 7ab968d31..e4f013a64 100644 --- a/internal/route/lfs/mocks_test.go +++ b/internal/route/lfs/mocks_test.go @@ -1,4 +1,4 @@ -// Code generated by go-mockgen 1.3.3; DO NOT EDIT. +// Code generated by go-mockgen 1.3.7; DO NOT EDIT. // // This file was generated by running `go-mockgen` at the root of this repository. // To add additional mocks to this or another package, add a new entry to the