Skip to content

Commit

Permalink
Remove usage of deprecated errors package
Browse files Browse the repository at this point in the history
The repository has been archived and no longer compiles with
Go 1.20

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Aug 29, 2023
1 parent 35232db commit 2a30804
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 744 deletions.
12 changes: 6 additions & 6 deletions Makefile
Expand Up @@ -20,12 +20,12 @@ gofmt:
dist:
mkdir -p bin/
rm -rf bin/k3sup*
CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -o bin/k3sup
GOARM=7 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -o bin/k3sup-armhf
GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -o bin/k3sup-arm64
CGO_ENABLED=0 GOOS=darwin go build -ldflags $(LDFLAGS) -o bin/k3sup-darwin
GOARCH=arm64 CGO_ENABLED=0 GOOS=darwin go build -ldflags $(LDFLAGS) -o bin/k3sup-darwin-arm64
GOOS=windows CGO_ENABLED=0 go build -ldflags $(LDFLAGS) -o bin/k3sup.exe
CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -o bin/k3sup
GOARM=7 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -o bin/k3sup-armhf
GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -o bin/k3sup-arm64
CGO_ENABLED=0 GOOS=darwin go build -ldflags $(LDFLAGS) -o bin/k3sup-darwin
GOARCH=arm64 CGO_ENABLED=0 GOOS=darwin go build -ldflags $(LDFLAGS) -o bin/k3sup-darwin-arm64
GOOS=windows CGO_ENABLED=0 go build -ldflags $(LDFLAGS) -o bin/k3sup.exe

.PHONY: hash
hash:
Expand Down
8 changes: 4 additions & 4 deletions cmd/install.go
Expand Up @@ -15,8 +15,9 @@ import (
"github.com/alexellis/k3sup/pkg"
operator "github.com/alexellis/k3sup/pkg/operator"

"errors"

homedir "github.com/mitchellh/go-homedir"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/agent"
Expand Down Expand Up @@ -323,7 +324,7 @@ Provide the --local-path flag with --merge if a kubeconfig already exists in som
if initialSSHErr != nil {
publicKeyFileAuth, closeSSHAgent, err := loadPublickey(sshKeyPath)
if err != nil {
return errors.Wrapf(err, "unable to load the ssh key with path %q", sshKeyPath)
return fmt.Errorf("unable to load the ssh key with path %q: %w", sshKeyPath, err)
}

defer closeSSHAgent()
Expand All @@ -335,9 +336,8 @@ Provide the --local-path flag with --merge if a kubeconfig already exists in som
}

sshOperator, err = operator.NewSSHOperator(address, config)

if err != nil {
return errors.Wrapf(err, "unable to connect to %s over ssh", address)
return fmt.Errorf("unable to connect to %s over ssh: %w", address, err)
}
}

Expand Down
23 changes: 12 additions & 11 deletions cmd/join.go
Expand Up @@ -7,9 +7,10 @@ import (
"runtime"
"strings"

"errors"

"github.com/alexellis/k3sup/pkg"
operator "github.com/alexellis/k3sup/pkg/operator"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh"
)
Expand Down Expand Up @@ -196,7 +197,7 @@ func MakeJoin() *cobra.Command {
sshOperator, initialSSHErr = operator.NewSSHOperator(address, config)
}
} else {
initialSSHErr = errors.New("ssh-agent unsupported on windows")
initialSSHErr = fmt.Errorf("ssh-agent unsupported on windows")
}

// If the initial connection attempt fails fall through to the using
Expand All @@ -207,7 +208,7 @@ func MakeJoin() *cobra.Command {
var err error
publicKeyFileAuth, closeSSHAgent, err = loadPublickey(sshKeyPath)
if err != nil {
return errors.Wrapf(err, "unable to load the ssh key with path %q", sshKeyPath)
return fmt.Errorf("unable to load the ssh key with path %q: %w", sshKeyPath, err)
}

defer closeSSHAgent()
Expand All @@ -223,7 +224,7 @@ func MakeJoin() *cobra.Command {
sshOperator, err = operator.NewSSHOperator(address, config)

if err != nil {
return errors.Wrapf(err, "unable to connect to (server) %s over ssh", address)
return fmt.Errorf("unable to connect to (server) %s over ssh: %w", address, err)
}
}

Expand All @@ -238,7 +239,7 @@ func MakeJoin() *cobra.Command {
res, err := sshOperator.ExecuteStdio(getTokenCommand, streamToStdio)

if err != nil {
return errors.Wrap(err, "unable to get join-token from server")
return fmt.Errorf("unable to get join-token from server: %w", err)
}

if len(res.StdErr) > 0 {
Expand Down Expand Up @@ -350,7 +351,7 @@ func setupAdditionalServer(serverHost, host string, port int, user, sshKeyPath,
if initialSSHErr != nil {
publicKeyFileAuth, closeSSHAgent, err := loadPublickey(sshKeyPath)
if err != nil {
return errors.Wrapf(err, "unable to load the ssh key with path %q", sshKeyPath)
return fmt.Errorf("unable to load the ssh key with path %q: %w", sshKeyPath, err)
}

defer closeSSHAgent()
Expand All @@ -366,7 +367,7 @@ func setupAdditionalServer(serverHost, host string, port int, user, sshKeyPath,
sshOperator, err = operator.NewSSHOperator(address, config)

if err != nil {
return errors.Wrapf(err, "unable to connect to %s over ssh as %s", address, user)
return fmt.Errorf("unable to connect to %s over ssh as %s: %w", address, user, err)
}
}

Expand All @@ -393,7 +394,7 @@ func setupAdditionalServer(serverHost, host string, port int, user, sshKeyPath,

res, err := sshOperator.Execute(installAgentServerCommand)
if err != nil {
return errors.Wrap(err, "unable to setup agent")
return fmt.Errorf("unable to setup agent: %w", err)
}

if len(res.StdErr) > 0 {
Expand Down Expand Up @@ -437,7 +438,7 @@ func setupAgent(serverHost, host string, port int, user, sshKeyPath, joinToken,
if initialSSHErr != nil {
publicKeyFileAuth, closeSSHAgent, err := loadPublickey(sshKeyPath)
if err != nil {
return errors.Wrapf(err, "unable to load the ssh key with path %q", sshKeyPath)
return fmt.Errorf("unable to load the ssh key with path %q: %w", sshKeyPath, err)
}

defer closeSSHAgent()
Expand All @@ -452,7 +453,7 @@ func setupAgent(serverHost, host string, port int, user, sshKeyPath, joinToken,

sshOperator, err = operator.NewSSHOperator(address, config)
if err != nil {
return errors.Wrapf(err, "unable to connect to %s over ssh", address)
return fmt.Errorf("unable to connect to %s over ssh: %w", address, err)
}
}

Expand Down Expand Up @@ -483,7 +484,7 @@ func setupAgent(serverHost, host string, port int, user, sshKeyPath, joinToken,
res, err := sshOperator.Execute(installAgentCommand)

if err != nil {
return errors.Wrap(err, "unable to setup agent")
return fmt.Errorf("unable to setup agent: %w", err)
}

if len(res.StdErr) > 0 {
Expand Down
1 change: 0 additions & 1 deletion go.mod
Expand Up @@ -6,7 +6,6 @@ require (
github.com/alexellis/go-execute v0.6.0
github.com/mitchellh/go-homedir v1.1.0
github.com/morikuni/aec v1.0.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.7.0
golang.org/x/crypto v0.12.0
)
Expand Down
24 changes: 0 additions & 24 deletions go.sum
@@ -1,46 +1,22 @@
github.com/alexellis/go-execute v0.5.0 h1:L8kgNlFzNbJov7jrInlaig7i6ZUSz/tYYmqvb8dyD0s=
github.com/alexellis/go-execute v0.5.0/go.mod h1:AgHTcsCF9wrP0mMVTO8N+lFw1Biy71NybBOk8M+qgy8=
github.com/alexellis/go-execute v0.6.0 h1:FVGoudJnWSObwf9qmehbvVuvhK6g1UpKOCBjS+OUXEA=
github.com/alexellis/go-execute v0.6.0/go.mod h1:nlg2F6XdYydUm1xXQMMiuibQCV1mveybBkNWfdNznjk=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503 h1:vJ2V3lFLg+bBhgroYuRfyN583UzVveQmIXjc8T/y3to=
golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 h1:UiNENfZ8gDvpiWw7IpOMQ27spWmThO1RwwdQVbJahJM=
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc=
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
24 changes: 0 additions & 24 deletions vendor/github.com/pkg/errors/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions vendor/github.com/pkg/errors/.travis.yml

This file was deleted.

23 changes: 0 additions & 23 deletions vendor/github.com/pkg/errors/LICENSE

This file was deleted.

44 changes: 0 additions & 44 deletions vendor/github.com/pkg/errors/Makefile

This file was deleted.

59 changes: 0 additions & 59 deletions vendor/github.com/pkg/errors/README.md

This file was deleted.

0 comments on commit 2a30804

Please sign in to comment.