Skip to content

Commit

Permalink
Update go.mod after API scaffold generation
Browse files Browse the repository at this point in the history
  • Loading branch information
dastergon committed Feb 25, 2021
1 parent d07dfcc commit 0d42eb0
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/plugins/golang/v2/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ func (p *createAPISubcommand) PostScaffold() error {
return fmt.Errorf("unknown pattern %q", p.pattern)
}

err := util.RunCmd("Running go mod tidy", "go", "mod", "tidy")
if err != nil {
return err
}

if p.runMake { // TODO: check if API was scaffolded
return util.RunCmd("Running make", "make", "generate")
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/plugins/golang/v3/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ func (p *createAPISubcommand) PostScaffold() error {
return fmt.Errorf("unknown pattern %q", p.pattern)
}

err := util.RunCmd("Running go mod tidy", "go", "mod", "tidy")
if err != nil {
return err
}

if p.runMake { // TODO: check if API was scaffolded
return util.RunCmd("Running make", "make", "generate")
}
Expand Down
2 changes: 2 additions & 0 deletions testdata/project-v2-addon/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ go 1.13

require (
github.com/go-logr/logr v0.1.0
github.com/onsi/ginkgo v1.12.1
github.com/onsi/gomega v1.10.1
k8s.io/apimachinery v0.18.6
k8s.io/client-go v0.18.6
sigs.k8s.io/controller-runtime v0.6.4
Expand Down
2 changes: 2 additions & 0 deletions testdata/project-v2-multigroup/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ go 1.13

require (
github.com/go-logr/logr v0.1.0
github.com/onsi/ginkgo v1.12.1
github.com/onsi/gomega v1.10.1
k8s.io/api v0.18.6
k8s.io/apimachinery v0.18.6
k8s.io/client-go v0.18.6
Expand Down
2 changes: 2 additions & 0 deletions testdata/project-v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ go 1.13

require (
github.com/go-logr/logr v0.1.0
github.com/onsi/ginkgo v1.12.1
github.com/onsi/gomega v1.10.1
k8s.io/apimachinery v0.18.6
k8s.io/client-go v0.18.6
sigs.k8s.io/controller-runtime v0.6.4
Expand Down
2 changes: 2 additions & 0 deletions testdata/project-v3-addon/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ go 1.15

require (
github.com/go-logr/logr v0.3.0
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
k8s.io/apimachinery v0.19.2
k8s.io/client-go v0.19.2
sigs.k8s.io/controller-runtime v0.7.0
Expand Down
3 changes: 3 additions & 0 deletions testdata/project-v3-config/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ go 1.15

require (
github.com/go-logr/logr v0.3.0
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
k8s.io/api v0.19.2
k8s.io/apimachinery v0.19.2
k8s.io/client-go v0.19.2
sigs.k8s.io/controller-runtime v0.7.0
Expand Down
2 changes: 2 additions & 0 deletions testdata/project-v3-multigroup/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ go 1.15

require (
github.com/go-logr/logr v0.3.0
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
k8s.io/api v0.19.2
k8s.io/apimachinery v0.19.2
k8s.io/client-go v0.19.2
Expand Down
3 changes: 3 additions & 0 deletions testdata/project-v3/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ go 1.15

require (
github.com/go-logr/logr v0.3.0
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
k8s.io/api v0.19.2
k8s.io/apimachinery v0.19.2
k8s.io/client-go v0.19.2
sigs.k8s.io/controller-runtime v0.7.0
Expand Down

0 comments on commit 0d42eb0

Please sign in to comment.