diff --git a/go.mod b/go.mod index d87d98a2..cfa26d7e 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/goccy/go-yaml v1.12.0 github.com/golang/mock v1.6.0 github.com/guptarohit/asciigraph v0.7.1 - github.com/hetznercloud/hcloud-go/v2 v2.10.2 + github.com/hetznercloud/hcloud-go/v2 v2.11.0 github.com/jedib0t/go-pretty/v6 v6.5.9 github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.1 @@ -52,7 +52,7 @@ require ( go.uber.org/multierr v1.9.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.26.0 // indirect + golang.org/x/net v0.27.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect diff --git a/go.sum b/go.sum index e0d327a0..2f1f6b05 100644 --- a/go.sum +++ b/go.sum @@ -41,8 +41,8 @@ github.com/guptarohit/asciigraph v0.7.1 h1:K+JWbRc04XEfv8BSZgNuvhCmpbvX4+9NYd/Ux github.com/guptarohit/asciigraph v0.7.1/go.mod h1:dYl5wwK4gNsnFf9Zp+l06rFiDZ5YtXM6x7SRWZ3KGag= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hetznercloud/hcloud-go/v2 v2.10.2 h1:9gyTUPhfNbfbS40Spgij5mV5k37bOZgt8iHKCbfGs5I= -github.com/hetznercloud/hcloud-go/v2 v2.10.2/go.mod h1:xQ+8KhIS62W0D78Dpi57jsufWh844gUw1az5OUvaeq8= +github.com/hetznercloud/hcloud-go/v2 v2.11.0 h1:U1wD58/trMnKO6aHy2i2aguT5USwWbzC2hWj3r2sidE= +github.com/hetznercloud/hcloud-go/v2 v2.11.0/go.mod h1:dhix40Br3fDiBhwaSG/zgaYOFFddpfBm/6R1Zz0IiF0= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+UV8OU= @@ -131,8 +131,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/internal/cmd/base/delete.go b/internal/cmd/base/delete.go index d1fb37cd..ea6b00fe 100644 --- a/internal/cmd/base/delete.go +++ b/internal/cmd/base/delete.go @@ -12,6 +12,7 @@ import ( "github.com/hetznercloud/cli/internal/hcapi2" "github.com/hetznercloud/cli/internal/state" "github.com/hetznercloud/hcloud-go/v2/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud/exp/kit/sliceutil" ) // DeleteCmd allows defining commands for deleting a resource. @@ -58,7 +59,7 @@ func (dc *DeleteCmd) Run(s state.State, cmd *cobra.Command, args []string) error errs := make([]error, 0, len(args)) deleted := make([]string, 0, len(args)) - for _, batch := range util.Batches(args, deleteBatchSize) { + for _, batch := range sliceutil.Batches(args, deleteBatchSize) { results := make([]util.ResourceState, len(batch)) actions := make([]*hcloud.Action, 0, len(batch)) diff --git a/internal/cmd/server/create.go b/internal/cmd/server/create.go index 15a2c305..62d5c833 100644 --- a/internal/cmd/server/create.go +++ b/internal/cmd/server/create.go @@ -20,7 +20,7 @@ import ( "github.com/hetznercloud/cli/internal/state" "github.com/hetznercloud/cli/internal/state/config" "github.com/hetznercloud/hcloud-go/v2/hcloud" - "github.com/hetznercloud/hcloud-go/v2/hcloud/exp/actionutils" + "github.com/hetznercloud/hcloud-go/v2/hcloud/exp/actionutil" "github.com/hetznercloud/hcloud-go/v2/hcloud/schema" ) @@ -109,7 +109,7 @@ var CreateCmd = base.CreateCmd{ return nil, nil, err } - if err := s.WaitForActions(cmd, s, actionutils.AppendNext(result.Action, result.NextActions)...); err != nil { + if err := s.WaitForActions(cmd, s, actionutil.AppendNext(result.Action, result.NextActions)...); err != nil { return nil, nil, err } diff --git a/internal/cmd/util/slices.go b/internal/cmd/util/slices.go deleted file mode 100644 index 924565e9..00000000 --- a/internal/cmd/util/slices.go +++ /dev/null @@ -1,8 +0,0 @@ -package util - -func Batches[T any](all []T, size int) (batches [][]T) { - for size < len(all) { - all, batches = all[size:], append(batches, all[:size]) - } - return append(batches, all) -} diff --git a/internal/cmd/util/slices_test.go b/internal/cmd/util/slices_test.go deleted file mode 100644 index dc176fe7..00000000 --- a/internal/cmd/util/slices_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package util - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestBatches(t *testing.T) { - all := []int{1, 2, 3, 4, 5} - batches := Batches(all, 2) - - assert.Len(t, batches, 3) - assert.Equal(t, []int{1, 2}, batches[0]) - assert.Equal(t, []int{3, 4}, batches[1]) - assert.Equal(t, []int{5}, batches[2]) -} diff --git a/internal/cmd/volume/create.go b/internal/cmd/volume/create.go index 3eeef94e..39873ca1 100644 --- a/internal/cmd/volume/create.go +++ b/internal/cmd/volume/create.go @@ -12,7 +12,7 @@ import ( "github.com/hetznercloud/cli/internal/hcapi2" "github.com/hetznercloud/cli/internal/state" "github.com/hetznercloud/hcloud-go/v2/hcloud" - "github.com/hetznercloud/hcloud-go/v2/hcloud/exp/actionutils" + "github.com/hetznercloud/hcloud-go/v2/hcloud/exp/actionutil" ) var CreateCmd = base.CreateCmd{ @@ -98,7 +98,7 @@ var CreateCmd = base.CreateCmd{ return nil, nil, err } - if err := s.WaitForActions(cmd, s, actionutils.AppendNext(result.Action, result.NextActions)...); err != nil { + if err := s.WaitForActions(cmd, s, actionutil.AppendNext(result.Action, result.NextActions)...); err != nil { return nil, nil, err } cmd.Printf("Volume %d created\n", result.Volume.ID)