From 9b28ef2977c49a06c7d4d5c06a6a648521b132e3 Mon Sep 17 00:00:00 2001 From: CURZOLA Pierre Date: Wed, 30 Apr 2025 17:39:04 +0200 Subject: [PATCH 1/3] deps: update go from 1.23.4 to 1.24.2 --- CHANGELOG.md | 3 ++- go.mod | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b43c391a7..98ec46ff9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ### To be Released -* feat(regionmigrations): remove the commands +* feat(regionmigrations): remove the commands [#1104](https://github.com/Scalingo/cli/pull/1104) +* chore(go) update go version to 1.24 [#1108](https://github.com/Scalingo/cli/pull/1108) ### 1.34.0 diff --git a/go.mod b/go.mod index a0f9e01f4..98ede2bc4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Scalingo/cli -go 1.23.4 +go 1.24.2 require ( github.com/AlecAivazis/survey/v2 v2.3.7 From 5392885d40cdca72672efd644e3a8da3adaa3441 Mon Sep 17 00:00:00 2001 From: CURZOLA Pierre Date: Thu, 22 May 2025 10:15:58 +0200 Subject: [PATCH 2/3] chore(actions) update golangci-lint version And use new-from-merge-base option instead of new-from-rev --- .github/workflows/publish.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d4f0167e6..d3e35563c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,15 +27,15 @@ jobs: - name: Get golangci-lint configuration file run: wget --output-document=$(pwd)/.golangci.yml https://sc-devtools.s3.eu-west-1.amazonaws.com/golang-ci/golangci.yml - name: Get master branch commit ID - id: new-from-rev - run: echo "NEW_FROM_REV=$( git rev-parse origin/master )" >> "$GITHUB_OUTPUT" + id: new-from-merge-base + run: echo "NEW-FROM-MERGE-BASE=$( git rev-parse origin/master )" >> "$GITHUB_OUTPUT" - name: "Execute golangci-lint on a pull request" - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: # The `only-new-issues` flag is not working (https://github.com/golangci/golangci-lint-action/issues/531). - # We rather decided to use the suggestion from the FAQ (https://golangci-lint.run/welcome/faq/#how-to-integrate-golangci-lint-into-large-project-with-thousands-of-issues) and use `--new-from-rev` + # We rather decided to use the suggestion from the FAQ (https://golangci-lint.run/welcome/faq/#how-to-integrate-golangci-lint-into-large-project-with-thousands-of-issues) and use `--new-from-merge-base` # only-new-issues: false - args: "--config=$(pwd)/.golangci.yml --new-from-rev=${{ steps.new-from-rev.outputs.NEW_FROM_REV }}" + args: "--config=$(pwd)/.golangci.yml --new-from-merge-base=${{ steps.new-from-merge-base.outputs.NEW-FROM-MERGE-BASE }}" linter-master: name: golangci-lint on master branch @@ -53,12 +53,12 @@ jobs: - name: Get golangci-lint configuration file run: wget --output-document=$(pwd)/.golangci.yml https://sc-devtools.s3.eu-west-1.amazonaws.com/golang-ci/golangci.yml - name: "Execute golangci-lint on the master branch" - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: # The `only-new-issues` flag is not working (https://github.com/golangci/golangci-lint-action/issues/531). - # We rather decided to use the suggestion from the FAQ (https://golangci-lint.run/usage/faq/#how-to-integrate-golangci-lint-into-large-project-with-thousands-of-issues) and use `--new-from-rev` + # We rather decided to use the suggestion from the FAQ (https://golangci-lint.run/usage/faq/#how-to-integrate-golangci-lint-into-large-project-with-thousands-of-issues) and use `--new-from-merge-base` # only-new-issues: false - args: "--config=$(pwd)/.golangci.yml --new-from-rev=HEAD~1" + args: "--config=$(pwd)/.golangci.yml --new-from-merge-base=HEAD~1" tests: name: Unit Tests From 7d191e63c6999fa7af3d7952ba40b8132d4cb7e3 Mon Sep 17 00:00:00 2001 From: CURZOLA Pierre Date: Thu, 22 May 2025 10:23:52 +0200 Subject: [PATCH 3/3] fix(test) string format --- apps/operations.go | 10 +++++----- git/setup.go | 9 +++++---- utils/errors.go | 6 ------ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/apps/operations.go b/apps/operations.go index acdee1276..ca154125c 100644 --- a/apps/operations.go +++ b/apps/operations.go @@ -52,12 +52,12 @@ func (w *OperationWaiter) SetPrompt(p string) { func (w *OperationWaiter) WaitOperation(ctx context.Context) (*scalingo.Operation, error) { opURL, err := url.Parse(w.url) if err != nil { - return nil, errors.Notef(ctx, err, "parse url of operation") + return nil, errors.Wrap(ctx, err, "parse url of operation") } c, err := config.ScalingoClient(ctx) if err != nil { - return nil, errors.Notef(ctx, err, "get Scalingo client") + return nil, errors.Wrap(ctx, err, "get Scalingo client") } var op *scalingo.Operation @@ -70,7 +70,7 @@ func (w *OperationWaiter) WaitOperation(ctx context.Context) (*scalingo.Operatio op, err = c.OperationsShow(ctx, w.app, opID) if err != nil { - return nil, errors.Notef(ctx, err, "get operation %v", opID) + return nil, errors.Wrapf(ctx, err, "get operation %v", opID) } go func() { @@ -89,7 +89,7 @@ func (w *OperationWaiter) WaitOperation(ctx context.Context) (*scalingo.Operatio } }() - fmt.Fprintf(w.output, w.prompt) + fmt.Fprint(w.output, w.prompt) spinner := io.NewSpinner(os.Stderr) go spinner.Start() defer spinner.Stop() @@ -97,7 +97,7 @@ func (w *OperationWaiter) WaitOperation(ctx context.Context) (*scalingo.Operatio for { select { case err := <-errs: - return op, errors.Notef(ctx, err, "get operation %v", op.ID) + return op, errors.Wrapf(ctx, err, "get operation %v", op.ID) case <-done: if op.Status == "done" { fmt.Printf("\bDone in %.3f seconds\n", op.ElapsedDuration()) diff --git a/git/setup.go b/git/setup.go index 9037be401..4bf479ee9 100644 --- a/git/setup.go +++ b/git/setup.go @@ -7,8 +7,9 @@ import ( gitconfig "github.com/go-git/go-git/v5/config" errgo "gopkg.in/errgo.v1" + "github.com/pkg/errors" + "github.com/Scalingo/cli/io" - "github.com/Scalingo/cli/utils" "github.com/Scalingo/go-scalingo/v7/debug" ) @@ -63,10 +64,10 @@ func createRemoteInRepository(repository *git.Repository, remoteName string, url URLs: []string{url}, }) if err != nil { - errWrapped := utils.WrapError(err, "fail to create the Git remote") + errWrapped := errors.Wrapf(err, "create the Git remote") if err == git.ErrRemoteExists { message := "Fail to configure git repository, '" + remoteName + "' remote already exists (use --force option to override)" - errWrapped = utils.WrapError(errWrapped, message) + errWrapped = errors.Wrap(errWrapped, message) } return errWrapped } @@ -76,7 +77,7 @@ func createRemoteInRepository(repository *git.Repository, remoteName string, url func deleteThenCreateRemoteInRepository(repository *git.Repository, remoteName string, url string) error { err := repository.DeleteRemote(remoteName) if err != nil { - return utils.WrapError(err, "fail to delete the Git remote") + return errors.Wrap(err, "delete the Git remote") } return createRemoteInRepository(repository, remoteName, url) } diff --git a/utils/errors.go b/utils/errors.go index 4ddfb08cd..314023022 100644 --- a/utils/errors.go +++ b/utils/errors.go @@ -1,8 +1,6 @@ package utils import ( - "gopkg.in/errgo.v1" - "github.com/Scalingo/go-scalingo/v7/http" errors "github.com/Scalingo/go-utils/errors/v2" ) @@ -15,7 +13,3 @@ func IsRegionDisabledError(err error) bool { httperr, ok := reqerr.APIError.(http.ForbiddenError) return ok && httperr.Code == "region_disabled" } - -func WrapError(err error, wrappingMessage string) error { - return errgo.Notef(err, wrappingMessage) -}