Skip to content

Commit

Permalink
🌱 Update bingo + tools (#384)
Browse files Browse the repository at this point in the history
* Add bingo-upgrade target to Makefile

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Upgrade bingo tools

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Fix lint issues

Signed-off-by: Per Goncalves da Silva <[email protected]>

---------

Signed-off-by: Per Goncalves da Silva <[email protected]>
Co-authored-by: Per Goncalves da Silva <[email protected]>
  • Loading branch information
perdasilva and Per Goncalves da Silva authored Sep 4, 2024
1 parent 4932a18 commit a0d68e9
Show file tree
Hide file tree
Showing 17 changed files with 700 additions and 33 deletions.
18 changes: 9 additions & 9 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ $(BINGO): $(BINGO_DIR)/bingo.mod
@echo "(re)installing $(GOBIN)/bingo-v0.9.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.9.0 "github.com/bwplotka/bingo"

GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.55.2
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.60.3
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/golangci-lint-v1.55.2"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.55.2 "github.com/golangci/golangci-lint/cmd/golangci-lint"
@echo "(re)installing $(GOBIN)/golangci-lint-v1.60.3"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.60.3 "github.com/golangci/golangci-lint/cmd/golangci-lint"

GORELEASER := $(GOBIN)/goreleaser-v1.20.0
GORELEASER := $(GOBIN)/goreleaser-v1.26.2
$(GORELEASER): $(BINGO_DIR)/goreleaser.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/goreleaser-v1.20.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=goreleaser.mod -o=$(GOBIN)/goreleaser-v1.20.0 "github.com/goreleaser/goreleaser"
@echo "(re)installing $(GOBIN)/goreleaser-v1.26.2"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=goreleaser.mod -o=$(GOBIN)/goreleaser-v1.26.2 "github.com/goreleaser/goreleaser"

SETUP_ENVTEST := $(GOBIN)/setup-envtest-v0.0.0-20240110160329-8f8247fdc1c3
SETUP_ENVTEST := $(GOBIN)/setup-envtest-v0.0.0-20240820183333-e6c3d139d2b6
$(SETUP_ENVTEST): $(BINGO_DIR)/setup-envtest.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/setup-envtest-v0.0.0-20240110160329-8f8247fdc1c3"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=setup-envtest.mod -o=$(GOBIN)/setup-envtest-v0.0.0-20240110160329-8f8247fdc1c3 "sigs.k8s.io/controller-runtime/tools/setup-envtest"
@echo "(re)installing $(GOBIN)/setup-envtest-v0.0.0-20240820183333-e6c3d139d2b6"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=setup-envtest.mod -o=$(GOBIN)/setup-envtest-v0.0.0-20240820183333-e6c3d139d2b6 "sigs.k8s.io/controller-runtime/tools/setup-envtest"

6 changes: 4 additions & 2 deletions .bingo/golangci-lint.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.20
go 1.22.1

require github.com/golangci/golangci-lint v1.55.2 // cmd/golangci-lint
toolchain go1.22.5

require github.com/golangci/golangci-lint v1.60.3 // cmd/golangci-lint
176 changes: 176 additions & 0 deletions .bingo/golangci-lint.sum

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions .bingo/goreleaser.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.20
go 1.22

require github.com/goreleaser/goreleaser v1.20.0
toolchain go1.22.5

require github.com/goreleaser/goreleaser v1.26.2
463 changes: 463 additions & 0 deletions .bingo/goreleaser.sum

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions .bingo/setup-envtest.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.20
go 1.22.0

require sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240110160329-8f8247fdc1c3
toolchain go1.22.5

require sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240820183333-e6c3d139d2b6
11 changes: 11 additions & 0 deletions .bingo/setup-envtest.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo=
github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA=
github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ=
github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand Down Expand Up @@ -54,6 +59,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
Expand All @@ -68,3 +75,7 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240110160329-8f8247fdc1c3 h1:hX9CyM8mSeHLxtU78i88BcWFaNdoY3K+8SJ9L8yHY0g=
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240110160329-8f8247fdc1c3/go.mod h1:TF/lVLWS+JNNaVqJuDDictY2hZSXSsIHCx4FClMvqFg=
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240820183333-e6c3d139d2b6 h1:Wzx3QswG7gfzqPDw7Ec6/xvJGyoxAKUEoaxWLrk1V/I=
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240820183333-e6c3d139d2b6/go.mod h1:IaDsO8xSPRxRG1/rm9CP7+jPmj0nMNAuNi/yiHnLX8k=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
6 changes: 3 additions & 3 deletions .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ fi

BINGO="${GOBIN}/bingo-v0.9.0"

GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.55.2"
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.60.3"

GORELEASER="${GOBIN}/goreleaser-v1.20.0"
GORELEASER="${GOBIN}/goreleaser-v1.26.2"

SETUP_ENVTEST="${GOBIN}/setup-envtest-v0.0.0-20240110160329-8f8247fdc1c3"
SETUP_ENVTEST="${GOBIN}/setup-envtest-v0.0.0-20240820183333-e6c3d139d2b6"

3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ linters-settings:
- name: redefines-builtin-id

output:
format: tab
formats:
- format: tab
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ fix: $(GOLANGCI_LINT) ## Fixup files in the repo.
go fmt ./...
$(GOLANGCI_LINT) run --fix

.PHONY: bingo-upgrade
bingo-upgrade: $(BINGO) ## Upgrade tools
@for pkg in $$($(BINGO) list | awk '{ print $$1 }' | tail -n +3); do \
echo "Upgrading $$pkg to latest..."; \
$(BINGO) get "$$pkg@latest"; \
done

.PHONY: release
release: GORELEASER_ARGS ?= --snapshot --clean --skip-sign
release: $(GORELEASER)
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/actionclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ type mockPostRenderer struct {
var _ postrender.PostRenderer = &mockPostRenderer{}

func newMockPostRenderer(key, value string) PostRendererProvider {
return func(rm meta.RESTMapper, kubeClient kube.Interface, obj client.Object) postrender.PostRenderer {
return func(_ meta.RESTMapper, kubeClient kube.Interface, _ client.Object) postrender.PostRenderer {
return &mockPostRenderer{
k8sCli: kubeClient,
key: key,
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/actionconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (acg *actionConfigGetter) ActionConfigFor(ctx context.Context, obj client.O
func getDebugLogger(ctx context.Context) func(format string, v ...interface{}) {
logger, err := logr.FromContext(ctx)
if err != nil {
return func(format string, v ...interface{}) {}
return func(_ string, _ ...interface{}) {}
}
return func(format string, v ...interface{}) {
logger.V(1).Info(fmt.Sprintf(format, v...))
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/actionconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ metadata:
})

It("should use a custom rest config mapping", func() {
restConfigMapper := func(ctx context.Context, obj client.Object, cfg *rest.Config) (*rest.Config, error) {
restConfigMapper := func(_ context.Context, obj client.Object, _ *rest.Config) (*rest.Config, error) {
return &rest.Config{
BearerToken: obj.GetName(),
}, nil
Expand All @@ -192,7 +192,7 @@ metadata:
It("should use a custom storage driver", func() {
storageDriver := driver.NewMemory()

storageDriverMapper := func(ctx context.Context, obj client.Object, cfg *rest.Config) (driver.Driver, error) {
storageDriverMapper := func(_ context.Context, _ client.Object, _ *rest.Config) (driver.Driver, error) {
return storageDriver, nil
}
acg, err := NewActionConfigGetter(cfg, rm, StorageDriverMapper(storageDriverMapper))
Expand All @@ -209,7 +209,7 @@ metadata:

expected := &release.Release{Name: "test1", Version: 2, Info: &release.Info{Status: release.StatusDeployed}}
Expect(ac.Releases.Create(expected)).To(Succeed())
actual, err := storageDriver.List(func(r *release.Release) bool { return true })
actual, err := storageDriver.List(func(_ *release.Release) bool { return true })
Expect(err).ToNot(HaveOccurred())
Expect(actual).To(HaveLen(1))
Expect(actual[0]).To(Equal(expected))
Expand Down
11 changes: 7 additions & 4 deletions pkg/reconciler/internal/hook/hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,20 @@ var _ = Describe("Hook", func() {
Expect(err).To(HaveOccurred())
})
It("should fail with unknown owner kind", func() {
Expect(drw.Exec(owner, *rel, log)).To(MatchError(&meta.NoKindMatchError{
var err error = &meta.NoKindMatchError{
GroupKind: schema.GroupKind{Group: "apps", Kind: "Deployment"},
SearchedVersions: []string{"v1"},
}))
}

Expect(drw.Exec(owner, *rel, log)).To(MatchError(err))
})
It("should fail with unknown dependent kind", func() {
rm.Add(schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "Deployment"}, meta.RESTScopeNamespace)
Expect(drw.Exec(owner, *rel, log)).To(MatchError(&meta.NoKindMatchError{
var err error = &meta.NoKindMatchError{
GroupKind: schema.GroupKind{Group: "apps", Kind: "ReplicaSet"},
SearchedVersions: []string{"v1"},
}))
}
Expect(drw.Exec(owner, *rel, log)).To(MatchError(err))
})
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/internal/values/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var DefaultMaxReleaseHistory = 10

var DefaultMapper = values.MapperFunc(func(v chartutil.Values) chartutil.Values { return v })

var DefaultTranslator = values.TranslatorFunc(func(ctx context.Context, u *unstructured.Unstructured) (chartutil.Values, error) {
var DefaultTranslator = values.TranslatorFunc(func(_ context.Context, u *unstructured.Unstructured) (chartutil.Values, error) {
return getSpecMap(u)
})

Expand Down
6 changes: 3 additions & 3 deletions pkg/reconciler/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ var _ = Describe("Reconciler", func() {
Expect(err).ToNot(HaveOccurred())
})
It("should return an error if an option func fails", func() {
r, err := New(func(r *Reconciler) error { return errors.New("expect this error") })
r, err := New(func(_ *Reconciler) error { return errors.New("expect this error") })
Expect(r).To(BeNil())
Expect(err).To(MatchError("expect this error"))
})
Expand Down Expand Up @@ -430,7 +430,7 @@ var _ = Describe("Reconciler", func() {
})
_ = Describe("WithValueTranslator", func() {
It("should set the reconciler value translator", func() {
translator := values.TranslatorFunc(func(ctx context.Context, u *unstructured.Unstructured) (chartutil.Values, error) {
translator := values.TranslatorFunc(func(_ context.Context, _ *unstructured.Unstructured) (chartutil.Values, error) {
return chartutil.Values{"translated": true}, nil
})
Expect(WithValueTranslator(translator)(r)).To(Succeed())
Expand Down Expand Up @@ -998,7 +998,7 @@ var _ = Describe("Reconciler", func() {
})
When("value translator fails", func() {
BeforeEach(func() {
r.valueTranslator = values.TranslatorFunc(func(ctx context.Context, u *unstructured.Unstructured) (chartutil.Values, error) {
r.valueTranslator = values.TranslatorFunc(func(_ context.Context, _ *unstructured.Unstructured) (chartutil.Values, error) {
return nil, errors.New("translation failure")
})
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/chunked_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ var _ = Describe("chunkedSecrets", func() {
MaxReadChunks: 1,
MaxWriteChunks: 2,
})
actual, err := maxReadDriver.List(func(rel *release.Release) bool { return true })
actual, err := maxReadDriver.List(func(_ *release.Release) bool { return true })
Expect(err).To(MatchError(ContainSubstring("release too large")))
Expect(actual).To(BeNil())
})
Expand Down

0 comments on commit a0d68e9

Please sign in to comment.