diff --git a/go.mod b/go.mod index b8d41aa..cb198d8 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,9 @@ go 1.25.1 require github.com/briandowns/spinner v1.23.2 require ( - github.com/cli/go-gh/v2 v2.12.2 + github.com/cli/go-gh/v2 v2.13.0 github.com/cli/shurcooL-graphql v0.0.4 - github.com/spf13/cobra v1.10.1 + github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.11.1 ) diff --git a/go.sum b/go.sum index 12a5cde..a10e299 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/briandowns/spinner v1.23.2 h1:Zc6ecUnI+YzLmJniCfDNaMbW0Wid1d5+qcTq4L2FW8w= github.com/briandowns/spinner v1.23.2/go.mod h1:LaZeM4wm2Ywy6vO571mvhQNRcWfRUnXOs0RcKV0wYKM= -github.com/cli/go-gh/v2 v2.12.2 h1:EtocmDAH7dKrH2PscQOQVo7PbFD5G6uYx4rSKY2w1SY= -github.com/cli/go-gh/v2 v2.12.2/go.mod h1:g2IjwHEo27fgItlS9wUbRaXPYurZEXPp1jrxf3piC6g= +github.com/cli/go-gh/v2 v2.13.0 h1:jEHZu/VPVoIJkciK3pzZd3rbT8J90swsK5Ui4ewH1ys= +github.com/cli/go-gh/v2 v2.13.0/go.mod h1:Us/NbQ8VNM0fdaILgoXSz6PKkV5PWaEzkJdc9vR2geM= github.com/cli/safeexec v1.0.1 h1:e/C79PbXF4yYTN/wauC4tviMxEV13BwljGj0N9j+N00= github.com/cli/safeexec v1.0.1/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q= github.com/cli/shurcooL-graphql v0.0.4 h1:6MogPnQJLjKkaXPyGqPRXOI2qCsQdqNfUY1QSJu2GuY= @@ -37,8 +37,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= -github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -46,6 +46,7 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/thlib/go-timezone-local v0.0.7 h1:fX8zd3aJydqLlTs/TrROrIIdztzsdFV23OzOQx31jII= github.com/thlib/go-timezone-local v0.0.7/go.mod h1:/Tnicc6m/lsJE0irFMA0LfIwTBo4QP7A8IfyIv4zZKI= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= diff --git a/vendor/github.com/cli/go-gh/v2/internal/yamlmap/yaml_map.go b/vendor/github.com/cli/go-gh/v2/internal/yamlmap/yaml_map.go index a440047..b4725d3 100644 --- a/vendor/github.com/cli/go-gh/v2/internal/yamlmap/yaml_map.go +++ b/vendor/github.com/cli/go-gh/v2/internal/yamlmap/yaml_map.go @@ -149,6 +149,8 @@ func (m *Map) SetEntry(key string, value *Map) { m.AddEntry(key, value) } +// SetModified marks the map as modified. +// // Note: This is a hack to introduce the concept of modified/unmodified // on top of gopkg.in/yaml.v3. This works by setting the Value property // of a MappingNode to a specific value and then later checking if the @@ -166,14 +168,11 @@ func (m *Map) SetModified() { } } -// Traverse map using BFS to set all nodes as unmodified. +// SetUnmodified traverses the map using BFS to set all nodes as unmodified. func (m *Map) SetUnmodified() { i := 0 queue := []*yaml.Node{m.Node} - for { - if i > (len(queue) - 1) { - break - } + for i < len(queue) { q := queue[i] i = i + 1 if q.Kind != yaml.MappingNode { @@ -184,14 +183,11 @@ func (m *Map) SetUnmodified() { } } -// Traverse map using BFS to searach for any nodes that have been modified. +// IsModified traverses the map using BFS to search for any nodes that have been modified. func (m *Map) IsModified() bool { i := 0 queue := []*yaml.Node{m.Node} - for { - if i > (len(queue) - 1) { - break - } + for i < len(queue) { q := queue[i] i = i + 1 if q.Kind != yaml.MappingNode { diff --git a/vendor/github.com/cli/go-gh/v2/pkg/api/errors.go b/vendor/github.com/cli/go-gh/v2/pkg/api/errors.go index e8fb93f..74e9515 100644 --- a/vendor/github.com/cli/go-gh/v2/pkg/api/errors.go +++ b/vendor/github.com/cli/go-gh/v2/pkg/api/errors.go @@ -27,7 +27,7 @@ type HTTPErrorItem struct { Resource string } -// Allow HTTPError to satisfy error interface. +// Error allows HTTPError to satisfy error interface. func (err *HTTPError) Error() string { if msgs := strings.SplitN(err.Message, "\n", 2); len(msgs) > 1 { return fmt.Sprintf("HTTP %d: %s (%s)\n%s", err.StatusCode, msgs[0], err.RequestURL, msgs[1]) @@ -55,7 +55,7 @@ type GraphQLErrorItem struct { Type string } -// Allow GraphQLError to satisfy error interface. +// Error allows GraphQLError to satisfy error interface. func (gr *GraphQLError) Error() string { errorMessages := make([]string, 0, len(gr.Errors)) for _, e := range gr.Errors { @@ -98,6 +98,8 @@ func matchPath(p, expect string) bool { } // HandleHTTPError parses a http.Response into a HTTPError. +// +// The function attempts to read the response's body, but it does not close it. func HandleHTTPError(resp *http.Response) error { httpError := &HTTPError{ Headers: resp.Header, diff --git a/vendor/github.com/cli/go-gh/v2/pkg/api/graphql_client.go b/vendor/github.com/cli/go-gh/v2/pkg/api/graphql_client.go index 3317eef..a985f70 100644 --- a/vendor/github.com/cli/go-gh/v2/pkg/api/graphql_client.go +++ b/vendor/github.com/cli/go-gh/v2/pkg/api/graphql_client.go @@ -26,7 +26,8 @@ func DefaultGraphQLClient() (*GraphQLClient, error) { return NewGraphQLClient(ClientOptions{}) } -// GraphQLClient builds a client to send requests to GitHub GraphQL API endpoints. +// NewGraphQLClient builds a client to send requests to GitHub GraphQL API endpoints. +// // As part of the configuration a hostname, auth token, default set of headers, // and unix domain socket are resolved from the gh environment configuration. // These behaviors can be overridden using the opts argument. diff --git a/vendor/github.com/cli/go-gh/v2/pkg/api/http_client.go b/vendor/github.com/cli/go-gh/v2/pkg/api/http_client.go index 1d7c517..2195306 100644 --- a/vendor/github.com/cli/go-gh/v2/pkg/api/http_client.go +++ b/vendor/github.com/cli/go-gh/v2/pkg/api/http_client.go @@ -37,7 +37,8 @@ func DefaultHTTPClient() (*http.Client, error) { return NewHTTPClient(ClientOptions{}) } -// HTTPClient builds a client that can be passed to another library. +// NewHTTPClient builds a client that can be passed to another library. +// // As part of the configuration a hostname, auth token, default set of headers, // and unix domain socket are resolved from the gh environment configuration. // These behaviors can be overridden using the opts argument. In this instance diff --git a/vendor/github.com/cli/go-gh/v2/pkg/api/rest_client.go b/vendor/github.com/cli/go-gh/v2/pkg/api/rest_client.go index ccd86cd..097e637 100644 --- a/vendor/github.com/cli/go-gh/v2/pkg/api/rest_client.go +++ b/vendor/github.com/cli/go-gh/v2/pkg/api/rest_client.go @@ -22,7 +22,8 @@ func DefaultRESTClient() (*RESTClient, error) { return NewRESTClient(ClientOptions{}) } -// RESTClient builds a client to send requests to GitHub REST API endpoints. +// NewRESTClient builds a client to send requests to GitHub REST API endpoints. +// // As part of the configuration a hostname, auth token, default set of headers, // and unix domain socket are resolved from the gh environment configuration. // These behaviors can be overridden using the opts argument. @@ -100,6 +101,11 @@ func (c *RESTClient) DoWithContext(ctx context.Context, method string, path stri if resp.StatusCode == http.StatusNoContent { return nil } + + if resp.StatusCode == http.StatusResetContent { + return nil + } + defer resp.Body.Close() b, err := io.ReadAll(resp.Body) diff --git a/vendor/github.com/cli/go-gh/v2/pkg/config/config.go b/vendor/github.com/cli/go-gh/v2/pkg/config/config.go index 0de46fe..9789a06 100644 --- a/vendor/github.com/cli/go-gh/v2/pkg/config/config.go +++ b/vendor/github.com/cli/go-gh/v2/pkg/config/config.go @@ -244,6 +244,8 @@ func mapFromString(str string) (*yamlmap.Map, error) { return yamlmap.Unmarshal([]byte(str)) } +// ConfigDir returns the path to the configuration directory. +// // Config path precedence: GH_CONFIG_DIR, XDG_CONFIG_HOME, AppData (windows only), HOME. func ConfigDir() string { var path string @@ -260,6 +262,8 @@ func ConfigDir() string { return path } +// StateDir returns the path to the state directory. +// // State path precedence: XDG_STATE_HOME, LocalAppData (windows only), HOME. func StateDir() string { var path string @@ -274,6 +278,8 @@ func StateDir() string { return path } +// DataDir returns the path to the data directory. +// // Data path precedence: XDG_DATA_HOME, LocalAppData (windows only), HOME. func DataDir() string { var path string @@ -288,6 +294,8 @@ func DataDir() string { return path } +// CacheDir returns the path to the cache directory. +// // Cache path precedence: XDG_CACHE_HOME, LocalAppData (windows only), HOME, legacy gh-cli-cache. func CacheDir() string { if a := os.Getenv(xdgCacheHome); a != "" { diff --git a/vendor/github.com/cli/go-gh/v2/pkg/config/errors.go b/vendor/github.com/cli/go-gh/v2/pkg/config/errors.go index 1aefd19..f30e9c9 100644 --- a/vendor/github.com/cli/go-gh/v2/pkg/config/errors.go +++ b/vendor/github.com/cli/go-gh/v2/pkg/config/errors.go @@ -10,12 +10,12 @@ type InvalidConfigFileError struct { Err error } -// Allow InvalidConfigFileError to satisfy error interface. +// Error allows InvalidConfigFileError to satisfy error interface. func (e *InvalidConfigFileError) Error() string { return fmt.Sprintf("invalid config file %s: %s", e.Path, e.Err) } -// Allow InvalidConfigFileError to be unwrapped. +// Unwrap allows InvalidConfigFileError to be unwrapped. func (e *InvalidConfigFileError) Unwrap() error { return e.Err } @@ -26,7 +26,7 @@ type KeyNotFoundError struct { Key string } -// Allow KeyNotFoundError to satisfy error interface. +// Error allows KeyNotFoundError to satisfy error interface. func (e *KeyNotFoundError) Error() string { return fmt.Sprintf("could not find key %q", e.Key) } diff --git a/vendor/github.com/cli/go-gh/v2/pkg/term/console.go b/vendor/github.com/cli/go-gh/v2/pkg/term/console.go index 4ff7e95..995df14 100644 --- a/vendor/github.com/cli/go-gh/v2/pkg/term/console.go +++ b/vendor/github.com/cli/go-gh/v2/pkg/term/console.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package term diff --git a/vendor/github.com/cli/go-gh/v2/pkg/term/console_windows.go b/vendor/github.com/cli/go-gh/v2/pkg/term/console_windows.go index 55b1e42..ae5ad49 100644 --- a/vendor/github.com/cli/go-gh/v2/pkg/term/console_windows.go +++ b/vendor/github.com/cli/go-gh/v2/pkg/term/console_windows.go @@ -1,5 +1,4 @@ //go:build windows -// +build windows package term diff --git a/vendor/github.com/spf13/cobra/.golangci.yml b/vendor/github.com/spf13/cobra/.golangci.yml index 6acf8ab..104dc24 100644 --- a/vendor/github.com/spf13/cobra/.golangci.yml +++ b/vendor/github.com/spf13/cobra/.golangci.yml @@ -57,3 +57,10 @@ linters: - common-false-positives - legacy - std-error-handling + settings: + govet: + # Disable buildtag check to allow dual build tag syntax (both //go:build and // +build). + # This is necessary for Go 1.15 compatibility since //go:build was introduced in Go 1.17. + # This can be removed once Cobra requires Go 1.17 or higher. + disable: + - buildtag diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go index 78088db..c05fed4 100644 --- a/vendor/github.com/spf13/cobra/command.go +++ b/vendor/github.com/spf13/cobra/command.go @@ -557,7 +557,7 @@ func (c *Command) FlagErrorFunc() (f func(*Command, error) error) { } } -var minUsagePadding = 25 +const minUsagePadding = 25 // UsagePadding return padding for the usage. func (c *Command) UsagePadding() int { @@ -567,7 +567,7 @@ func (c *Command) UsagePadding() int { return c.parent.commandsMaxUseLen } -var minCommandPathPadding = 11 +const minCommandPathPadding = 11 // CommandPathPadding return padding for the command path. func (c *Command) CommandPathPadding() int { @@ -577,7 +577,7 @@ func (c *Command) CommandPathPadding() int { return c.parent.commandsMaxCommandPathLen } -var minNamePadding = 11 +const minNamePadding = 11 // NamePadding returns padding for the name. func (c *Command) NamePadding() int { @@ -1939,7 +1939,7 @@ type tmplFunc struct { fn func(io.Writer, interface{}) error } -var defaultUsageTemplate = `Usage:{{if .Runnable}} +const defaultUsageTemplate = `Usage:{{if .Runnable}} {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}} {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}} @@ -2039,7 +2039,7 @@ func defaultUsageFunc(w io.Writer, in interface{}) error { return nil } -var defaultHelpTemplate = `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}} +const defaultHelpTemplate = `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}} {{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}` @@ -2061,7 +2061,7 @@ func defaultHelpFunc(w io.Writer, in interface{}) error { return nil } -var defaultVersionTemplate = `{{with .DisplayName}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}} +const defaultVersionTemplate = `{{with .DisplayName}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}} ` // defaultVersionFunc is equivalent to executing defaultVersionTemplate. The two should be changed in sync. diff --git a/vendor/modules.txt b/vendor/modules.txt index 29e9691..9ba95f3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -4,8 +4,8 @@ github.com/aymanbagabas/go-osc52/v2 # github.com/briandowns/spinner v1.23.2 ## explicit; go 1.17 github.com/briandowns/spinner -# github.com/cli/go-gh/v2 v2.12.2 -## explicit; go 1.23.0 +# github.com/cli/go-gh/v2 v2.13.0 +## explicit; go 1.25.0 github.com/cli/go-gh/v2/internal/set github.com/cli/go-gh/v2/internal/yamlmap github.com/cli/go-gh/v2/pkg/api @@ -56,7 +56,7 @@ github.com/pmezard/go-difflib/difflib # github.com/rivo/uniseg v0.4.7 ## explicit; go 1.18 github.com/rivo/uniseg -# github.com/spf13/cobra v1.10.1 +# github.com/spf13/cobra v1.10.2 ## explicit; go 1.15 github.com/spf13/cobra # github.com/spf13/pflag v1.0.10