mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-20 03:46:09 +08:00
chore(lint): add golangci-lint v2 and fix all lint issues (#803)
## Summary - Replace old `.golangci.yml` (v1 format) with v2 format, aligned with gitea's lint config - Add `lint-go`, `lint-go-fix`, and `lint` Makefile targets using golangci-lint v2.10.1 - Replace `make vet` with `make lint` in CI workflow (lint includes vet) - Fix all 35 lint issues: modernize (maps.Copy, range over int, any), perfsprint (errors.New), unparam (remove unused parameters), revive (var naming), staticcheck, forbidigo exclusion for cmd/ - Make `security-check` non-fatal (apply https://github.com/go-gitea/gitea/pull/36681) - Remove dead gocritic exclusion rules (commentFormatting, exitAfterDefer) - Remove dead linter exclusions and disabled checks (singleCaseSwitch, ST1003, QF1001, QF1006, QF1008, testifylint go-require/require-error, test file exclusions for dupl/errcheck/staticcheck/unparam) ## Test plan - [x] `golangci-lint run` passes - [x] `go build ./...` passes - [x] `go test ./...` passes --------- Co-authored-by: ChristopherHX <christopher.homberger@web.de> Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/803 Reviewed-by: ChristopherHX <christopherhx@noreply.gitea.com>
This commit is contained in:
@@ -307,7 +307,7 @@ func Test_yamlV4NodeRoundTrip(t *testing.T) {
|
||||
t.Run("unmarshal and re-marshal workflow", func(t *testing.T) {
|
||||
input := []byte("name: test\non: push\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - run: echo hello\n")
|
||||
|
||||
var wf map[string]interface{}
|
||||
var wf map[string]any
|
||||
err := yaml.Unmarshal(input, &wf)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, wf["name"], "test")
|
||||
@@ -315,7 +315,7 @@ func Test_yamlV4NodeRoundTrip(t *testing.T) {
|
||||
out, err := yaml.Marshal(wf)
|
||||
require.NoError(t, err)
|
||||
|
||||
var wf2 map[string]interface{}
|
||||
var wf2 map[string]any
|
||||
err = yaml.Unmarshal(out, &wf2)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, wf2["name"], "test")
|
||||
|
||||
Reference in New Issue
Block a user