@@ -18,10 +18,10 @@ package cmd
18
18
19
19
import (
20
20
"context"
21
+ "errors"
21
22
"fmt"
22
23
"os"
23
24
24
- "github.com/pkg/errors"
25
25
"github.com/sirupsen/logrus"
26
26
27
27
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/config"
@@ -42,7 +42,7 @@ var createRunner = createNewRunner
42
42
func withRunner (ctx context.Context , action func (runner.Runner , * latest.SkaffoldConfig ) error ) error {
43
43
runner , config , err := createRunner (opts )
44
44
if err != nil {
45
- return errors . Wrap ( err , "creating runner" )
45
+ return fmt . Errorf ( "creating runner: %w" , err )
46
46
}
47
47
48
48
err = action (runner , config )
@@ -54,41 +54,41 @@ func withRunner(ctx context.Context, action func(runner.Runner, *latest.Skaffold
54
54
func createNewRunner (opts config.SkaffoldOptions ) (runner.Runner , * latest.SkaffoldConfig , error ) {
55
55
parsed , err := schema .ParseConfig (opts .ConfigurationFile , true )
56
56
if err != nil {
57
- if os .IsNotExist (errors .Cause (err )) {
57
+ if os .IsNotExist (errors .Unwrap (err )) {
58
58
return nil , nil , fmt .Errorf ("[%s] not found. You might need to run `skaffold init`" , opts .ConfigurationFile )
59
59
}
60
60
61
61
// If the error is NOT that the file doesn't exist, then we warn the user
62
62
// that maybe they are using an outdated version of Skaffold that's unable to read
63
63
// the configuration.
64
64
warnIfUpdateIsAvailable ()
65
- return nil , nil , errors . Wrap ( err , "parsing skaffold config" )
65
+ return nil , nil , fmt . Errorf ( "parsing skaffold config: %w" , err )
66
66
}
67
67
68
68
config := parsed .(* latest.SkaffoldConfig )
69
69
70
70
if err = schema .ApplyProfiles (config , opts ); err != nil {
71
- return nil , nil , errors . Wrap ( err , "applying profiles" )
71
+ return nil , nil , fmt . Errorf ( "applying profiles: %w" , err )
72
72
}
73
73
74
74
kubectx .ConfigureKubeConfig (opts .KubeConfig , opts .KubeContext , config .Deploy .KubeContext )
75
75
76
76
if err := defaults .Set (config ); err != nil {
77
- return nil , nil , errors . Wrap ( err , "setting default values" )
77
+ return nil , nil , fmt . Errorf ( "setting default values: %w" , err )
78
78
}
79
79
80
80
if err := validation .Process (config ); err != nil {
81
- return nil , nil , errors . Wrap ( err , "invalid skaffold config" )
81
+ return nil , nil , fmt . Errorf ( "invalid skaffold config: %w" , err )
82
82
}
83
83
84
84
runCtx , err := runcontext .GetRunContext (opts , config .Pipeline )
85
85
if err != nil {
86
- return nil , nil , errors . Wrap ( err , "getting run context" )
86
+ return nil , nil , fmt . Errorf ( "getting run context: %w" , err )
87
87
}
88
88
89
89
runner , err := runner .NewForConfig (runCtx )
90
90
if err != nil {
91
- return nil , nil , errors . Wrap ( err , "creating runner" )
91
+ return nil , nil , fmt . Errorf ( "creating runner: %w" , err )
92
92
}
93
93
94
94
return runner , config , nil
0 commit comments