Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .buildkite/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
19 changes: 19 additions & 0 deletions .golangci.bck.yaml
Original file line number Diff line number Diff line change
@@ -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: .*"
37 changes: 28 additions & 9 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -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$
2 changes: 1 addition & 1 deletion generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))},
}

Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
)
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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=
Expand All @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion internal/agent/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/agent/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/annotation/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/artifact/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/build/resolver/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/build/resolver/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/build/resolver/with_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/build/view/shared/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/build/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/cluster/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion internal/cluster/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/job/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/pipeline/resolver/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions internal/pipeline/resolver/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/pipeline/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
4 changes: 2 additions & 2 deletions internal/ui/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"time"

"github.com/buildkite/go-buildkite/v4"
buildkite "github.com/buildkite/go-buildkite/v4"
"github.com/charmbracelet/lipgloss"
)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/ui/ui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/agent/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/agent/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/agent/stop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/agent/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading