refactor: drop multierror in favor of std

Drop github.com/hashicorp/go-multierror
in favor of https://pkg.go.dev/errors#Join (go1.20).

Related to #11468

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
This commit is contained in:
ferhat elmas 2025-11-30 23:52:06 +01:00 committed by William Martin
parent 92ce28b723
commit 70470f9cef
4 changed files with 8 additions and 11 deletions

2
go.mod
View file

@ -30,7 +30,6 @@ require (
github.com/google/go-containerregistry v0.20.6
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/gorilla/websocket v1.5.3
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-version v1.7.0
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec
github.com/in-toto/attestation v1.1.2
@ -154,7 +153,6 @@ require (
github.com/gorilla/css v1.0.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/henvic/httpretty v0.1.4 // indirect
github.com/huandu/xstrings v1.5.0 // indirect

1
go.sum
View file

@ -1105,7 +1105,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnV
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=

View file

@ -3,6 +3,7 @@ package set
import (
"bytes"
"encoding/base64"
"errors"
"fmt"
"io"
"net/http"
@ -18,7 +19,6 @@ import (
"github.com/cli/cli/v2/pkg/cmd/secret/shared"
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/hashicorp/go-multierror"
"github.com/joho/godotenv"
"github.com/spf13/cobra"
"golang.org/x/crypto/nacl/box"
@ -295,12 +295,12 @@ func setRun(opts *SetOptions) error {
}()
}
err = nil
var errs []error
cs := opts.IO.ColorScheme()
for i := 0; i < len(secrets); i++ {
result := <-setc
if result.err != nil {
err = multierror.Append(err, result.err)
errs = append(errs, result.err)
continue
}
if result.encrypted != "" {
@ -318,7 +318,7 @@ func setRun(opts *SetOptions) error {
}
fmt.Fprintf(opts.IO.Out, "%s Set %s secret %s for %s\n", cs.SuccessIcon(), secretApp.Title(), result.key, target)
}
return err
return errors.Join(errs...)
}
type setResult struct {

View file

@ -2,6 +2,7 @@ package set
import (
"bytes"
"errors"
"fmt"
"io"
"net/http"
@ -15,7 +16,6 @@ import (
"github.com/cli/cli/v2/pkg/cmd/variable/shared"
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/hashicorp/go-multierror"
"github.com/joho/godotenv"
"github.com/spf13/cobra"
)
@ -201,12 +201,12 @@ func setRun(opts *SetOptions) error {
}()
}
err = nil
var errs []error
cs := opts.IO.ColorScheme()
for i := 0; i < len(variables); i++ {
result := <-setc
if result.Err != nil {
err = multierror.Append(err, result.Err)
errs = append(errs, result.Err)
continue
}
if !opts.IO.IsStdoutTTY() {
@ -222,7 +222,7 @@ func setRun(opts *SetOptions) error {
fmt.Fprintf(opts.IO.Out, "%s %s variable %s for %s\n", cs.SuccessIcon(), result.Operation, result.Key, target)
}
return err
return errors.Join(errs...)
}
func getVariablesFromOptions(opts *SetOptions) (map[string]string, error) {