From df35401862f549abf3f79c52708c762ef07c846a Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Wed, 26 Jun 2019 12:07:42 -0400 Subject: [PATCH] dep diet --- cmd/grifter.go | 19 +++++++++---------- cmd/run.go | 11 +++++------ go.mod | 3 ++- go.sum | 2 -- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/cmd/grifter.go b/cmd/grifter.go index 3776d5f..afe2ef7 100644 --- a/cmd/grifter.go +++ b/cmd/grifter.go @@ -11,7 +11,6 @@ import ( "sync" "github.com/gobuffalo/envy" - "github.com/pkg/errors" "github.com/rogpeppe/go-internal/modfile" ) @@ -50,7 +49,7 @@ func newGrifter(name string) (*grifter, error) { currentPath, err := os.Getwd() if err != nil { - return g, errors.WithStack(err) + return g, err } if envy.InGoPath() { @@ -64,14 +63,14 @@ func newGrifter(name string) (*grifter, error) { } p := strings.SplitN(currentPath, filepath.FromSlash("/src/"), 2) if len(p) == 1 { - return g, errors.Errorf("There is no directory named 'grifts'. Run '%s init' or switch to the appropriate directory", name) + return g, fmt.Errorf("There is no directory named 'grifts'. Run '%s init' or switch to the appropriate directory", name) } g.GriftsAbsolutePath = filepath.ToSlash(filepath.Join(currentPath, "grifts")) g.GriftsPackagePath = filepath.ToSlash(filepath.Join(p[1], "grifts")) } else { // is outside of gopath, dont loop to parent if !hasGriftDir(currentPath) { - return g, errors.Errorf("There is no directory named 'grifts'. Run '%s init' or switch to the appropriate directory", name) + return g, fmt.Errorf("There is no directory named 'grifts'. Run '%s init' or switch to the appropriate directory", name) } g.GriftsAbsolutePath = filepath.ToSlash(filepath.Join(currentPath, "grifts")) @@ -79,11 +78,11 @@ func newGrifter(name string) (*grifter, error) { if envy.Mods() { moddata, err := ioutil.ReadFile("go.mod") if err != nil { - return g, errors.New("go.mod cannot be read or does not exist while go module is enabled.") + return g, fmt.Errorf("go.mod cannot be read or does not exist while go module is enabled.") } packagePath := modfile.ModulePath(moddata) if packagePath == "" { - return g, errors.New("go.mod is malformed.") + return g, fmt.Errorf("go.mod is malformed.") } g.GriftsPackagePath = fmt.Sprintf("%s/grifts", packagePath) } else { @@ -101,7 +100,7 @@ func (g *grifter) Setup() error { root := filepath.Dir(exePath) err := os.MkdirAll(root, 0755) if err != nil { - return errors.WithStack(err) + return err } tmpls := map[string]string{} @@ -112,17 +111,17 @@ func (g *grifter) Setup() error { for k, v := range tmpls { t, err := template.New(k).Parse(v) if err != nil { - return errors.WithStack(err) + return err } f, err := os.Create(k) if err != nil { - return errors.WithStack(err) + return err } err = t.Execute(f, g) if err != nil { - return errors.WithStack(err) + return err } } diff --git a/cmd/run.go b/cmd/run.go index 9076459..ed6788c 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -7,7 +7,6 @@ import ( "os/exec" "github.com/markbates/grift/grift" - "github.com/pkg/errors" ) var currentGrift *grifter @@ -35,12 +34,12 @@ func Run(name string, args []string) error { err := setup(name) if err != nil { - return errors.WithStack(err) + return err } err = run(args) if err != nil { - return errors.WithStack(err) + return err } return nil @@ -61,7 +60,7 @@ func run(args []string) error { rargs = append(rargs, exePath) rargs = append(rargs, args...) if err := grift.RunSource(exec.Command("go", rargs...)); err != nil { - return errors.WithStack(err) + return err } return nil } @@ -75,11 +74,11 @@ func setup(name string) error { var err error currentGrift, err = newGrifter(name) if err != nil { - return errors.WithStack(err) + return err } err = currentGrift.Setup() if err != nil { - return errors.WithStack(err) + return err } return nil } diff --git a/go.mod b/go.mod index 24d9eb2..6fa80e3 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,9 @@ module github.com/markbates/grift +go 1.12 + require ( github.com/gobuffalo/envy v1.7.0 - github.com/pkg/errors v0.8.1 github.com/rogpeppe/go-internal v1.3.0 github.com/stretchr/testify v1.3.0 ) diff --git a/go.sum b/go.sum index c38fee8..fae370f 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,6 @@ github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqx github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=