diff --git a/go.mod b/go.mod index c7533ea..3ce6567 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,8 @@ go 1.25.0 require ( github.com/goccy/go-yaml v1.19.2 - github.com/hetznercloud/hcloud-go/v2 v2.37.0 - github.com/onsi/ginkgo/v2 v2.28.1 + github.com/hetznercloud/hcloud-go/v2 v2.38.0 + github.com/onsi/ginkgo/v2 v2.28.2 github.com/onsi/gomega v1.39.1 golang.org/x/net v0.53.0 golang.org/x/time v0.15.0 diff --git a/go.sum b/go.sum index c914237..b2400de 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 h1:z2ogiKUYzX5Is6zr/vP9vJGqPwcdqsWjOt+V8J7+bTc= github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= -github.com/hetznercloud/hcloud-go/v2 v2.37.0 h1:PMnuOA8pL8aHLLPp6nnnCTo2Xk2tqu4dAfYsC3bWdT0= -github.com/hetznercloud/hcloud-go/v2 v2.37.0/go.mod h1:zaDOCKmpnI86ftoCpUpaiYaw9Wew1ib1AcXTh96deYI= +github.com/hetznercloud/hcloud-go/v2 v2.38.0 h1:bJL4O5Zd8iF+vDRzeAbmsMcxKhn/sf/HUtu2jl/bFl0= +github.com/hetznercloud/hcloud-go/v2 v2.38.0/go.mod h1:BHmbGdh59t0CazoUEFvbdp6PyV+gwnF0fl9D4Bdgqq0= github.com/joshdk/go-junit v1.0.0 h1:S86cUKIdwBHWwA6xCmFlf3RTLfVXYQfvanM5Uh+K6GE= github.com/joshdk/go-junit v1.0.0/go.mod h1:TiiV0PqkaNfFXjEiyjWM3XXrhVyCa1K4Zfga6W52ung= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= @@ -40,8 +40,8 @@ github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3v github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.28.1 h1:S4hj+HbZp40fNKuLUQOYLDgZLwNUVn19N3Atb98NCyI= -github.com/onsi/ginkgo/v2 v2.28.1/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE= +github.com/onsi/ginkgo/v2 v2.28.2 h1:DTrMfpqxiNUyQ3Y0zhn1n3cOO2euFgQPYIpkWwxVFps= +github.com/onsi/ginkgo/v2 v2.28.2/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE= github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28= github.com/onsi/gomega v1.39.1/go.mod h1:hL6yVALoTOxeWudERyfppUcZXjMwIMLnuSfruD2lcfg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/datacenter.go b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/datacenter.go index 9fe517d..41311af 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/datacenter.go +++ b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/datacenter.go @@ -16,10 +16,16 @@ type Datacenter struct { Name string Description string Location *Location + + // Deprecated: [Datacenter.ServerTypes] is deprecated and will not be returned after 2026-10-01. + // Use [ServerType.Locations] instead. ServerTypes DatacenterServerTypes } // DatacenterServerTypes represents the server types available and supported in a datacenter. +// +// Deprecated: [DatacenterServerTypes] is deprecated and will not be returned after 2026-10-01. +// Use [ServerType.Locations] instead. type DatacenterServerTypes struct { Supported []*ServerType AvailableForMigration []*ServerType diff --git a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/hcloud.go b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/hcloud.go index c3c7448..975d866 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/hcloud.go +++ b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/hcloud.go @@ -80,4 +80,4 @@ breaking changes. package hcloud // Version is the library's version following Semantic Versioning. -const Version = "2.37.0" // x-releaser-pleaser-version +const Version = "2.38.0" // x-releaser-pleaser-version diff --git a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema.go b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema.go index 541d3d7..7af4a5e 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema.go +++ b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema.go @@ -99,6 +99,10 @@ func SchemaFromDatacenter(d *Datacenter) schema.Datacenter { return c.SchemaFromDatacenter(d) } +func schemaFromDatacenterServerTypes(dst DatacenterServerTypes) schema.DatacenterServerTypes { + return c.schemaFromDatacenterServerTypes(dst) +} + // ServerFromSchema converts a schema.Server to a Server. func ServerFromSchema(s schema.Server) *Server { return c.ServerFromSchema(s) diff --git a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema/datacenter.go b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema/datacenter.go index 54590d2..b9020fd 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema/datacenter.go +++ b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema/datacenter.go @@ -2,14 +2,20 @@ package schema // Datacenter defines the schema of a datacenter. type Datacenter struct { - ID int64 `json:"id"` - Name string `json:"name"` - Description string `json:"description"` - Location Location `json:"location"` - ServerTypes DatacenterServerTypes `json:"server_types"` + ID int64 `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Location Location `json:"location"` + + // Deprecated: [Datacenter.ServerTypes] is deprecated and will not be returned after 2026-10-01. + // Use [ServerType.Locations] instead. + ServerTypes *DatacenterServerTypes `json:"server_types,omitempty"` } // DatacenterServerTypes defines the schema of the server types available in a datacenter. +// +// Deprecated: [DatacenterServerTypes] is deprecated and will not be returned after 2026-10-01. +// Use [ServerType.Locations] instead. type DatacenterServerTypes struct { Supported []int64 `json:"supported"` AvailableForMigration []int64 `json:"available_for_migration"` diff --git a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema/server_type.go b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema/server_type.go index bed3ef9..7091e52 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema/server_type.go +++ b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema/server_type.go @@ -29,8 +29,10 @@ type ServerType struct { } type ServerTypeLocation struct { - ID int64 `json:"id"` - Name string `json:"name"` + ID int64 `json:"id"` + Name string `json:"name"` + Recommended bool `json:"recommended"` + Available bool `json:"available"` DeprecatableResource } diff --git a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema_gen.go b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema_gen.go index 853159e..b2395c1 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema_gen.go +++ b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/schema_gen.go @@ -84,6 +84,7 @@ You can find a documentation of goverter here: https://goverter.jmattheis.de/ // goverter:extend int64SlicePtrFromCertificatePtrSlice // goverter:extend stringSlicePtrFromStringSlice // goverter:extend locationFromServerTypeLocationSchema +// goverter:extend schemaPtrFromDatacenterServerTypes type converter interface { // goverter:map Error.Code ErrorCode @@ -136,6 +137,8 @@ type converter interface { SchemaFromDatacenter(*Datacenter) schema.Datacenter + schemaFromDatacenterServerTypes(DatacenterServerTypes) schema.DatacenterServerTypes + ServerFromSchema(schema.Server) *Server // goverter:map OutgoingTraffic | mapZeroUint64ToNil @@ -1124,3 +1127,12 @@ func mapStorageBoxIntPtrToWeekdayPtr(i *int) *time.Weekday { return Ptr(time.Weekday(*i)) } + +// hcloud.DatacenterServerTypes is not nullable but *schema.DatacenterServerTypes is. +// We treat the zero value as nil. +func schemaPtrFromDatacenterServerTypes(dst DatacenterServerTypes) *schema.DatacenterServerTypes { + if dst.Available == nil && dst.AvailableForMigration == nil && dst.Supported == nil { + return nil + } + return Ptr(schemaFromDatacenterServerTypes(dst)) +} diff --git a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/server_type.go b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/server_type.go index cdd8716..2fd1989 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/server_type.go +++ b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/server_type.go @@ -58,7 +58,9 @@ const ( ) type ServerTypeLocation struct { - Location *Location + Location *Location + Available bool + Recommended bool DeprecatableResource } diff --git a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/zz_schema.go b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/zz_schema.go index 2c18a8e..8293c27 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/zz_schema.go +++ b/vendor/github.com/hetznercloud/hcloud-go/v2/hcloud/zz_schema.go @@ -78,7 +78,7 @@ func (c *converterImpl) DatacenterFromSchema(source schema.Datacenter) *Datacent hcloudDatacenter.Name = source.Name hcloudDatacenter.Description = source.Description hcloudDatacenter.Location = c.LocationFromSchema(source.Location) - hcloudDatacenter.ServerTypes = c.schemaDatacenterServerTypesToHcloudDatacenterServerTypes(source.ServerTypes) + hcloudDatacenter.ServerTypes = c.pSchemaDatacenterServerTypesToHcloudDatacenterServerTypes(source.ServerTypes) return &hcloudDatacenter } func (c *converterImpl) DeprecationFromSchema(source *schema.DeprecationInfo) *DeprecationInfo { @@ -515,7 +515,7 @@ func (c *converterImpl) SchemaFromDatacenter(source *Datacenter) schema.Datacent schemaDatacenter.Name = (*source).Name schemaDatacenter.Description = (*source).Description schemaDatacenter.Location = c.SchemaFromLocation((*source).Location) - schemaDatacenter.ServerTypes = c.hcloudDatacenterServerTypesToSchemaDatacenterServerTypes((*source).ServerTypes) + schemaDatacenter.ServerTypes = schemaPtrFromDatacenterServerTypes((*source).ServerTypes) } return schemaDatacenter } @@ -1788,28 +1788,6 @@ func (c *converterImpl) hcloudCertificateUsedByRefToSchemaCertificateUsedByRef(s schemaCertificateUsedByRef.Type = string(source.Type) return schemaCertificateUsedByRef } -func (c *converterImpl) hcloudDatacenterServerTypesToSchemaDatacenterServerTypes(source DatacenterServerTypes) schema.DatacenterServerTypes { - var schemaDatacenterServerTypes schema.DatacenterServerTypes - if source.Supported != nil { - schemaDatacenterServerTypes.Supported = make([]int64, len(source.Supported)) - for i := 0; i < len(source.Supported); i++ { - schemaDatacenterServerTypes.Supported[i] = int64FromServerType(source.Supported[i]) - } - } - if source.AvailableForMigration != nil { - schemaDatacenterServerTypes.AvailableForMigration = make([]int64, len(source.AvailableForMigration)) - for j := 0; j < len(source.AvailableForMigration); j++ { - schemaDatacenterServerTypes.AvailableForMigration[j] = int64FromServerType(source.AvailableForMigration[j]) - } - } - if source.Available != nil { - schemaDatacenterServerTypes.Available = make([]int64, len(source.Available)) - for k := 0; k < len(source.Available); k++ { - schemaDatacenterServerTypes.Available[k] = int64FromServerType(source.Available[k]) - } - } - return schemaDatacenterServerTypes -} func (c *converterImpl) hcloudDeprecatableResourceToSchemaDeprecatableResource(source DeprecatableResource) schema.DeprecatableResource { var schemaDeprecatableResource schema.DeprecatableResource schemaDeprecatableResource.Deprecation = c.SchemaFromDeprecation(source.Deprecation) @@ -2143,7 +2121,7 @@ func (c *converterImpl) pHcloudDatacenterToPSchemaDatacenter(source *Datacenter) schemaDatacenter.Name = (*source).Name schemaDatacenter.Description = (*source).Description schemaDatacenter.Location = c.SchemaFromLocation((*source).Location) - schemaDatacenter.ServerTypes = c.hcloudDatacenterServerTypesToSchemaDatacenterServerTypes((*source).ServerTypes) + schemaDatacenter.ServerTypes = schemaPtrFromDatacenterServerTypes((*source).ServerTypes) pSchemaDatacenter = &schemaDatacenter } return pSchemaDatacenter @@ -2573,6 +2551,30 @@ func (c *converterImpl) pSchemaCertificateStatusRefToPHcloudCertificateStatus(so } return pHcloudCertificateStatus } +func (c *converterImpl) pSchemaDatacenterServerTypesToHcloudDatacenterServerTypes(source *schema.DatacenterServerTypes) DatacenterServerTypes { + var hcloudDatacenterServerTypes DatacenterServerTypes + if source != nil { + if (*source).Supported != nil { + hcloudDatacenterServerTypes.Supported = make([]*ServerType, len((*source).Supported)) + for i := 0; i < len((*source).Supported); i++ { + hcloudDatacenterServerTypes.Supported[i] = serverTypeFromInt64((*source).Supported[i]) + } + } + if (*source).AvailableForMigration != nil { + hcloudDatacenterServerTypes.AvailableForMigration = make([]*ServerType, len((*source).AvailableForMigration)) + for j := 0; j < len((*source).AvailableForMigration); j++ { + hcloudDatacenterServerTypes.AvailableForMigration[j] = serverTypeFromInt64((*source).AvailableForMigration[j]) + } + } + if (*source).Available != nil { + hcloudDatacenterServerTypes.Available = make([]*ServerType, len((*source).Available)) + for k := 0; k < len((*source).Available); k++ { + hcloudDatacenterServerTypes.Available[k] = serverTypeFromInt64((*source).Available[k]) + } + } + } + return hcloudDatacenterServerTypes +} func (c *converterImpl) pSchemaDatacenterToPHcloudDatacenter(source *schema.Datacenter) *Datacenter { var pHcloudDatacenter *Datacenter if source != nil { @@ -2581,7 +2583,7 @@ func (c *converterImpl) pSchemaDatacenterToPHcloudDatacenter(source *schema.Data hcloudDatacenter.Name = (*source).Name hcloudDatacenter.Description = (*source).Description hcloudDatacenter.Location = c.LocationFromSchema((*source).Location) - hcloudDatacenter.ServerTypes = c.schemaDatacenterServerTypesToHcloudDatacenterServerTypes((*source).ServerTypes) + hcloudDatacenter.ServerTypes = c.pSchemaDatacenterServerTypesToHcloudDatacenterServerTypes((*source).ServerTypes) pHcloudDatacenter = &hcloudDatacenter } return pHcloudDatacenter @@ -2759,28 +2761,6 @@ func (c *converterImpl) schemaCertificateUsedByRefToHcloudCertificateUsedByRef(s hcloudCertificateUsedByRef.Type = CertificateUsedByRefType(source.Type) return hcloudCertificateUsedByRef } -func (c *converterImpl) schemaDatacenterServerTypesToHcloudDatacenterServerTypes(source schema.DatacenterServerTypes) DatacenterServerTypes { - var hcloudDatacenterServerTypes DatacenterServerTypes - if source.Supported != nil { - hcloudDatacenterServerTypes.Supported = make([]*ServerType, len(source.Supported)) - for i := 0; i < len(source.Supported); i++ { - hcloudDatacenterServerTypes.Supported[i] = serverTypeFromInt64(source.Supported[i]) - } - } - if source.AvailableForMigration != nil { - hcloudDatacenterServerTypes.AvailableForMigration = make([]*ServerType, len(source.AvailableForMigration)) - for j := 0; j < len(source.AvailableForMigration); j++ { - hcloudDatacenterServerTypes.AvailableForMigration[j] = serverTypeFromInt64(source.AvailableForMigration[j]) - } - } - if source.Available != nil { - hcloudDatacenterServerTypes.Available = make([]*ServerType, len(source.Available)) - for k := 0; k < len(source.Available); k++ { - hcloudDatacenterServerTypes.Available[k] = serverTypeFromInt64(source.Available[k]) - } - } - return hcloudDatacenterServerTypes -} func (c *converterImpl) schemaDeprecatableResourceToHcloudDeprecatableResource(source schema.DeprecatableResource) DeprecatableResource { var hcloudDeprecatableResource DeprecatableResource hcloudDeprecatableResource.Deprecation = c.DeprecationFromSchema(source.Deprecation) @@ -2824,6 +2804,28 @@ func (c *converterImpl) schemaFloatingIPProtectionToHcloudFloatingIPProtection(s hcloudFloatingIPProtection.Delete = source.Delete return hcloudFloatingIPProtection } +func (c *converterImpl) schemaFromDatacenterServerTypes(source DatacenterServerTypes) schema.DatacenterServerTypes { + var schemaDatacenterServerTypes schema.DatacenterServerTypes + if source.Supported != nil { + schemaDatacenterServerTypes.Supported = make([]int64, len(source.Supported)) + for i := 0; i < len(source.Supported); i++ { + schemaDatacenterServerTypes.Supported[i] = int64FromServerType(source.Supported[i]) + } + } + if source.AvailableForMigration != nil { + schemaDatacenterServerTypes.AvailableForMigration = make([]int64, len(source.AvailableForMigration)) + for j := 0; j < len(source.AvailableForMigration); j++ { + schemaDatacenterServerTypes.AvailableForMigration[j] = int64FromServerType(source.AvailableForMigration[j]) + } + } + if source.Available != nil { + schemaDatacenterServerTypes.Available = make([]int64, len(source.Available)) + for k := 0; k < len(source.Available); k++ { + schemaDatacenterServerTypes.Available[k] = int64FromServerType(source.Available[k]) + } + } + return schemaDatacenterServerTypes +} func (c *converterImpl) schemaFromFloatingIPPricing(source FloatingIPPricing) schema.PricingFloatingIP { var schemaPricingFloatingIP schema.PricingFloatingIP schemaPricingFloatingIP.PriceMonthly = c.hcloudPriceToSchemaPrice(source.Monthly) @@ -2910,6 +2912,8 @@ func (c *converterImpl) schemaFromServerTypeLocation(source ServerTypeLocation) if pString != nil { schemaServerTypeLocation.Name = *pString } + schemaServerTypeLocation.Recommended = source.Recommended + schemaServerTypeLocation.Available = source.Available schemaServerTypeLocation.DeprecatableResource = c.hcloudDeprecatableResourceToSchemaDeprecatableResource(source.DeprecatableResource) return schemaServerTypeLocation } @@ -3102,6 +3106,8 @@ func (c *converterImpl) schemaZoneRRSetRecordToHcloudZoneRRSetRecord(source sche func (c *converterImpl) serverTypeLocationFromSchema(source schema.ServerTypeLocation) ServerTypeLocation { var hcloudServerTypeLocation ServerTypeLocation hcloudServerTypeLocation.Location = locationFromServerTypeLocationSchema(source) + hcloudServerTypeLocation.Available = source.Available + hcloudServerTypeLocation.Recommended = source.Recommended hcloudServerTypeLocation.DeprecatableResource = c.schemaDeprecatableResourceToHcloudDeprecatableResource(source.DeprecatableResource) return hcloudServerTypeLocation } diff --git a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md index 70050f3..2233136 100644 --- a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md +++ b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md @@ -1,3 +1,12 @@ +## 2.28.2 + +- Add ArtifactDir() to support Go 1.26 testing.TB interface [f3a36b6] +- Implement shell completion [94151c8] +- Add asan CLI option mirroring msan implementation [4d21dbb] +- Bump uri from 1.0.3 to 1.0.4 in /docs (#1630) [c102161] +- fix aspect ratio [9619647] +- update logos [5779304] + ## 2.28.1 Update all dependencies. This auto-updated the required version of Go to 1.24, consistent with the fact that Go 1.23 has been out of support for almost six months. diff --git a/vendor/github.com/onsi/ginkgo/v2/README.md b/vendor/github.com/onsi/ginkgo/v2/README.md index b4c3ce0..6d36e37 100644 --- a/vendor/github.com/onsi/ginkgo/v2/README.md +++ b/vendor/github.com/onsi/ginkgo/v2/README.md @@ -120,6 +120,6 @@ Sponsors commit to a [sponsorship](https://github.com/sponsors/onsi) for a year.

Browser testing via - +

diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/command/program.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/command/program.go index c3f6d3a..5311490 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/command/program.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/command/program.go @@ -1,9 +1,13 @@ package command import ( + "bufio" "fmt" "io" + "maps" "os" + "path/filepath" + "slices" "strings" "github.com/onsi/ginkgo/v2/formatter" @@ -158,6 +162,166 @@ func (p Program) handleHelpRequestsAndExit(writer io.Writer, args []string) { } } +type completionOptions = struct { + Complete bool + Install bool +} + +func (p *Program) BuildCompletionCommand() Command { + opts := completionOptions{} + flags, err := types.NewGinkgoFlagSet( + types.GinkgoFlags{ + {Name: "complete", KeyPath: "Complete", Usage: "Generate completion for arguments after --"}, + {Name: "install", KeyPath: "Install", Usage: "Install shell completion script into $XDG_DATA_HOME, ~/.local/share"}, + }, + &opts, + types.GinkgoFlagSections{}, + ) + if err != nil { + panic(err) + } + return Command{ + Name: "completion", + Usage: "ginkgo completion [-- ]", + Flags: flags, + ShortDoc: "Generate shell completion", + Documentation: `To use install completion script for your shell (bash, fish, zsh). +Or load completion code by: {{bold}}source <(ginkgo completion ){{/}}.`, + Command: func(args []string, completeArgs []string) { + p.handleCompletionAndExit(args, completeArgs, opts) + }, + } +} + +func (p Program) generateShellCompletionScript(shell string) (scriptPath string, script string) { + switch shell { + case "bash": + scriptPath = fmt.Sprintf("bash-completion/completions/%s", p.Name) + script = fmt.Sprintf(`__%s_complete_bash() { + mapfile -t COMPREPLY < <("${COMP_WORDS[0]}" completion --complete bash -- "${COMP_WORDS[@]:1:COMP_CWORD}") +} +complete -o bashdefault -o default -F __%[1]s_complete_bash %[1]s +`, p.Name) + + case "fish": + scriptPath = fmt.Sprintf("fish/vendor_completions.d/%s.fish", p.Name) + script = fmt.Sprintf(`function __fish_%[1]s_complete + set -l args (commandline -opc) (commandline -ct) + set -e args[1] + %[1]s completion --complete fish -- $args +end +complete -c %[1]s -a "(__fish_%[1]s_complete)" +`, p.Name) + + case "zsh": + scriptPath = fmt.Sprintf("zsh/site-functions/_%s", p.Name) + script = fmt.Sprintf(`#compdef %[1]s +_%[1]s() { + local -a completions + completions=(${(f)"$("${words[1]}" completion --complete zsh -- "${words[@]:1:$((CURRENT-1))}")"}) + if (( ${#completions[@]} )); then + _describe 'completions' completions + else + _default + fi +} +compdef _%[1]s %[1]s +if [ "$funcstack[1]" = "_%[1]s" ]; then + _%[1]s +fi +`, p.Name) + + case "": + AbortWithUsage("Shell is not specified") + default: + AbortWith("Shell %q is not supported yet. Choose: bash, fish, zsh", shell) + } + + return scriptPath, script +} + +func (p Program) handleCompletionAndExit(args, completeArgs []string, opts completionOptions) { + writer := p.OutWriter + if writer == nil { + writer = os.Stdout + } + buffer := bufio.NewWriter(writer) + defer buffer.Flush() + + var shell string + if len(args) > 0 { + shell = args[0] + } + + if !opts.Complete { + scriptPath, script := p.generateShellCompletionScript(shell) + if opts.Install { + dataHomeDir := os.Getenv("XDG_DATA_HOME") + if dataHomeDir == "" { + userHomeDir, err := os.UserHomeDir() + AbortIfError("Failed to find home", err) + dataHomeDir = filepath.Join(userHomeDir, ".local/share") + } + scriptPath = filepath.Join(dataHomeDir, scriptPath) + fmt.Fprintf(buffer, "Installing completion script: %v\n", scriptPath) + err := os.WriteFile(scriptPath, []byte(script), 0644) + AbortIfError("Failed to install completion script", err) + } else { + buffer.Write([]byte(script)) + } + Abort(AbortDetails{}) + } + + var lastArg string + var result map[string]string + if len(completeArgs) > 0 { + lastArg = completeArgs[len(completeArgs)-1] + } + + if delim := slices.Index(completeArgs, "--"); delim >= 0 && delim != len(completeArgs)-1 { + // No completion for pass-through arguments after "--" + } else if len(lastArg) > 0 && lastArg[0] == '-' { + // Complete flags + cmd := &p.DefaultCommand + for i := range p.Commands { + if p.Commands[i].Name == completeArgs[0] { + cmd = &p.Commands[i] + break + } + } + result = cmd.Flags.Completion(lastArg) + } else if len(completeArgs) <= 1 { + // Complete commands + result = make(map[string]string, len(p.Commands)+1) + for _, cmd := range append(p.Commands, p.DefaultCommand) { + if strings.HasPrefix(cmd.Name, lastArg) { + result[cmd.Name] = cmd.Usage + } + } + } + + width := 0 + for suggest := range result { + width = max(width, len(suggest)) + } + + for _, suggest := range slices.Sorted(maps.Keys(result)) { + usage := result[suggest] + switch { + case shell == "bash" && usage != "" && len(result) > 1: + fmt.Fprintf(buffer, "%*s (%s)\n", -width-2, suggest, usage) + case shell == "fish": + fmt.Fprintf(buffer, "%s\t%s\n", suggest, usage) + case shell == "zsh": + fmt.Fprintf(buffer, "%s:%s\n", suggest, usage) + default: + fmt.Fprintln(buffer, suggest) + } + } + + Abort(AbortDetails{}) +} + func (p Program) EmitUsage(writer io.Writer) { fmt.Fprintln(writer, formatter.F(p.Heading)) fmt.Fprintln(writer, formatter.F("{{gray}}%s{{/}}", strings.Repeat("-", len(p.Heading)))) diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/main.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/main.go index 419589b..596c210 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/main.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/main.go @@ -41,6 +41,7 @@ func main() { {Name: "nodot", Deprecation: types.Deprecations.Nodot()}, }, } + program.Commands = append(program.Commands, program.BuildCompletionCommand()) program.RunAndExit(os.Args) } diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo_t_dsl.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo_t_dsl.go index 40d1e1a..db3e248 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo_t_dsl.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo_t_dsl.go @@ -72,6 +72,7 @@ type GinkgoTInterface interface { TempDir() string Attr(key, value string) Output() io.Writer + ArtifactDir() string } /* @@ -196,3 +197,6 @@ func (g *GinkgoTBWrapper) Attr(key, value string) { func (g *GinkgoTBWrapper) Output() io.Writer { return g.GinkgoT.Output() } +func (g *GinkgoTBWrapper) ArtifactDir() string { + return g.GinkgoT.ArtifactDir() +} diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go b/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go index 5704f0f..e6fbaee 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go @@ -181,6 +181,15 @@ func (t *ginkgoTestingTProxy) TempDir() string { return tmpDir } +func (t *ginkgoTestingTProxy) ArtifactDir() string { + artifactDir, err := os.MkdirTemp("", "ginkgo") + if err != nil { + t.fail(fmt.Sprintf("Failed to create artifact directory: %v", err), 1) + return "" + } + return artifactDir +} + // FullGinkgoTInterface func (t *ginkgoTestingTProxy) AddReportEntryVisibilityAlways(name string, args ...any) { finalArgs := []any{internal.Offset(1), types.ReportEntryVisibilityAlways} diff --git a/vendor/github.com/onsi/ginkgo/v2/types/config.go b/vendor/github.com/onsi/ginkgo/v2/types/config.go index f847036..ca64acb 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/config.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/config.go @@ -215,6 +215,7 @@ type GoFlagsConfig struct { N bool ModFile string ModCacheRW bool + ASan bool MSan bool PkgDir string Tags string @@ -570,6 +571,8 @@ var GoBuildFlags = GinkgoFlags{ Usage: "leave newly-created directories in the module cache read-write instead of making them read-only."}, {KeyPath: "Go.ModFile", Name: "modfile", UsageArgument: "file", SectionKey: "go-build", Usage: `in module aware mode, read (and possibly write) an alternate go.mod file instead of the one in the module root directory. A file named go.mod must still be present in order to determine the module root directory, but it is not accessed. When -modfile is specified, an alternate go.sum file is also used: its path is derived from the -modfile flag by trimming the ".mod" extension and appending ".sum".`}, + {KeyPath: "Go.ASan", Name: "asan", SectionKey: "go-build", + Usage: "enable interoperation with address sanitizer."}, {KeyPath: "Go.MSan", Name: "msan", SectionKey: "go-build", Usage: "enable interoperation with memory sanitizer. Supported only on linux/amd64, linux/arm64 and only with Clang/LLVM as the host C compiler. On linux/arm64, pie build mode will be used."}, {KeyPath: "Go.N", Name: "n", SectionKey: "go-build", diff --git a/vendor/github.com/onsi/ginkgo/v2/types/flags.go b/vendor/github.com/onsi/ginkgo/v2/types/flags.go index 8409653..eb04c3e 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/flags.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/flags.go @@ -212,6 +212,24 @@ func (f GinkgoFlagSet) IsZero() bool { return f.flagSet == nil } +func (f GinkgoFlagSet) Completion(arg string) map[string]string { + if f.IsZero() { + return nil + } + prefix := strings.TrimLeft(arg, "-") + dash := arg[:len(arg)-len(prefix)] + if len(dash) < 1 || len(dash) > 3 { + return nil + } + result := make(map[string]string, len(f.flags)) + for _, flag := range f.flags { + if flag.Name != "" && strings.HasPrefix(flag.Name, prefix) { + result[dash+flag.Name] = flag.Usage + } + } + return result +} + func (f GinkgoFlagSet) WasSet(name string) bool { found := false f.flagSet.Visit(func(f *flag.Flag) { diff --git a/vendor/github.com/onsi/ginkgo/v2/types/version.go b/vendor/github.com/onsi/ginkgo/v2/types/version.go index 1df09be..6874270 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/version.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/version.go @@ -1,3 +1,3 @@ package types -const VERSION = "2.28.1" +const VERSION = "2.28.2" diff --git a/vendor/modules.txt b/vendor/modules.txt index 2c0355d..5ff7e12 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -35,7 +35,7 @@ github.com/google/go-cmp/cmp/internal/value # github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 ## explicit; go 1.24.0 github.com/google/pprof/profile -# github.com/hetznercloud/hcloud-go/v2 v2.37.0 +# github.com/hetznercloud/hcloud-go/v2 v2.38.0 ## explicit; go 1.25.0 github.com/hetznercloud/hcloud-go/v2/hcloud github.com/hetznercloud/hcloud-go/v2/hcloud/exp/ctxutil @@ -44,7 +44,7 @@ github.com/hetznercloud/hcloud-go/v2/hcloud/schema # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/onsi/ginkgo/v2 v2.28.1 +# github.com/onsi/ginkgo/v2 v2.28.2 ## explicit; go 1.24.0 github.com/onsi/ginkgo/v2 github.com/onsi/ginkgo/v2/config