From 4db7615b1096adc2371d3fc5082e15901dd1a34a Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sat, 7 Dec 2024 01:10:21 +0100 Subject: [PATCH 01/13] chore: replace golang.org/x/exp/maps by maps --- go.mod | 2 +- internal/cache/cache.go | 6 ++---- pkg/commands/run.go | 7 +++---- pkg/goanalysis/runner.go | 10 +++++----- pkg/golinters/gocritic/gocritic.go | 12 ++++------- pkg/golinters/gocritic/gocritic_test.go | 10 ++++------ pkg/golinters/thelper/thelper.go | 5 +++-- pkg/lint/lintersdb/manager.go | 23 +++++++++++----------- pkg/printers/checkstyle.go | 11 +++++------ pkg/printers/junitxml.go | 10 ++++------ pkg/result/processors/fixer.go | 5 ++--- pkg/result/processors/nolint_filter.go | 7 +++---- scripts/website/expand_templates/thanks.go | 10 ++++------ 13 files changed, 52 insertions(+), 66 deletions(-) diff --git a/go.mod b/go.mod index 5946a9c0f49f..82ac57916c97 100644 --- a/go.mod +++ b/go.mod @@ -126,7 +126,6 @@ require ( go-simpler.org/musttag v0.13.0 go-simpler.org/sloglint v0.9.0 go.uber.org/automaxprocs v1.6.0 - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 golang.org/x/mod v0.23.0 golang.org/x/sys v0.30.0 golang.org/x/tools v0.30.0 @@ -196,6 +195,7 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.24.0 // indirect + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect golang.org/x/sync v0.11.0 // indirect golang.org/x/text v0.21.0 // indirect diff --git a/internal/cache/cache.go b/internal/cache/cache.go index c249084e1c53..41eb5c82be78 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -6,12 +6,12 @@ import ( "encoding/hex" "errors" "fmt" + "maps" "runtime" "slices" "strings" "sync" - "golang.org/x/exp/maps" "golang.org/x/tools/go/packages" "github.com/golangci/golangci-lint/internal/go/cache" @@ -178,9 +178,7 @@ func (c *Cache) computePkgHash(pkg *packages.Package) (hashResults, error) { curSum := key.Sum() hashRes[HashModeNeedOnlySelf] = hex.EncodeToString(curSum[:]) - imps := maps.Values(pkg.Imports) - - slices.SortFunc(imps, func(a, b *packages.Package) int { + imps := slices.SortedFunc(maps.Values(pkg.Imports), func(a, b *packages.Package) int { return strings.Compare(a.PkgPath, b.PkgPath) }) diff --git a/pkg/commands/run.go b/pkg/commands/run.go index f389fff6d30a..3aa467daef3f 100644 --- a/pkg/commands/run.go +++ b/pkg/commands/run.go @@ -8,12 +8,13 @@ import ( "fmt" "io" "log" + "maps" "os" "path/filepath" "runtime" "runtime/pprof" "runtime/trace" - "sort" + "slices" "strconv" "strings" "time" @@ -24,7 +25,6 @@ import ( "github.com/spf13/pflag" "github.com/spf13/viper" "go.uber.org/automaxprocs/maxprocs" - "golang.org/x/exp/maps" "gopkg.in/yaml.v3" "github.com/golangci/golangci-lint/internal/cache" @@ -452,8 +452,7 @@ func (c *runCommand) printStats(issues []result.Issue) { c.cmd.Printf("%d issues:\n", len(issues)) - keys := maps.Keys(stats) - sort.Strings(keys) + keys := slices.Sorted(maps.Keys(stats)) for _, key := range keys { c.cmd.Printf("* %s: %d\n", key, stats[key]) diff --git a/pkg/goanalysis/runner.go b/pkg/goanalysis/runner.go index 3a8652486cea..7cff0149a4c0 100644 --- a/pkg/goanalysis/runner.go +++ b/pkg/goanalysis/runner.go @@ -8,11 +8,11 @@ import ( "encoding/gob" "fmt" "go/token" + "maps" "runtime" - "sort" + "slices" "sync" - "golang.org/x/exp/maps" "golang.org/x/tools/go/analysis" "golang.org/x/tools/go/packages" @@ -159,8 +159,8 @@ func (r *runner) buildActionFactDeps(act *action, a *analysis.Analyzer, pkg *pac act.objectFacts = make(map[objectFactKey]analysis.Fact) act.packageFacts = make(map[packageFactKey]analysis.Fact) - paths := maps.Keys(pkg.Imports) - sort.Strings(paths) // for determinism + paths := slices.Sorted(maps.Keys(pkg.Imports)) // for determinism + for _, path := range paths { dep := r.makeAction(a, pkg.Imports[path], initialPkgs, actions, actAlloc) act.Deps = append(act.Deps, dep) @@ -209,7 +209,7 @@ func (r *runner) prepareAnalysis(pkgs []*packages.Package, } } - allActions = maps.Values(actions) + allActions = slices.Collect(maps.Values(actions)) debugf("Built %d actions", len(actions)) diff --git a/pkg/golinters/gocritic/gocritic.go b/pkg/golinters/gocritic/gocritic.go index 92641a9ea175..0fa4c63d1af1 100644 --- a/pkg/golinters/gocritic/gocritic.go +++ b/pkg/golinters/gocritic/gocritic.go @@ -5,17 +5,16 @@ import ( "fmt" "go/ast" "go/types" + "maps" "reflect" "runtime" "slices" - "sort" "strings" "sync" "github.com/go-critic/go-critic/checkers" gocriticlinter "github.com/go-critic/go-critic/linter" _ "github.com/quasilyte/go-ruleguard/dsl" - "golang.org/x/exp/maps" "golang.org/x/tools/go/analysis" "github.com/golangci/golangci-lint/pkg/config" @@ -168,8 +167,7 @@ func (w *goCriticWrapper) configureCheckerInfo( info.Name, k) } - supportedKeys := maps.Keys(info.Params) - sort.Strings(supportedKeys) + supportedKeys := slices.Sorted(maps.Keys(info.Params)) return fmt.Errorf("checker %s config param %s doesn't exist, all existing: %s", info.Name, k, supportedKeys) @@ -270,8 +268,7 @@ func newSettingsWrapper(settings *config.GoCriticSettings, logger logutils.Log) } } - allTagsSorted := maps.Keys(allChecksByTag) - sort.Strings(allTagsSorted) + allTagsSorted := slices.Sorted(maps.Keys(allChecksByTag)) return &settingsWrapper{ GoCriticSettings: settings, @@ -558,8 +555,7 @@ func debugChecksListf(checks []string, format string, args ...any) { return } - v := slices.Clone(checks) - slices.Sort(v) + v := slices.Sorted(slices.Values(checks)) debugf("%s checks (%d): %s", fmt.Sprintf(format, args...), len(checks), strings.Join(v, ", ")) } diff --git a/pkg/golinters/gocritic/gocritic_test.go b/pkg/golinters/gocritic/gocritic_test.go index ae6f3b01e9b9..ec9aae6421e2 100644 --- a/pkg/golinters/gocritic/gocritic_test.go +++ b/pkg/golinters/gocritic/gocritic_test.go @@ -1,6 +1,7 @@ package gocritic import ( + "maps" "slices" "strings" "testing" @@ -9,7 +10,6 @@ import ( gocriticlinter "github.com/go-critic/go-critic/linter" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/exp/maps" "github.com/golangci/golangci-lint/pkg/config" "github.com/golangci/golangci-lint/pkg/logutils" @@ -40,7 +40,7 @@ func Test_settingsWrapper_InferEnabledChecks(t *testing.T) { t.Logf("enabled by default checks:\n%s", strings.Join(enabledByDefaultChecks, "\n")) insert := func(in []string, toInsert ...string) []string { - return append(slices.Clone(in), toInsert...) + return slices.Concat(in, toInsert) } remove := func(in []string, toRemove ...string) []string { @@ -54,9 +54,7 @@ func Test_settingsWrapper_InferEnabledChecks(t *testing.T) { } uniq := func(in []string) []string { - result := slices.Clone(in) - slices.Sort(result) - return slices.Compact(result) + return slices.Compact(slices.Sorted(slices.Values(in))) } cases := []struct { @@ -269,7 +267,7 @@ func Test_settingsWrapper_InferEnabledChecks(t *testing.T) { wr := newSettingsWrapper(tt.sett, lg) wr.InferEnabledChecks() - assert.ElementsMatch(t, tt.expectedEnabledChecks, maps.Keys(wr.inferredEnabledChecks)) + assert.ElementsMatch(t, tt.expectedEnabledChecks, slices.Collect(maps.Keys(wr.inferredEnabledChecks))) assert.NoError(t, wr.Validate()) }) } diff --git a/pkg/golinters/thelper/thelper.go b/pkg/golinters/thelper/thelper.go index 102610a69a4f..04503b9ce0c1 100644 --- a/pkg/golinters/thelper/thelper.go +++ b/pkg/golinters/thelper/thelper.go @@ -1,10 +1,11 @@ package thelper import ( + "maps" + "slices" "strings" "github.com/kulti/thelper/pkg/analyzer" - "golang.org/x/exp/maps" "golang.org/x/tools/go/analysis" "github.com/golangci/golangci-lint/pkg/config" @@ -44,7 +45,7 @@ func New(settings *config.ThelperSettings) *goanalysis.Linter { internal.LinterLogger.Fatalf("thelper: at least one option must be enabled") } - args := maps.Keys(opts) + args := slices.Collect(maps.Keys(opts)) cfg := map[string]map[string]any{ a.Name: { diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index 75ab53d7cfbb..4fe57a3b4857 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -2,11 +2,11 @@ package lintersdb import ( "fmt" + "maps" "os" "slices" "sort" - - "golang.org/x/exp/maps" + "strings" "github.com/golangci/golangci-lint/pkg/config" "github.com/golangci/golangci-lint/pkg/goanalysis" @@ -109,24 +109,25 @@ func (m *Manager) GetOptimizedLinters() ([]*linter.Config, error) { m.combineGoAnalysisLinters(resultLintersSet) - resultLinters := maps.Values(resultLintersSet) - // Make order of execution of linters (go/analysis metalinter and unused) stable. - sort.Slice(resultLinters, func(i, j int) bool { - a, b := resultLinters[i], resultLinters[j] - + resultLinters := slices.SortedFunc(maps.Values(resultLintersSet), func(a *linter.Config, b *linter.Config) int { if b.Name() == linter.LastLinter { - return true + return -1 } if a.Name() == linter.LastLinter { - return false + return 1 } if a.DoesChangeTypes != b.DoesChangeTypes { - return b.DoesChangeTypes // move type-changing linters to the end to optimize speed + // move type-changing linters to the end to optimize speed + if b.DoesChangeTypes { + return -1 + } + return 1 } - return a.Name() < b.Name() + + return strings.Compare(a.Name(), b.Name()) }) return resultLinters, nil diff --git a/pkg/printers/checkstyle.go b/pkg/printers/checkstyle.go index 4dca4564be69..c31641d22d2f 100644 --- a/pkg/printers/checkstyle.go +++ b/pkg/printers/checkstyle.go @@ -4,10 +4,11 @@ import ( "encoding/xml" "fmt" "io" - "sort" + "maps" + "slices" + "strings" "github.com/go-xmlfmt/xmlfmt" - "golang.org/x/exp/maps" "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" @@ -70,10 +71,8 @@ func (p *Checkstyle) Print(issues []result.Issue) error { p.log.Infof("%v", err) } - out.Files = maps.Values(files) - - sort.Slice(out.Files, func(i, j int) bool { - return out.Files[i].Name < out.Files[j].Name + out.Files = slices.SortedFunc(maps.Values(files), func(a *checkstyleFile, b *checkstyleFile) int { + return strings.Compare(a.Name, b.Name) }) data, err := xml.Marshal(&out) diff --git a/pkg/printers/junitxml.go b/pkg/printers/junitxml.go index 0959fe18fb7d..587cef4e2ac0 100644 --- a/pkg/printers/junitxml.go +++ b/pkg/printers/junitxml.go @@ -4,11 +4,10 @@ import ( "encoding/xml" "fmt" "io" - "sort" + "maps" + "slices" "strings" - "golang.org/x/exp/maps" - "github.com/golangci/golangci-lint/pkg/result" ) @@ -60,10 +59,9 @@ func (p JUnitXML) Print(issues []result.Issue) error { } var res testSuitesXML - res.TestSuites = maps.Values(suites) - sort.Slice(res.TestSuites, func(i, j int) bool { - return res.TestSuites[i].Suite < res.TestSuites[j].Suite + res.TestSuites = slices.SortedFunc(maps.Values(suites), func(a testSuiteXML, b testSuiteXML) int { + return strings.Compare(a.Suite, b.Suite) }) enc := xml.NewEncoder(p.w) diff --git a/pkg/result/processors/fixer.go b/pkg/result/processors/fixer.go index c49630da8368..610f249ef547 100644 --- a/pkg/result/processors/fixer.go +++ b/pkg/result/processors/fixer.go @@ -9,11 +9,10 @@ package processors import ( "errors" "fmt" + "maps" "os" "slices" - "golang.org/x/exp/maps" - "github.com/golangci/golangci-lint/internal/x/tools/diff" "github.com/golangci/golangci-lint/pkg/config" "github.com/golangci/golangci-lint/pkg/fsutils" @@ -126,7 +125,7 @@ func (p Fixer) process(issues []result.Issue) ([]result.Issue, error) { for path, linterToEdits := range editsByLinter { excludedLinters := make(map[string]struct{}) - linters := maps.Keys(linterToEdits) + linters := slices.Collect(maps.Keys(linterToEdits)) // Does any linter create conflicting edits? for _, linter := range linters { diff --git a/pkg/result/processors/nolint_filter.go b/pkg/result/processors/nolint_filter.go index da9568050365..99cd799954c5 100644 --- a/pkg/result/processors/nolint_filter.go +++ b/pkg/result/processors/nolint_filter.go @@ -4,12 +4,12 @@ import ( "go/ast" "go/parser" "go/token" + "maps" "regexp" + "slices" "sort" "strings" - "golang.org/x/exp/maps" - "github.com/golangci/golangci-lint/pkg/golinters/nolintlint" "github.com/golangci/golangci-lint/pkg/lint/linter" "github.com/golangci/golangci-lint/pkg/lint/lintersdb" @@ -102,8 +102,7 @@ func (p *NolintFilter) Finish() { return } - unknownLinters := maps.Keys(p.unknownLintersSet) - sort.Strings(unknownLinters) + unknownLinters := slices.Sorted(maps.Keys(p.unknownLintersSet)) p.log.Warnf("Found unknown linters in //nolint directives: %s", strings.Join(unknownLinters, ", ")) } diff --git a/scripts/website/expand_templates/thanks.go b/scripts/website/expand_templates/thanks.go index 7d250b1b4465..8b52c480b02a 100644 --- a/scripts/website/expand_templates/thanks.go +++ b/scripts/website/expand_templates/thanks.go @@ -2,11 +2,10 @@ package main import ( "fmt" - "sort" + "maps" + "slices" "strings" - "golang.org/x/exp/maps" - "github.com/golangci/golangci-lint/pkg/config" "github.com/golangci/golangci-lint/pkg/lint/linter" "github.com/golangci/golangci-lint/pkg/lint/lintersdb" @@ -69,9 +68,8 @@ func getThanksList() string { } } - authors := maps.Keys(addedAuthors) - sort.Slice(authors, func(i, j int) bool { - return strings.ToLower(authors[i]) < strings.ToLower(authors[j]) + authors := slices.SortedFunc(maps.Keys(addedAuthors), func(a string, b string) int { + return strings.Compare(strings.ToLower(a), strings.ToLower(b)) }) lines := []string{ From c5ec324d4120de957e3b6274a625be7bbfc3d5b6 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sat, 7 Dec 2024 01:32:00 +0100 Subject: [PATCH 02/13] chore: remove unused function --- pkg/lint/linter/config.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/lint/linter/config.go b/pkg/lint/linter/config.go index 1e438a0f0368..20bed6a71168 100644 --- a/pkg/lint/linter/config.go +++ b/pkg/lint/linter/config.go @@ -167,10 +167,6 @@ func IsGoLowerThanGo122() func(cfg *config.Config) error { return isGoLowerThanGo("1.22") } -func IsGoLowerThanGo124() func(cfg *config.Config) error { - return isGoLowerThanGo("1.24") -} - func isGoLowerThanGo(v string) func(cfg *config.Config) error { return func(cfg *config.Config) error { if cfg == nil || config.IsGoGreaterThanOrEqual(cfg.Run.Go, v) { From 09939b2743096d7b81bbafca02933da432da0826 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sat, 7 Dec 2024 02:10:37 +0100 Subject: [PATCH 03/13] chore: update workflows --- .github/workflows/documentation.yml | 2 +- .github/workflows/post-release.yml | 2 +- .github/workflows/pr-documentation.yml | 2 +- .github/workflows/pr.yml | 8 +++++--- .github/workflows/tag.yml | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 00d7adf39799..5261ddbf22e7 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -16,7 +16,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.23' + GO_VERSION: '1.24.0-rc.1' NODE_VERSION: '20.x' CGO_ENABLED: 0 steps: diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 09f7a4d8a677..2155b6b03523 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -9,7 +9,7 @@ env: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: "1.23" + GO_VERSION: '1.24.0-rc.1' jobs: update-gha-assets: diff --git a/.github/workflows/pr-documentation.yml b/.github/workflows/pr-documentation.yml index 60a76668daea..9d3043d382af 100644 --- a/.github/workflows/pr-documentation.yml +++ b/.github/workflows/pr-documentation.yml @@ -13,7 +13,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.23' + GO_VERSION: '1.24.0-rc.1' NODE_VERSION: '20.x' CGO_ENABLED: 0 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6373252da560..8b443f817e28 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -11,7 +11,7 @@ env: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.23' + GO_VERSION: '1.24.0-rc.1' jobs: # Check if there is any dirty change for go mod tidy @@ -40,7 +40,9 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - go-version: ${{ env.GO_VERSION }} + # TODO(ldez) must be changed after the first release of golangci-lint with go1.24 + # go-version: ${{ env.GO_VERSION }} + go-version: '1.23' - name: lint uses: golangci/golangci-lint-action@v6.3.2 with: @@ -76,8 +78,8 @@ jobs: - ubuntu-latest - ubuntu-24.04-arm golang: - - '1.22' - '1.23' + - '1.24.0-rc.1' runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 7f6e4eacc7db..69ab2662c162 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -12,7 +12,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.23' + GO_VERSION: '1.24.0-rc.1' CHOCOLATEY_VERSION: 2.2.0 steps: # temporary workaround for an error in free disk space action From 2f57d3fa47f7d1bed847d407e0d79e969495ed17 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Fri, 13 Dec 2024 18:11:17 +0100 Subject: [PATCH 04/13] chore: update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 82ac57916c97..95b4e7b20b91 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/golangci/golangci-lint -go 1.22.1 +go 1.23.0 require ( 4d63.com/gocheckcompilerdirectives v1.2.1 From 660104623216c674a620bdc56f276b83c36fe82f Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Fri, 13 Dec 2024 18:24:42 +0100 Subject: [PATCH 05/13] fix: govet tests --- pkg/golinters/govet/testdata/govet.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/golinters/govet/testdata/govet.go b/pkg/golinters/govet/testdata/govet.go index 4830306735af..9c0526512f0e 100644 --- a/pkg/golinters/govet/testdata/govet.go +++ b/pkg/golinters/govet/testdata/govet.go @@ -9,7 +9,7 @@ import ( ) func GovetComposites() error { - return &os.PathError{"first", "path", os.ErrNotExist} // want "composites: io/fs\\.PathError struct literal uses unkeyed fields" + return &os.PathError{"first", "path", os.ErrNotExist} // want "composites: (os|io/fs)\\.PathError struct literal uses unkeyed fields" } func GovetShadow(f io.Reader, buf []byte) (err error) { From fcc279810bf36138de2089071bd4d3dd8c958589 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 18 Dec 2024 16:20:52 +0100 Subject: [PATCH 06/13] docs: add notes about tool command/directive --- docs/src/docs/welcome/install.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/docs/welcome/install.mdx b/docs/src/docs/welcome/install.mdx index 040bcdcbd8d4..9445c9e2a3bf 100644 --- a/docs/src/docs/welcome/install.mdx +++ b/docs/src/docs/welcome/install.mdx @@ -134,7 +134,7 @@ docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion ### Install from Sources -Such `go install`/`go get` or "tools pattern" installations aren't guaranteed to work. +Such `go install`/`go get`, "tools pattern", and `tool` command/directives installations aren't guaranteed to work. We recommend using binary installation. @@ -142,7 +142,7 @@ Those installations aren't recommended because of the following points: 1. Those installations are compiling golangci-lint locally, the Go version used to build will depend on your local Go version. 2. Some users use `-u` flag for `go get`, which upgrades our dependencies. Resulting binary was not tested and is not guaranteed to work. -3. When using "tools pattern", the dependencies of a tool can modify the dependencies of another. Resulting binary was not tested and is not guaranteed to work. +3. When using "tools pattern" or and `tool` command/directives, the dependencies of a tool can modify the dependencies of another or your project. Resulting binary was not tested and is not guaranteed to work. 4. We've encountered issues with Go modules hashes due to unexpected recreation of dependency tags. 5. `go.mod` replacement directives don't apply transitively. It means a user will be using patched version of `golangci-lint` if we use such replacements. 6. It allows installation from main branch which can't be considered stable. From e2a96fffdd6e9fc45fbee7c052a6094ed966f34d Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Thu, 16 Jan 2025 23:13:10 +0100 Subject: [PATCH 07/13] chore: update to go1.24rc2 --- .github/workflows/documentation.yml | 2 +- .github/workflows/post-release.yml | 2 +- .github/workflows/pr-documentation.yml | 2 +- .github/workflows/pr.yml | 4 ++-- .github/workflows/tag.yml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 5261ddbf22e7..112946d0c36f 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -16,7 +16,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.1' + GO_VERSION: '1.24.0-rc.2' NODE_VERSION: '20.x' CGO_ENABLED: 0 steps: diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 2155b6b03523..0f7cebda0260 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -9,7 +9,7 @@ env: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.1' + GO_VERSION: '1.24.0-rc.2' jobs: update-gha-assets: diff --git a/.github/workflows/pr-documentation.yml b/.github/workflows/pr-documentation.yml index 9d3043d382af..763d6b913bb5 100644 --- a/.github/workflows/pr-documentation.yml +++ b/.github/workflows/pr-documentation.yml @@ -13,7 +13,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.1' + GO_VERSION: '1.24.0-rc.2' NODE_VERSION: '20.x' CGO_ENABLED: 0 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8b443f817e28..c58002a384b3 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -11,7 +11,7 @@ env: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.1' + GO_VERSION: '1.24.0-rc.2' jobs: # Check if there is any dirty change for go mod tidy @@ -79,7 +79,7 @@ jobs: - ubuntu-24.04-arm golang: - '1.23' - - '1.24.0-rc.1' + - '1.24.0-rc.2' runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 69ab2662c162..04b392818dcb 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -12,7 +12,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.1' + GO_VERSION: '1.24.0-rc.2' CHOCOLATEY_VERSION: 2.2.0 steps: # temporary workaround for an error in free disk space action From 0384f273bf34e63bd36c5261a285c7b1d0a430ec Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Thu, 23 Jan 2025 00:23:03 +0100 Subject: [PATCH 08/13] feat: deprecation step 2 of exportloopref --- .golangci.next.reference.yml | 6 +- go.mod | 1 - go.sum | 2 - jsonschema/golangci.next.jsonschema.json | 1 - pkg/golinters/exportloopref/exportloopref.go | 19 ------ .../exportloopref_integration_test.go | 11 ---- .../exportloopref/testdata/exportloopref.go | 46 ------------- .../testdata/exportloopref_cgo.go | 65 ------------------- pkg/lint/lintersdb/builder_linter.go | 5 +- 9 files changed, 4 insertions(+), 152 deletions(-) delete mode 100644 pkg/golinters/exportloopref/exportloopref.go delete mode 100644 pkg/golinters/exportloopref/exportloopref_integration_test.go delete mode 100644 pkg/golinters/exportloopref/testdata/exportloopref.go delete mode 100644 pkg/golinters/exportloopref/testdata/exportloopref_cgo.go diff --git a/.golangci.next.reference.yml b/.golangci.next.reference.yml index 789308689c76..1912a5bd6500 100644 --- a/.golangci.next.reference.yml +++ b/.golangci.next.reference.yml @@ -31,10 +31,8 @@ linters: - errchkjson - errname - errorlint - - execinquery - exhaustive - exhaustruct - - exportloopref - exptostd - fatcontext - forbidigo @@ -149,10 +147,8 @@ linters: - errchkjson - errname - errorlint - - execinquery - exhaustive - exhaustruct - - exportloopref - exptostd - fatcontext - forbidigo @@ -241,7 +237,9 @@ linters: - wsl - zerologlint - deadcode # Deprecated + - execinquery # Deprecated - exhaustivestruct # Deprecated + - exportloopref # Deprecated - golint # Deprecated - gomnd # Deprecated - ifshort # Deprecated diff --git a/go.mod b/go.mod index 95b4e7b20b91..9d07e1d948b2 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,6 @@ require ( github.com/kkHAIKE/contextcheck v1.1.5 github.com/kulti/thelper v0.6.3 github.com/kunwardeep/paralleltest v1.0.10 - github.com/kyoh86/exportloopref v0.1.11 github.com/lasiar/canonicalheader v1.1.2 github.com/ldez/exptostd v0.4.1 github.com/ldez/gomoddirectives v0.6.1 diff --git a/go.sum b/go.sum index 8bff1be7eb0f..559b08090585 100644 --- a/go.sum +++ b/go.sum @@ -348,8 +348,6 @@ github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= github.com/kunwardeep/paralleltest v1.0.10 h1:wrodoaKYzS2mdNVnc4/w31YaXFtsc21PCTdvWJ/lDDs= github.com/kunwardeep/paralleltest v1.0.10/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= -github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= -github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/lasiar/canonicalheader v1.1.2 h1:vZ5uqwvDbyJCnMhmFYimgMZnJMjwljN5VGY0VKbMXb4= github.com/lasiar/canonicalheader v1.1.2/go.mod h1:qJCeLFS0G/QlLQ506T+Fk/fWMa2VmBUiEI2cuMK4djI= github.com/ldez/exptostd v0.4.1 h1:DIollgQ3LWZMp3HJbSXsdE2giJxMfjyHj3eX4oiD6JU= diff --git a/jsonschema/golangci.next.jsonschema.json b/jsonschema/golangci.next.jsonschema.json index 5249a96aa006..3716dc8258a7 100644 --- a/jsonschema/golangci.next.jsonschema.json +++ b/jsonschema/golangci.next.jsonschema.json @@ -351,7 +351,6 @@ "errorlint", "exhaustive", "exhaustruct", - "exportloopref", "exptostd", "fatcontext", "forbidigo", diff --git a/pkg/golinters/exportloopref/exportloopref.go b/pkg/golinters/exportloopref/exportloopref.go deleted file mode 100644 index e232f8045d3f..000000000000 --- a/pkg/golinters/exportloopref/exportloopref.go +++ /dev/null @@ -1,19 +0,0 @@ -package exportloopref - -import ( - "github.com/kyoh86/exportloopref" - "golang.org/x/tools/go/analysis" - - "github.com/golangci/golangci-lint/pkg/goanalysis" -) - -func New() *goanalysis.Linter { - a := exportloopref.Analyzer - - return goanalysis.NewLinter( - a.Name, - a.Doc, - []*analysis.Analyzer{a}, - nil, - ).WithLoadMode(goanalysis.LoadModeTypesInfo) -} diff --git a/pkg/golinters/exportloopref/exportloopref_integration_test.go b/pkg/golinters/exportloopref/exportloopref_integration_test.go deleted file mode 100644 index e2696afe9e4f..000000000000 --- a/pkg/golinters/exportloopref/exportloopref_integration_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package exportloopref - -import ( - "testing" - - "github.com/golangci/golangci-lint/test/testshared/integration" -) - -func TestFromTestdata(t *testing.T) { - integration.RunTestdata(t) -} diff --git a/pkg/golinters/exportloopref/testdata/exportloopref.go b/pkg/golinters/exportloopref/testdata/exportloopref.go deleted file mode 100644 index 2d6b6aa36a37..000000000000 --- a/pkg/golinters/exportloopref/testdata/exportloopref.go +++ /dev/null @@ -1,46 +0,0 @@ -//golangcitest:args -Eexportloopref -package testdata - -import "fmt" - -func dummyFunction() { - var array [4]*int - var slice []*int - var ref *int - var str struct{ x *int } - - fmt.Println("loop expecting 10, 11, 12, 13") - for i, p := range []int{10, 11, 12, 13} { - printp(&p) - slice = append(slice, &p) // want "exporting a pointer for the loop variable p" - array[i] = &p // want "exporting a pointer for the loop variable p" - if i%2 == 0 { - ref = &p // want "exporting a pointer for the loop variable p" - str.x = &p // want "exporting a pointer for the loop variable p" - } - var vStr struct{ x *int } - var vArray [4]*int - var v *int - if i%2 == 0 { - v = &p - vArray[1] = &p - vStr.x = &p - } - _ = v - } - - fmt.Println(`slice expecting "10, 11, 12, 13" but "13, 13, 13, 13"`) - for _, p := range slice { - printp(p) - } - fmt.Println(`array expecting "10, 11, 12, 13" but "13, 13, 13, 13"`) - for _, p := range array { - printp(p) - } - fmt.Println(`captured value expecting "12" but "13"`) - printp(ref) -} - -func printp(p *int) { - fmt.Println(*p) -} diff --git a/pkg/golinters/exportloopref/testdata/exportloopref_cgo.go b/pkg/golinters/exportloopref/testdata/exportloopref_cgo.go deleted file mode 100644 index 22d0a2bdcc98..000000000000 --- a/pkg/golinters/exportloopref/testdata/exportloopref_cgo.go +++ /dev/null @@ -1,65 +0,0 @@ -//golangcitest:args -Eexportloopref -package testdata - -/* - #include - #include - - void myprint(char* s) { - printf("%d\n", s); - } -*/ -import "C" - -import ( - "fmt" - "unsafe" -) - -func _() { - cs := C.CString("Hello from stdio\n") - C.myprint(cs) - C.free(unsafe.Pointer(cs)) -} - -func dummyFunction() { - var array [4]*int - var slice []*int - var ref *int - var str struct{ x *int } - - fmt.Println("loop expecting 10, 11, 12, 13") - for i, p := range []int{10, 11, 12, 13} { - printp(&p) - slice = append(slice, &p) // want "exporting a pointer for the loop variable p" - array[i] = &p // want "exporting a pointer for the loop variable p" - if i%2 == 0 { - ref = &p // want "exporting a pointer for the loop variable p" - str.x = &p // want "exporting a pointer for the loop variable p" - } - var vStr struct{ x *int } - var vArray [4]*int - var v *int - if i%2 == 0 { - v = &p - vArray[1] = &p - vStr.x = &p - } - _ = v - } - - fmt.Println(`slice expecting "10, 11, 12, 13" but "13, 13, 13, 13"`) - for _, p := range slice { - printp(p) - } - fmt.Println(`array expecting "10, 11, 12, 13" but "13, 13, 13, 13"`) - for _, p := range array { - printp(p) - } - fmt.Println(`captured value expecting "12" but "13"`) - printp(ref) -} - -func printp(p *int) { - fmt.Println(*p) -} diff --git a/pkg/lint/lintersdb/builder_linter.go b/pkg/lint/lintersdb/builder_linter.go index 2c0d68c9bdae..bdda9727a1ae 100644 --- a/pkg/lint/lintersdb/builder_linter.go +++ b/pkg/lint/lintersdb/builder_linter.go @@ -25,7 +25,6 @@ import ( "github.com/golangci/golangci-lint/pkg/golinters/errorlint" "github.com/golangci/golangci-lint/pkg/golinters/exhaustive" "github.com/golangci/golangci-lint/pkg/golinters/exhaustruct" - "github.com/golangci/golangci-lint/pkg/golinters/exportloopref" "github.com/golangci/golangci-lint/pkg/golinters/exptostd" "github.com/golangci/golangci-lint/pkg/golinters/fatcontext" "github.com/golangci/golangci-lint/pkg/golinters/forbidigo" @@ -278,12 +277,12 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) { WithLoadForGoAnalysis(). WithURL("https://github.com/GaijinEntertainment/go-exhaustruct"), - linter.NewConfig(exportloopref.New()). + linter.NewConfig(linter.NewNoopDeprecated("exportloopref", cfg, linter.DeprecationError)). WithSince("v1.28.0"). WithPresets(linter.PresetBugs). WithLoadForGoAnalysis(). WithURL("https://github.com/kyoh86/exportloopref"). - DeprecatedWarning("Since Go1.22 (loopvar) this linter is no longer relevant.", "v1.60.2", "copyloopvar"), + DeprecatedError("Since Go1.22 (loopvar) this linter is no longer relevant.", "v1.60.2", "copyloopvar"), linter.NewConfig(exptostd.New()). WithSince("v1.63.0"). From bd4d007b9be23a9023ac7fbde32d70b03f1191f6 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sun, 2 Feb 2025 02:36:06 +0100 Subject: [PATCH 09/13] chore: use os.CopyFS when possible --- scripts/website/copy_jsonschema/main.go | 29 +++++-------------------- 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/scripts/website/copy_jsonschema/main.go b/scripts/website/copy_jsonschema/main.go index 8708bfcfaddc..a34bcaf7193f 100644 --- a/scripts/website/copy_jsonschema/main.go +++ b/scripts/website/copy_jsonschema/main.go @@ -6,7 +6,6 @@ import ( "log" "os" "path/filepath" - "strings" hcversion "github.com/hashicorp/go-version" @@ -28,24 +27,9 @@ func copySchemas() error { return fmt.Errorf("remove dir: %w", err) } - err = os.MkdirAll(dstDir, os.ModePerm) + err = os.CopyFS(dstDir, os.DirFS("jsonschema")) if err != nil { - return fmt.Errorf("make dir: %w", err) - } - - // The key is the destination file. - // The value is the source file. - files := map[string]string{} - - entries, err := os.ReadDir("jsonschema") - if err != nil { - return fmt.Errorf("read dir: %w", err) - } - - for _, entry := range entries { - if strings.HasSuffix(entry.Name(), ".jsonschema.json") { - files[entry.Name()] = entry.Name() - } + return fmt.Errorf("copy FS: %w", err) } latest, err := github.GetLatestVersion() @@ -59,13 +43,10 @@ func copySchemas() error { } versioned := fmt.Sprintf("golangci.v%d.%d.jsonschema.json", version.Segments()[0], version.Segments()[1]) - files[versioned] = "golangci.jsonschema.json" - for dst, src := range files { - err := copyFile(filepath.Join("jsonschema", src), filepath.Join(dstDir, dst)) - if err != nil { - return fmt.Errorf("copy files: %w", err) - } + err = copyFile(filepath.FromSlash("jsonschema/golangci.jsonschema.json"), filepath.Join(dstDir, versioned)) + if err != nil { + return fmt.Errorf("copy files: %w", err) } return nil From 59f9af2570ea33e93bbf30d2b45f0940b2ba2f96 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Mon, 3 Feb 2025 01:24:50 +0100 Subject: [PATCH 10/13] chore(JSONSchema): prepare v1 compatibility --- scripts/website/copy_jsonschema/main.go | 36 ++++++++++++++++++------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/scripts/website/copy_jsonschema/main.go b/scripts/website/copy_jsonschema/main.go index a34bcaf7193f..c41eb900bd9e 100644 --- a/scripts/website/copy_jsonschema/main.go +++ b/scripts/website/copy_jsonschema/main.go @@ -32,6 +32,17 @@ func copySchemas() error { return fmt.Errorf("copy FS: %w", err) } + err = copyLatestSchema() + if err != nil { + return fmt.Errorf("copy files: %w", err) + } + + return nil +} + +func copyLatestSchema() error { + src := filepath.FromSlash("jsonschema/golangci.jsonschema.json") + latest, err := github.GetLatestVersion() if err != nil { return fmt.Errorf("get latest release version: %w", err) @@ -42,17 +53,11 @@ func copySchemas() error { return fmt.Errorf("parse version: %w", err) } - versioned := fmt.Sprintf("golangci.v%d.%d.jsonschema.json", version.Segments()[0], version.Segments()[1]) - - err = copyFile(filepath.FromSlash("jsonschema/golangci.jsonschema.json"), filepath.Join(dstDir, versioned)) - if err != nil { - return fmt.Errorf("copy files: %w", err) + files := []string{ + fmt.Sprintf("golangci.v%d.jsonschema.json", version.Segments()[0]), + fmt.Sprintf("golangci.v%d.%d.jsonschema.json", version.Segments()[0], version.Segments()[1]), } - return nil -} - -func copyFile(src, dst string) error { source, err := os.Open(src) if err != nil { return fmt.Errorf("open file %s: %w", src, err) @@ -65,6 +70,17 @@ func copyFile(src, dst string) error { return fmt.Errorf("file %s not found: %w", src, err) } + for _, dst := range files { + err = copyFile(dst, source, info) + if err != nil { + return fmt.Errorf("copy file %s to %s: %w", src, dst, err) + } + } + + return nil +} + +func copyFile(dst string, source io.Reader, info os.FileInfo) error { destination, err := os.OpenFile(dst, os.O_RDWR|os.O_CREATE|os.O_TRUNC, info.Mode()) if err != nil { return fmt.Errorf("create file %s: %w", dst, err) @@ -74,7 +90,7 @@ func copyFile(src, dst string) error { _, err = io.Copy(destination, source) if err != nil { - return fmt.Errorf("copy file %s to %s: %w", src, dst, err) + return err } return nil From 376e3cddda962258f2e8431c17a8864db31f20cc Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 5 Feb 2025 22:09:36 +0100 Subject: [PATCH 11/13] chore: update to go1.24rc3 --- .github/workflows/documentation.yml | 2 +- .github/workflows/post-release.yml | 2 +- .github/workflows/pr-documentation.yml | 2 +- .github/workflows/pr.yml | 4 ++-- .github/workflows/tag.yml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 112946d0c36f..e6873021c72b 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -16,7 +16,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.2' + GO_VERSION: '1.24.0-rc.3' NODE_VERSION: '20.x' CGO_ENABLED: 0 steps: diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 0f7cebda0260..f2f1f7e8fd1c 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -9,7 +9,7 @@ env: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.2' + GO_VERSION: '1.24.0-rc.3' jobs: update-gha-assets: diff --git a/.github/workflows/pr-documentation.yml b/.github/workflows/pr-documentation.yml index 763d6b913bb5..41f070a114d4 100644 --- a/.github/workflows/pr-documentation.yml +++ b/.github/workflows/pr-documentation.yml @@ -13,7 +13,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.2' + GO_VERSION: '1.24.0-rc.3' NODE_VERSION: '20.x' CGO_ENABLED: 0 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c58002a384b3..12f0fa29b3ef 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -11,7 +11,7 @@ env: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.2' + GO_VERSION: '1.24.0-rc.3' jobs: # Check if there is any dirty change for go mod tidy @@ -79,7 +79,7 @@ jobs: - ubuntu-24.04-arm golang: - '1.23' - - '1.24.0-rc.2' + - '1.24.0-rc.3' runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 04b392818dcb..98601a1278c2 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -12,7 +12,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.2' + GO_VERSION: '1.24.0-rc.3' CHOCOLATEY_VERSION: 2.2.0 steps: # temporary workaround for an error in free disk space action From 3dcf548a3d4b00718e7fea7901cbb290382f6313 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 11 Feb 2025 20:18:27 +0100 Subject: [PATCH 12/13] chore: update to go1.24.0 --- .github/workflows/documentation.yml | 2 +- .github/workflows/post-release.yml | 2 +- .github/workflows/pr-documentation.yml | 2 +- .github/workflows/pr.yml | 4 ++-- .github/workflows/tag.yml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index e6873021c72b..23ca9bbc7cc6 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -16,7 +16,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.3' + GO_VERSION: '1.24' NODE_VERSION: '20.x' CGO_ENABLED: 0 steps: diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index f2f1f7e8fd1c..19b604ece9fc 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -9,7 +9,7 @@ env: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.3' + GO_VERSION: '1.24' jobs: update-gha-assets: diff --git a/.github/workflows/pr-documentation.yml b/.github/workflows/pr-documentation.yml index 41f070a114d4..bdd9043cb6b2 100644 --- a/.github/workflows/pr-documentation.yml +++ b/.github/workflows/pr-documentation.yml @@ -13,7 +13,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.3' + GO_VERSION: '1.24' NODE_VERSION: '20.x' CGO_ENABLED: 0 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 12f0fa29b3ef..25e028128261 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -11,7 +11,7 @@ env: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.3' + GO_VERSION: '1.24' jobs: # Check if there is any dirty change for go mod tidy @@ -79,7 +79,7 @@ jobs: - ubuntu-24.04-arm golang: - '1.23' - - '1.24.0-rc.3' + - '1.24' runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 98601a1278c2..9bdfbee578e3 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -12,7 +12,7 @@ jobs: # ex: # - 1.18beta1 -> 1.18.0-beta.1 # - 1.18rc1 -> 1.18.0-rc.1 - GO_VERSION: '1.24.0-rc.3' + GO_VERSION: '1.24' CHOCOLATEY_VERSION: 2.2.0 steps: # temporary workaround for an error in free disk space action From 9a3a3e308d1ec850950410cf39f46d1898696098 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 11 Feb 2025 20:32:48 +0100 Subject: [PATCH 13/13] tests: fix for go1.24 --- pkg/golinters/usetesting/testdata/usetesting_go124.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/golinters/usetesting/testdata/usetesting_go124.go b/pkg/golinters/usetesting/testdata/usetesting_go124.go index 0ac122da1caa..aae2c6ebe810 100644 --- a/pkg/golinters/usetesting/testdata/usetesting_go124.go +++ b/pkg/golinters/usetesting/testdata/usetesting_go124.go @@ -26,7 +26,7 @@ func Test_osMkdirTemp(t *testing.T) { } func Test_osSetenv(t *testing.T) { - os.Setenv("", "") + os.Setenv("", "") // want `os\.Setenv\(\) could be replaced by t\.Setenv\(\) in .+` } func Test_osTempDir(t *testing.T) {