Skip to content

Commit

Permalink
feat: upgrade packages to latest versions and update go version
Browse files Browse the repository at this point in the history
Signed-off-by: Dustin Scott <dustin.scott18@gmail.com>
  • Loading branch information
scottd018 committed Jun 20, 2022
1 parent f7cbc27 commit f0ec489
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions internal/plugins/workload/v1/scaffolds/templates/gomod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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",
}
}

Expand All @@ -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
Expand All @@ -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 -}}
)
`

0 comments on commit f0ec489

Please sign in to comment.