diff --git a/.buildkite/docker-compose.yaml b/.buildkite/docker-compose.yaml index 0886bed3..dc567f47 100644 --- a/.buildkite/docker-compose.yaml +++ b/.buildkite/docker-compose.yaml @@ -1,8 +1,8 @@ -version: '3.5' +version: "3.5" services: golangci-lint: - image: golangci/golangci-lint:v1.61.0 + image: golangci/golangci-lint:v2.0.2 working_dir: /app volumes: - ..:/app diff --git a/.golangci.bck.yaml b/.golangci.bck.yaml new file mode 100644 index 00000000..e89aaa48 --- /dev/null +++ b/.golangci.bck.yaml @@ -0,0 +1,19 @@ +linters: + enable: + - gofmt + - nolintlint + - tparallel + - goimports + +issues: + max-issues-per-linter: 0 + max-same-issues: 0 + exclude-rules: + # dont worry about checking error returns in test files + - path: _test.go + linters: + - errcheck + # ignore typecheck errors for imports + - linters: + - typecheck + text: "undefined: .*" diff --git a/.golangci.yaml b/.golangci.yaml index 6d9032f5..9c6e0b46 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,14 +1,33 @@ +version: "2" linters: enable: - - gofmt - - nolintlint - - tparallel - + - nolintlint + - tparallel + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - errcheck + path: _test.go + paths: + - third_party$ + - builtin$ + - examples$ issues: max-issues-per-linter: 0 max-same-issues: 0 - exclude-rules: - # dont worry about checking error returns in test files - - path: _test.go - linters: - - errcheck +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/generate.go b/generate.go index 7d48ccf3..3fc35025 100644 --- a/generate.go +++ b/generate.go @@ -16,7 +16,7 @@ func main() { const schemaFile = "schema.graphql" if _, err := os.Stat(schemaFile); errors.Is(err, os.ErrNotExist) { - var headers http.Header = http.Header{ + var headers = http.Header{ "Authorization": []string{fmt.Sprintf("Bearer %s", os.Getenv("BUILDKITE_GRAPHQL_TOKEN"))}, } diff --git a/go.mod b/go.mod index a20b962b..16cfb756 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/buildkite/cli/v3 -go 1.23 +go 1.23.0 -toolchain go1.23.3 +toolchain go1.24.1 require ( github.com/AlecAivazis/survey/v2 v2.3.7 @@ -103,12 +103,12 @@ require ( github.com/xanzy/ssh-agent v0.3.3 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.9.0 // indirect - golang.org/x/crypto v0.32.0 // indirect + golang.org/x/crypto v0.35.0 // indirect golang.org/x/mod v0.20.0 // indirect - golang.org/x/net v0.34.0 // indirect + golang.org/x/net v0.36.0 // indirect golang.org/x/sys v0.30.0 // indirect - golang.org/x/term v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect + golang.org/x/term v0.29.0 // indirect + golang.org/x/text v0.22.0 // indirect golang.org/x/tools v0.24.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect ) diff --git a/go.sum b/go.sum index f031764e..abab102a 100644 --- a/go.sum +++ b/go.sum @@ -259,8 +259,8 @@ go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTV golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs= +golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -270,8 +270,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA= +golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= @@ -294,15 +294,15 @@ golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= +golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 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.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= diff --git a/internal/agent/item.go b/internal/agent/item.go index 07a66665..cb7b857e 100644 --- a/internal/agent/item.go +++ b/internal/agent/item.go @@ -3,7 +3,7 @@ package agent import ( "strings" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) // AgentListItem implements list.Item for displaying in a list diff --git a/internal/agent/view.go b/internal/agent/view.go index d9c8a234..c8e9b8aa 100644 --- a/internal/agent/view.go +++ b/internal/agent/view.go @@ -4,7 +4,7 @@ import ( "strings" "github.com/buildkite/cli/v3/internal/ui" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) // AgentDataTable renders detailed agent information in a table format diff --git a/internal/annotation/list.go b/internal/annotation/list.go index e9076e2c..47641cea 100644 --- a/internal/annotation/list.go +++ b/internal/annotation/list.go @@ -2,7 +2,7 @@ package annotation import ( "github.com/buildkite/cli/v3/internal/ui" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) // AnnotationSummary renders a summary of a build annotation diff --git a/internal/artifact/view.go b/internal/artifact/view.go index a05cf65c..8f363a17 100644 --- a/internal/artifact/view.go +++ b/internal/artifact/view.go @@ -2,7 +2,7 @@ package artifact import ( "github.com/buildkite/cli/v3/internal/ui" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) // ArtifactSummary renders a summary of a build artifact diff --git a/internal/build/resolver/options/options.go b/internal/build/resolver/options/options.go index 5c312c96..3c66b46f 100644 --- a/internal/build/resolver/options/options.go +++ b/internal/build/resolver/options/options.go @@ -4,8 +4,8 @@ import ( "context" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" - "github.com/go-git/go-git/v5" + buildkite "github.com/buildkite/go-buildkite/v4" + git "github.com/go-git/go-git/v5" ) // OptionsFn is a function to apply modifications to the list builds API request ie. for adding additional filters diff --git a/internal/build/resolver/url.go b/internal/build/resolver/url.go index bad66d7b..0d80ce7f 100644 --- a/internal/build/resolver/url.go +++ b/internal/build/resolver/url.go @@ -12,12 +12,12 @@ import ( func ResolveFromURL(args []string) BuildResolverFn { return func(context.Context) (*build.Build, error) { if len(args) != 1 { - return nil, fmt.Errorf("Incorrect number of arguments, expected 1, got %d", len(args)) + return nil, fmt.Errorf("incorrect number of arguments, expected 1, got %d", len(args)) } resolvedBuild := splitBuildURL(args[0]) if resolvedBuild == nil { - return nil, fmt.Errorf("Unable to resolve build from URL: %s", args[0]) + return nil, fmt.Errorf("unable to resolve build from URL: %s", args[0]) } return resolvedBuild, nil diff --git a/internal/build/resolver/with_options.go b/internal/build/resolver/with_options.go index 42e8b9cb..912f4bd8 100644 --- a/internal/build/resolver/with_options.go +++ b/internal/build/resolver/with_options.go @@ -8,7 +8,7 @@ import ( "github.com/buildkite/cli/v3/internal/build/resolver/options" pipelineResolver "github.com/buildkite/cli/v3/internal/pipeline/resolver" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) func ResolveBuildWithOpts(f *factory.Factory, pipelineResolver pipelineResolver.PipelineResolverFn, listOpts ...options.OptionsFn) BuildResolverFn { diff --git a/internal/build/view/shared/summary.go b/internal/build/view/shared/summary.go index 3a19dec3..0838bb0a 100644 --- a/internal/build/view/shared/summary.go +++ b/internal/build/view/shared/summary.go @@ -2,7 +2,7 @@ package shared import ( "github.com/buildkite/cli/v3/internal/ui" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) // BuildSummary renders a build summary that can be used by multiple commands diff --git a/internal/build/view/view.go b/internal/build/view/view.go index 639df665..654742ba 100644 --- a/internal/build/view/view.go +++ b/internal/build/view/view.go @@ -5,7 +5,7 @@ import ( "github.com/buildkite/cli/v3/internal/ui" "github.com/buildkite/cli/v3/internal/validation" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) // ViewOptions represents options for viewing a build diff --git a/internal/cluster/query.go b/internal/cluster/query.go index ae1da1c6..88174991 100644 --- a/internal/cluster/query.go +++ b/internal/cluster/query.go @@ -6,7 +6,7 @@ import ( "github.com/buildkite/cli/v3/internal/graphql" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) func GetQueues(ctx context.Context, f *factory.Factory, orgSlug string, clusterID string, lo *buildkite.ClusterQueuesListOptions) ([]buildkite.ClusterQueue, error) { diff --git a/internal/cluster/view.go b/internal/cluster/view.go index 6249965b..8624307c 100644 --- a/internal/cluster/view.go +++ b/internal/cluster/view.go @@ -2,7 +2,7 @@ package cluster import ( "github.com/buildkite/cli/v3/internal/ui" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) // ClusterViewTable renders a table view of one or more clusters diff --git a/internal/config/config.go b/internal/config/config.go index 753c106a..6a23d13b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -15,8 +15,8 @@ import ( "slices" "github.com/buildkite/cli/v3/internal/pipeline" - "github.com/buildkite/go-buildkite/v4" - "github.com/go-git/go-git/v5" + buildkite "github.com/buildkite/go-buildkite/v4" + git "github.com/go-git/go-git/v5" "github.com/spf13/afero" "github.com/spf13/viper" ) diff --git a/internal/job/view.go b/internal/job/view.go index 195f2423..6d5c3d31 100644 --- a/internal/job/view.go +++ b/internal/job/view.go @@ -2,7 +2,7 @@ package job import ( "github.com/buildkite/cli/v3/internal/ui" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) type Job buildkite.Job diff --git a/internal/pipeline/resolver/repository.go b/internal/pipeline/resolver/repository.go index df9f55f3..300f490b 100644 --- a/internal/pipeline/resolver/repository.go +++ b/internal/pipeline/resolver/repository.go @@ -6,9 +6,9 @@ import ( "github.com/buildkite/cli/v3/internal/pipeline" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/charmbracelet/huh/spinner" - "github.com/go-git/go-git/v5" + git "github.com/go-git/go-git/v5" ) // ResolveFromRepository finds pipelines based on the current repository. diff --git a/internal/pipeline/resolver/repository_test.go b/internal/pipeline/resolver/repository_test.go index 85900dfd..d24c12a1 100644 --- a/internal/pipeline/resolver/repository_test.go +++ b/internal/pipeline/resolver/repository_test.go @@ -7,8 +7,8 @@ import ( "github.com/buildkite/cli/v3/internal/config" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" - "github.com/go-git/go-git/v5" + buildkite "github.com/buildkite/go-buildkite/v4" + git "github.com/go-git/go-git/v5" "github.com/spf13/afero" ) diff --git a/internal/pipeline/resolver/resolver.go b/internal/pipeline/resolver/resolver.go index 2d4570b2..9e70a908 100644 --- a/internal/pipeline/resolver/resolver.go +++ b/internal/pipeline/resolver/resolver.go @@ -41,5 +41,5 @@ func NewAggregateResolver(resolvers ...PipelineResolverFn) AggregateResolver { } func errorResolver(context.Context) (*pipeline.Pipeline, error) { - return nil, errors.New("Failed to resolve a pipeline.") + return nil, errors.New("failed to resolve a pipeline") } diff --git a/internal/ui/components.go b/internal/ui/components.go index 8484f29e..b84c5b2c 100644 --- a/internal/ui/components.go +++ b/internal/ui/components.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/charmbracelet/lipgloss" ) @@ -72,7 +72,7 @@ func RenderJobSummary(job buildkite.Job) string { // Calculate duration var jobDuration time.Duration if job.Type == "script" && job.StartedAt != nil && job.FinishedAt != nil { - jobDuration = job.FinishedAt.Time.Sub(job.StartedAt.Time) + jobDuration = job.FinishedAt.Sub(job.StartedAt.Time) } // Render the duration with grey color diff --git a/internal/ui/ui_test.go b/internal/ui/ui_test.go index 0c973ce2..8fa4040e 100644 --- a/internal/ui/ui_test.go +++ b/internal/ui/ui_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" ) // stripANSI removes ANSI escape sequences from a string diff --git a/pkg/cmd/agent/list.go b/pkg/cmd/agent/list.go index 69fbda78..af021a8c 100644 --- a/pkg/cmd/agent/list.go +++ b/pkg/cmd/agent/list.go @@ -6,7 +6,7 @@ import ( "github.com/MakeNowJust/heredoc" "github.com/buildkite/cli/v3/internal/agent" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" tea "github.com/charmbracelet/bubbletea" "github.com/spf13/cobra" ) diff --git a/pkg/cmd/agent/stop.go b/pkg/cmd/agent/stop.go index 56158848..989e81c4 100644 --- a/pkg/cmd/agent/stop.go +++ b/pkg/cmd/agent/stop.go @@ -85,7 +85,7 @@ func RunStop(cmd *cobra.Command, args []string, opts *AgentStopOptions) error { } } } else { - return errors.New("Must supply agents to stop.") + return errors.New("must supply agents to stop") } bulkAgent := agent.BulkAgent{ @@ -107,7 +107,7 @@ func RunStop(cmd *cobra.Command, args []string, opts *AgentStopOptions) error { for _, agent := range agents { if agent.Errored() { - return errors.New("At least one agent failed to stop") + return errors.New("at least one agent failed to stop") } } return nil diff --git a/pkg/cmd/agent/stop_test.go b/pkg/cmd/agent/stop_test.go index 3f43091d..ae8a4e2d 100644 --- a/pkg/cmd/agent/stop_test.go +++ b/pkg/cmd/agent/stop_test.go @@ -10,7 +10,7 @@ import ( "github.com/buildkite/cli/v3/internal/config" "github.com/buildkite/cli/v3/pkg/cmd/agent" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/spf13/afero" ) @@ -26,7 +26,7 @@ func TestCmdAgentStop(t *testing.T) { err := cmd.Execute() got := err.Error() - want := "Must supply agents to stop." + want := "must supply agents to stop" if !strings.Contains(got, want) { t.Errorf("Output error did not contain expected string. %s != %s", got, want) } diff --git a/pkg/cmd/agent/view.go b/pkg/cmd/agent/view.go index 1eab176d..b6b2af50 100644 --- a/pkg/cmd/agent/view.go +++ b/pkg/cmd/agent/view.go @@ -6,7 +6,7 @@ import ( "github.com/MakeNowJust/heredoc" "github.com/buildkite/cli/v3/internal/agent" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/charmbracelet/huh/spinner" "github.com/pkg/browser" "github.com/spf13/cobra" diff --git a/pkg/cmd/api/api.go b/pkg/cmd/api/api.go index 137af3ad..14042861 100644 --- a/pkg/cmd/api/api.go +++ b/pkg/cmd/api/api.go @@ -73,7 +73,7 @@ func apiCaller(cmd *cobra.Command, args []string, f *factory.Factory) error { var endpointPrefix string if len(args) > 1 { - return fmt.Errorf("Incorrect number of arguments. Expected 1, got %d", len(args)) + return fmt.Errorf("incorrect number of arguments. expected 1, got %d", len(args)) } if len(args) == 0 { diff --git a/pkg/cmd/artifacts/list.go b/pkg/cmd/artifacts/list.go index c9fec87f..6a127190 100644 --- a/pkg/cmd/artifacts/list.go +++ b/pkg/cmd/artifacts/list.go @@ -10,7 +10,7 @@ import ( "github.com/buildkite/cli/v3/internal/build/resolver/options" pipelineResolver "github.com/buildkite/cli/v3/internal/pipeline/resolver" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/charmbracelet/huh/spinner" "github.com/charmbracelet/lipgloss" "github.com/spf13/cobra" @@ -33,11 +33,11 @@ func NewCmdArtifactsList(f *factory.Factory) *cobra.Command { # by default, artifacts of the most recent build for the current branch is shown $ bk artifacts list # to list artifacts of a specific build - $ bk artifacts list 429 + $ bk artifacts list 429 # to list artifacts of a specific job in a build - $ bk artifacts list 429 --job 0193903e-ecd9-4c51-9156-0738da987e87 + $ bk artifacts list 429 --job 0193903e-ecd9-4c51-9156-0738da987e87 # if not inside a repository or to use a specific pipeline, pass -p - $ bk artifacts list 429 -p monolith + $ bk artifacts list 429 -p monolith `), RunE: func(cmd *cobra.Command, args []string) error { var err error diff --git a/pkg/cmd/build/cancel.go b/pkg/cmd/build/cancel.go index 89cca4b5..f22d9b25 100644 --- a/pkg/cmd/build/cancel.go +++ b/pkg/cmd/build/cancel.go @@ -11,7 +11,7 @@ import ( "github.com/buildkite/cli/v3/internal/util" "github.com/buildkite/cli/v3/internal/validation/scopes" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/charmbracelet/huh/spinner" "github.com/spf13/cobra" ) diff --git a/pkg/cmd/build/new.go b/pkg/cmd/build/new.go index 8bb3edce..4f3e020b 100644 --- a/pkg/cmd/build/new.go +++ b/pkg/cmd/build/new.go @@ -14,7 +14,7 @@ import ( "github.com/buildkite/cli/v3/internal/util" "github.com/buildkite/cli/v3/internal/validation/scopes" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/charmbracelet/huh/spinner" "github.com/spf13/cobra" "github.com/spf13/pflag" diff --git a/pkg/cmd/build/rebuild.go b/pkg/cmd/build/rebuild.go index 248c9c81..35bf0352 100644 --- a/pkg/cmd/build/rebuild.go +++ b/pkg/cmd/build/rebuild.go @@ -11,7 +11,7 @@ import ( "github.com/buildkite/cli/v3/internal/util" "github.com/buildkite/cli/v3/internal/validation/scopes" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/charmbracelet/huh/spinner" "github.com/spf13/cobra" ) diff --git a/pkg/cmd/build/view.go b/pkg/cmd/build/view.go index c4e6fe59..acd63115 100644 --- a/pkg/cmd/build/view.go +++ b/pkg/cmd/build/view.go @@ -10,7 +10,7 @@ import ( "github.com/buildkite/cli/v3/internal/build/view" pipelineResolver "github.com/buildkite/cli/v3/internal/pipeline/resolver" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/charmbracelet/huh/spinner" "github.com/pkg/browser" "github.com/spf13/cobra" diff --git a/pkg/cmd/cluster/list.go b/pkg/cmd/cluster/list.go index 4b1c5bee..aca09ffd 100644 --- a/pkg/cmd/cluster/list.go +++ b/pkg/cmd/cluster/list.go @@ -10,7 +10,7 @@ import ( "github.com/MakeNowJust/heredoc" "github.com/buildkite/cli/v3/internal/cluster" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/spf13/cobra" ) diff --git a/pkg/cmd/cluster/view.go b/pkg/cmd/cluster/view.go index 27bdb208..f175fb5f 100644 --- a/pkg/cmd/cluster/view.go +++ b/pkg/cmd/cluster/view.go @@ -10,7 +10,7 @@ import ( "github.com/MakeNowJust/heredoc" "github.com/buildkite/cli/v3/pkg/cmd/factory" "github.com/buildkite/cli/v3/pkg/output" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/charmbracelet/huh/spinner" "github.com/charmbracelet/lipgloss" "github.com/spf13/cobra" diff --git a/pkg/cmd/configure/configure.go b/pkg/cmd/configure/configure.go index fc5f1690..6d1c1564 100644 --- a/pkg/cmd/configure/configure.go +++ b/pkg/cmd/configure/configure.go @@ -23,7 +23,7 @@ func NewCmdConfigure(f *factory.Factory) *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { // if the token already exists and --force is not used if !force && f.Config.APIToken() != "" { - return errors.New("API token already configured. You must use --force.") + return errors.New("API token already configured. You must use --force") } // If flags are provided, use them directly diff --git a/pkg/cmd/factory/factory.go b/pkg/cmd/factory/factory.go index deed2206..8c8ac966 100644 --- a/pkg/cmd/factory/factory.go +++ b/pkg/cmd/factory/factory.go @@ -7,8 +7,8 @@ import ( "github.com/Khan/genqlient/graphql" "github.com/buildkite/cli/v3/internal/config" "github.com/buildkite/cli/v3/internal/version" - "github.com/buildkite/go-buildkite/v4" - "github.com/go-git/go-git/v5" + buildkite "github.com/buildkite/go-buildkite/v4" + git "github.com/go-git/go-git/v5" ) var userAgent string diff --git a/pkg/cmd/pipeline/create.go b/pkg/cmd/pipeline/create.go index bdcebf12..93b250ec 100644 --- a/pkg/cmd/pipeline/create.go +++ b/pkg/cmd/pipeline/create.go @@ -4,10 +4,10 @@ import ( "context" "fmt" - "github.com/AlecAivazis/survey/v2" + survey "github.com/AlecAivazis/survey/v2" "github.com/MakeNowJust/heredoc" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/charmbracelet/huh/spinner" "github.com/charmbracelet/lipgloss" "github.com/spf13/cobra" diff --git a/pkg/cmd/pkg/push.go b/pkg/cmd/pkg/push.go index 693eef4e..ec10a931 100644 --- a/pkg/cmd/pkg/push.go +++ b/pkg/cmd/pkg/push.go @@ -10,7 +10,7 @@ import ( bk_io "github.com/buildkite/cli/v3/internal/io" "github.com/buildkite/cli/v3/internal/util" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/spf13/cobra" "github.com/spf13/pflag" ) @@ -39,8 +39,8 @@ func NewCmdPackagePush(f *factory.Factory) *cobra.Command { $ bk package push my-registry my-package.tar.gz $ cat my-package.tar.gz | bk package push my-registry --stdin-file-name my-package.tar.gz - # Pass package via stdin, note hyphen as the argument - - # add -w to open the build in your web browser + + # add -w to open the build in your web browser $ bk package push my-registry my-package.tar.gz -w `), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/pkg/cmd/pkg/push_test.go b/pkg/cmd/pkg/push_test.go index 9d2e3438..56d9c0c1 100644 --- a/pkg/cmd/pkg/push_test.go +++ b/pkg/cmd/pkg/push_test.go @@ -12,7 +12,7 @@ import ( "github.com/buildkite/cli/v3/internal/config" "github.com/buildkite/cli/v3/pkg/cmd/factory" - "github.com/buildkite/go-buildkite/v4" + buildkite "github.com/buildkite/go-buildkite/v4" "github.com/spf13/afero" "github.com/spf13/cobra" ) diff --git a/pkg/cmd/use/use.go b/pkg/cmd/use/use.go index 137ef624..002227c8 100644 --- a/pkg/cmd/use/use.go +++ b/pkg/cmd/use/use.go @@ -55,5 +55,5 @@ func useRun(org *string, conf *config.Config) error { } // if the selected org doesnt exist, recommend configuring it and error out - return fmt.Errorf("No configuration found for `%s`. Run `bk configure` to add it.", selected) + return fmt.Errorf("no configuration found for `%s`. run `bk configure` to add it", selected) } diff --git a/pkg/cmd/validation/config.go b/pkg/cmd/validation/config.go index 4e4b7a4c..e05a5a63 100644 --- a/pkg/cmd/validation/config.go +++ b/pkg/cmd/validation/config.go @@ -42,7 +42,7 @@ func CheckValidConfiguration(conf *config.Config) func(cmd *cobra.Command, args // ensure the configuration has an API token set if conf.APIToken() == "" || conf.OrganizationSlug() == "" { - err = errors.New("You must set a valid API token. Run `bk configure`.") + err = errors.New("you must set a valid API token. run `bk configure`") } return func(cmd *cobra.Command, args []string) error {