From bd50c0078752f461b3b8800c0f5cd7b636bf91d4 Mon Sep 17 00:00:00 2001 From: JT Date: Mon, 1 Dec 2025 16:24:58 +1100 Subject: [PATCH] Bump go version + dependencies Fix testscrealted to updated strong format rules in Go 1.25.4 --- go.mod | 12 +++++----- go.sum | 10 +++++++++ pkg/apiclient/client_factory.go | 6 ++--- pkg/cmd/project/variables/exclude/exclude.go | 4 ++-- pkg/cmd/project/variables/include/include.go | 4 ++-- pkg/cmd/projectgroup/view/view.go | 23 ++++++++++---------- pkg/cmd/runbook/snapshot/create/create.go | 5 +++-- pkg/cmd/space/create/create_test.go | 5 +++-- pkg/gitresources/gitResources.go | 2 +- pkg/machinescommon/web.go | 5 +++-- pkg/packages/packages.go | 2 +- test/integration/account_test.go | 3 ++- test/testutil/testutil.go | 4 ++-- 13 files changed, 49 insertions(+), 36 deletions(-) diff --git a/go.mod b/go.mod index 564f083a..11c9fb7f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/OctopusDeploy/cli -go 1.23.12 +go 1.25.4 require ( github.com/AlecAivazis/survey/v2 v2.3.7 @@ -21,7 +21,7 @@ require ( github.com/spf13/viper v1.14.0 github.com/stretchr/testify v1.8.4 golang.org/x/exp v0.0.0-20230129154200-a960b3787bd2 - golang.org/x/term v0.34.0 + golang.org/x/term v0.37.0 ) require ( @@ -53,10 +53,10 @@ require ( github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/subosito/gotenv v1.4.1 // indirect - golang.org/x/crypto v0.41.0 // indirect - golang.org/x/net v0.43.0 // indirect - golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/crypto v0.45.0 // indirect + golang.org/x/net v0.47.0 // indirect + golang.org/x/sys v0.38.0 // indirect + golang.org/x/text v0.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index c31b9cfd..8408950c 100644 --- a/go.sum +++ b/go.sum @@ -279,6 +279,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -349,6 +351,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -413,10 +417,14 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= +golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU= +golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -427,6 +435,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= +golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/pkg/apiclient/client_factory.go b/pkg/apiclient/client_factory.go index 01738768..1bf1db16 100644 --- a/pkg/apiclient/client_factory.go +++ b/pkg/apiclient/client_factory.go @@ -159,13 +159,11 @@ func ValidateMandatoryEnvironment(host string, apiKey string, accessToken string if isInteractive { err := GetInteractiveMandatoryEnvironmentErrorMessage() - - return fmt.Errorf(err) + return errors.New(err) } err := GetNonInteractiveMandatoryEnvironmentErrorMessage() - - return fmt.Errorf(err) + return errors.New(err) } return nil diff --git a/pkg/cmd/project/variables/exclude/exclude.go b/pkg/cmd/project/variables/exclude/exclude.go index ed29aebd..9717f982 100644 --- a/pkg/cmd/project/variables/exclude/exclude.go +++ b/pkg/cmd/project/variables/exclude/exclude.go @@ -112,11 +112,11 @@ func excludeRun(opts *ExcludeOptions) error { } if !util.SliceContainsAny(project.IncludedLibraryVariableSets, func(item string) bool { return item == targetVariableSet[0].ID }) { - fmt.Fprintf(opts.Out, output.Yellowf("'%s' is not currently included, skipping\n", targetVariableSet[0].Name)) + fmt.Fprint(opts.Out, output.Yellowf("'%s' is not currently included, skipping\n", targetVariableSet[0].Name)) } else { project.IncludedLibraryVariableSets = util.SliceFilter(project.IncludedLibraryVariableSets, func(id string) bool { return id != targetVariableSet[0].ID }) projectModified = true - fmt.Fprintf(opts.Out, output.Cyanf("Removing '%s' library variable set\n", targetVariableSet[0].Name)) + fmt.Fprint(opts.Out, output.Cyanf("Removing '%s' library variable set\n", targetVariableSet[0].Name)) } } diff --git a/pkg/cmd/project/variables/include/include.go b/pkg/cmd/project/variables/include/include.go index ffde744e..d9c002c9 100644 --- a/pkg/cmd/project/variables/include/include.go +++ b/pkg/cmd/project/variables/include/include.go @@ -112,11 +112,11 @@ func includeRun(opts *IncludeOptions) error { } if util.SliceContainsAny(project.IncludedLibraryVariableSets, func(item string) bool { return item == targetVariableSet[0].ID }) { - fmt.Fprintf(opts.Out, output.Yellowf("'%s' is already included, skipping\n", targetVariableSet[0].Name)) + fmt.Fprint(opts.Out, output.Yellowf("'%s' is already included, skipping\n", targetVariableSet[0].Name)) } else { project.IncludedLibraryVariableSets = append(project.IncludedLibraryVariableSets, targetVariableSet[0].ID) projectModified = true - fmt.Fprintf(opts.Out, output.Cyanf("Including '%s' library variable set\n", targetVariableSet[0].Name)) + fmt.Fprint(opts.Out, output.Cyanf("Including '%s' library variable set\n", targetVariableSet[0].Name)) } } diff --git a/pkg/cmd/projectgroup/view/view.go b/pkg/cmd/projectgroup/view/view.go index 7f5dc24f..ab04684d 100644 --- a/pkg/cmd/projectgroup/view/view.go +++ b/pkg/cmd/projectgroup/view/view.go @@ -2,10 +2,11 @@ package view import ( "fmt" - "github.com/OctopusDeploy/cli/pkg/apiclient" "io" "strings" + "github.com/OctopusDeploy/cli/pkg/apiclient" + "github.com/MakeNowJust/heredoc/v2" "github.com/OctopusDeploy/cli/pkg/constants" "github.com/OctopusDeploy/cli/pkg/factory" @@ -100,7 +101,7 @@ func viewRun(opts *ViewOptions) error { Slug: project.Slug, }) } - + return ProjectGroupAsJson{ Id: pg.GetID(), Name: pg.GetName(), @@ -116,9 +117,9 @@ func viewRun(opts *ViewOptions) error { if description == "" { description = constants.NoDescription } - + url := util.GenerateWebURL(opts.Host, pg.SpaceID, fmt.Sprintf("projects?projectGroupId=%s", pg.GetID())) - + return []string{ output.Bold(pg.GetName()), description, @@ -149,30 +150,30 @@ type ProjectGroupAsJson struct { func formatProjectGroupForBasic(opts *ViewOptions, projectGroup *projectgroups.ProjectGroup, projects []*projects.Project) string { var result strings.Builder - + // header result.WriteString(fmt.Sprintf("%s %s\n", output.Bold(projectGroup.GetName()), output.Dimf("(%s)", projectGroup.GetID()))) - + // description if projectGroup.Description == "" { result.WriteString(fmt.Sprintln(output.Dim(constants.NoDescription))) } else { result.WriteString(fmt.Sprintln(output.Dim(projectGroup.Description))) } - + // projects - result.WriteString(fmt.Sprintf(output.Cyan("\nProjects:\n"))) + result.WriteString(fmt.Sprint(output.Cyan("\nProjects:\n"))) for _, project := range projects { result.WriteString(fmt.Sprintf("%s (%s)\n", output.Bold(project.GetName()), project.Slug)) } - + // footer with web URL url := util.GenerateWebURL(opts.Host, projectGroup.SpaceID, fmt.Sprintf("projects?projectGroupId=%s", projectGroup.GetID())) result.WriteString(fmt.Sprintf("\nView this project group in Octopus Deploy: %s\n", output.Blue(url))) - + if opts.flags.Web.Value { browser.OpenURL(url) } - + return result.String() } diff --git a/pkg/cmd/runbook/snapshot/create/create.go b/pkg/cmd/runbook/snapshot/create/create.go index 1d9e7be6..288fc618 100644 --- a/pkg/cmd/runbook/snapshot/create/create.go +++ b/pkg/cmd/runbook/snapshot/create/create.go @@ -4,6 +4,8 @@ import ( "encoding/json" "errors" "fmt" + "os" + "github.com/AlecAivazis/survey/v2" "github.com/MakeNowJust/heredoc/v2" "github.com/OctopusDeploy/cli/pkg/cmd" @@ -24,7 +26,6 @@ import ( "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/releases" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/runbooks" "github.com/spf13/cobra" - "os" ) const ( @@ -253,7 +254,7 @@ func createRun(opts *CreateOptions, outputFormat string) error { if err != nil { return err } - fmt.Fprintf(opts.Out, string(data)) + fmt.Fprint(opts.Out, string(data)) default: if opts.Publish.Value { _, _ = fmt.Fprintf(opts.Out, "\nSuccessfully created and published runbook snapshot '%s' (%s) for runbook '%s'\n", snapshot.Name, snapshot.GetID(), runbook.Name) diff --git a/pkg/cmd/space/create/create_test.go b/pkg/cmd/space/create/create_test.go index 1f3c3c67..e5b5eb93 100644 --- a/pkg/cmd/space/create/create_test.go +++ b/pkg/cmd/space/create/create_test.go @@ -2,6 +2,8 @@ package create_test import ( "fmt" + "testing" + "github.com/OctopusDeploy/cli/pkg/cmd" "github.com/OctopusDeploy/cli/pkg/cmd/space/create" "github.com/OctopusDeploy/cli/pkg/output" @@ -10,7 +12,6 @@ import ( "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/teams" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/users" "github.com/stretchr/testify/assert" - "testing" ) func TestPromptMissing_AllOptionsSupplied(t *testing.T) { @@ -80,7 +81,7 @@ func TestPromptMissing_NoOptionsSupplied(t *testing.T) { } func formatUser(user *users.User) string { - return fmt.Sprintf("%s (%s)", user.DisplayName, output.Dimf(user.Username)) + return fmt.Sprintf("%s (%s)", user.DisplayName, output.Dim(user.Username)) } func formatTeam(team *teams.Team) string { diff --git a/pkg/gitresources/gitResources.go b/pkg/gitresources/gitResources.go index 98c643f7..dde0862f 100644 --- a/pkg/gitresources/gitResources.go +++ b/pkg/gitresources/gitResources.go @@ -137,7 +137,7 @@ outerLoop: case "y": // YES these are the git resources they want break outerLoop case "?": // help text - _, _ = fmt.Fprintf(stdout, output.FormatDoc(gitResourceGitRefLoopHelpText)) + _, _ = fmt.Fprint(stdout, output.FormatDoc(gitResourceGitRefLoopHelpText)) case "u": // undo! if len(overriddenGitResourceGitRefs) > 0 { //strip the last override from the list diff --git a/pkg/machinescommon/web.go b/pkg/machinescommon/web.go index d25b3ede..7cd56ccd 100644 --- a/pkg/machinescommon/web.go +++ b/pkg/machinescommon/web.go @@ -2,6 +2,8 @@ package machinescommon import ( "fmt" + "io" + "github.com/OctopusDeploy/cli/pkg/cmd" "github.com/OctopusDeploy/cli/pkg/output" "github.com/OctopusDeploy/cli/pkg/util" @@ -10,7 +12,6 @@ import ( "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/workerpools" "github.com/pkg/browser" "github.com/spf13/cobra" - "io" ) const ( @@ -47,7 +48,7 @@ func DoWebForWorkerPools(workerPool workerpools.IWorkerPool, dependencies *cmd.D } func doWeb(url string, description string, out io.Writer, flags *WebFlags) { - link := output.Bluef(url) + link := output.Blue(url) fmt.Fprintf(out, "View this %s on Octopus Deploy: %s\n", description, link) if flags.Web.Value { browser.OpenURL(url) diff --git a/pkg/packages/packages.go b/pkg/packages/packages.go index 1b015c66..4b8b4767 100644 --- a/pkg/packages/packages.go +++ b/pkg/packages/packages.go @@ -589,7 +589,7 @@ outerLoop: case "y": // YES these are the packages they want break outerLoop case "?": // help text - _, _ = fmt.Fprintf(stdout, output.FormatDoc(packageOverrideLoopHelpText)) + _, _ = fmt.Fprint(stdout, output.FormatDoc(packageOverrideLoopHelpText)) case "u": // undo! if len(packageVersionOverrides) > 0 { packageVersionOverrides = packageVersionOverrides[:len(packageVersionOverrides)-1] diff --git a/test/integration/account_test.go b/test/integration/account_test.go index 2d214757..89518100 100644 --- a/test/integration/account_test.go +++ b/test/integration/account_test.go @@ -2,9 +2,10 @@ package integration_test import ( "encoding/json" + "testing" + "github.com/MakeNowJust/heredoc/v2" "github.com/stretchr/testify/require" - "testing" "github.com/OctopusDeploy/cli/test/integration" "github.com/OctopusDeploy/cli/test/testutil" diff --git a/test/testutil/testutil.go b/test/testutil/testutil.go index 073166f5..21ac771b 100644 --- a/test/testutil/testutil.go +++ b/test/testutil/testutil.go @@ -20,7 +20,7 @@ func AssertSuccess(t *testing.T, err error, args ...any) bool { for _, arg := range args { t.Log(arg) } - t.Errorf(err.Error()) + t.Error(err.Error()) debug.PrintStack() return false @@ -34,7 +34,7 @@ func RequireSuccess(t *testing.T, err error, args ...any) bool { t.Log(arg) } debug.PrintStack() - t.Fatalf(err.Error()) + t.Fatal(err.Error()) return false } return true