From 7e737fe335ee11c3b29cbc8e817249cf530475c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Mon, 20 Jan 2025 10:48:20 +0100 Subject: [PATCH] Upgrade to Go 1.23 (#226) * Upgrade to Go 1.23 * * * Bump golangci-lint, fix new errors * goreleaser deprecations --- .goreleaser.yaml | 2 ++ .tool-versions | 2 +- bitrise.yml | 15 +++++++++++++-- cli/clear.go | 2 +- cli/commands.go | 2 +- cli/init.go | 8 ++++---- go.mod | 2 +- 7 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index faf014b..b1ae684 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,3 +1,5 @@ +version: 2 + before: hooks: - go mod tidy diff --git a/.tool-versions b/.tool-versions index 463dd77..a174531 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -golang 1.21 +golang 1.23.5 diff --git a/bitrise.yml b/bitrise.yml index ef3cba8..2bcb9bc 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -6,12 +6,21 @@ app: envs: - BIN_NAME: envman +step_bundles: + setup-go: + steps: + - script: + title: Setup pinned Go version + inputs: + - content: asdf install + workflows: test: after_run: - run_integration_tests title: Runs tests steps: + - bundle::setup-go: {} - go-list: { } - script: title: golangci-lint @@ -20,7 +29,7 @@ workflows: #!/usr/bin/env bash set -ex - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.62.2 asdf reshim golang golangci-lint run - go-test: { } @@ -51,6 +60,7 @@ workflows: envs: - GITHUB_TOKEN: $GIT_BOT_USER_ACCESS_TOKEN # Goreleaser expects this env var steps: + - bundle::setup-go: {} - script: title: Goreleaser (create binaries + publish to GH) deps: @@ -66,6 +76,7 @@ workflows: test-binary-build: description: Tests the release build process by creating a snapshot release (without publishing) steps: + - bundle::setup-go: {} - script: title: Goreleaser (create snapshot binaries) deps: @@ -76,4 +87,4 @@ workflows: #!/usr/bin/env bash set -ex - goreleaser release --snapshot --rm-dist + goreleaser release --snapshot --clean diff --git a/cli/clear.go b/cli/clear.go index b4aa64e..5874311 100644 --- a/cli/clear.go +++ b/cli/clear.go @@ -9,7 +9,7 @@ import ( "github.com/urfave/cli" ) -func clear(_ *cli.Context) error { +func clearEnvstore(_ *cli.Context) error { log.Debugln("[ENVMAN] - Work path:", CurrentEnvStoreFilePath) if err := ClearEnvs(CurrentEnvStoreFilePath); err != nil { diff --git a/cli/commands.go b/cli/commands.go index 676ef6b..3a70e4a 100644 --- a/cli/commands.go +++ b/cli/commands.go @@ -53,7 +53,7 @@ var ( Name: "clear", Aliases: []string{"c"}, Usage: "Clear the envstore.", - Action: clear, + Action: clearEnvstore, }, { Name: "print", diff --git a/cli/init.go b/cli/init.go index f0c3574..b79ba4c 100644 --- a/cli/init.go +++ b/cli/init.go @@ -10,15 +10,15 @@ import ( func initEnvStore(c *cli.Context) error { log.Debugln("[ENVMAN] - Work path:", CurrentEnvStoreFilePath) - clear := c.Bool(ClearKey) - err := InitEnvStore(CurrentEnvStoreFilePath, clear) + clearEnvstore := c.Bool(ClearKey) + err := InitEnvStore(CurrentEnvStoreFilePath, clearEnvstore) log.Debugln("[ENVMAN] - Initialized") return err } // InitEnvStore ... -func InitEnvStore(envStorePth string, clear bool) error { - if clear { +func InitEnvStore(envStorePth string, clearEnvstore bool) error { + if clearEnvstore { if err := command.RemoveFile(envStorePth); err != nil { return fmt.Errorf("failed to clear path: %s", err) } diff --git a/go.mod b/go.mod index 611d066..60c07fe 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/bitrise-io/envman -go 1.21 +go 1.23 require ( github.com/bitrise-io/go-utils v1.0.13