diff --git a/internal/plugins/workload/v1/scaffolds/templates/gomod.go b/internal/plugins/workload/v1/scaffolds/templates/gomod.go index 51a64e4..898878e 100644 --- a/internal/plugins/workload/v1/scaffolds/templates/gomod.go +++ b/internal/plugins/workload/v1/scaffolds/templates/gomod.go @@ -9,11 +9,16 @@ import ( var _ machinery.Template = &GoMod{} +const ( + GoVersion = "1.18" +) + // GoMod scaffolds a file that defines the project dependencies. type GoMod struct { machinery.TemplateMixin machinery.RepositoryMixin + GoVersion string Dependencies map[string]string } @@ -23,19 +28,20 @@ type GoMod struct { // See https://github.com/vmware-tanzu-labs/operator-builder/issues/250 func goModDependencyMap() map[string]string { return map[string]string{ - "github.com/go-logr/logr": "v0.4.0", - "github.com/nukleros/operator-builder-tools": "v0.2.0", - "github.com/onsi/ginkgo": "v1.16.4", - "github.com/onsi/gomega": "v1.15.0", - "github.com/spf13/cobra": "v1.2.1", - "github.com/stretchr/testify": "v1.7.0", + "github.com/go-logr/logr": "v1.2.3", + "github.com/nukleros/operator-builder-tools": "v0.3.0", + "github.com/onsi/ginkgo": "v1.16.5", + "github.com/onsi/gomega": "v1.19.0", + "github.com/spf13/cobra": "v1.4.0", + "github.com/stretchr/testify": "v1.7.3", + "google.golang.org/api": "v0.84.0", "gopkg.in/yaml.v2": "v2.4.0", - "k8s.io/api": "v0.22.2", - "k8s.io/apimachinery": "v0.22.2", - "k8s.io/client-go": "v0.22.2", - "sigs.k8s.io/controller-runtime": "v0.10.2", - "sigs.k8s.io/kubebuilder/v3": "v3.2.0", - "sigs.k8s.io/yaml": "v1.2.0", + "k8s.io/api": "v0.24.2", + "k8s.io/apimachinery": "v0.24.2", + "k8s.io/client-go": "v0.24.2", + "sigs.k8s.io/controller-runtime": "v0.12.1", + "sigs.k8s.io/kubebuilder/v3": "v3.4.1", + "sigs.k8s.io/yaml": "v1.3.0", } } @@ -44,6 +50,7 @@ func (f *GoMod) SetTemplateDefaults() error { f.Path = "go.mod" } + f.GoVersion = GoVersion f.Dependencies = goModDependencyMap() f.TemplateBody = goModTemplate f.IfExistsAction = machinery.OverwriteFile @@ -54,11 +61,11 @@ func (f *GoMod) SetTemplateDefaults() error { const goModTemplate = ` module {{ .Repo }} -go 1.15 +go {{ .GoVersion }} require ( - {{ range $k, $v := $.Dependencies }} - "{{ $k }}" {{ $v }} + {{ range $package, $version := $.Dependencies }} + "{{ $package }}" {{ $version }} {{ end -}} ) `