From a11b5d9bfc5b136df1a76362b1cefd65ad28a457 Mon Sep 17 00:00:00 2001 From: Nic Cope Date: Wed, 25 Oct 2023 16:13:34 -0700 Subject: [PATCH] Bump golangci-lint to v1.55.1 Notably this includes a handy new linter that warns when you don't use GetFoo methods to access protobuf fields. Signed-off-by: Nic Cope --- .github/workflows/ci.yml | 2 +- Makefile | 2 +- request/request.go | 2 +- response/response.go | 22 +++++++++++----------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 948caef..09e55df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: env: # Common versions GO_VERSION: '1.21.3' - GOLANGCI_VERSION: 'v1.54.2' + GOLANGCI_VERSION: 'v1.55.1' jobs: check-diff: diff --git a/Makefile b/Makefile index 929a4fc..2ee4c75 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ GO_TEST_PARALLEL := $(shell echo $$(( $(NPROCS) / 2 ))) GO_LDFLAGS += -X $(GO_PROJECT)/pkg/version.Version=$(VERSION) GO_SUBDIRS += proto GO111MODULE = on -GOLANGCILINT_VERSION = 1.54.2 +GOLANGCILINT_VERSION = 1.55.1 GO_LINT_ARGS ?= "--fix" -include build/makelib/golang.mk diff --git a/request/request.go b/request/request.go index f6de573..f42fcf0 100644 --- a/request/request.go +++ b/request/request.go @@ -99,7 +99,7 @@ func GetDesiredComposedResources(req *v1beta1.RunFunctionRequest) (map[resource. if err := resource.AsObject(r.GetResource(), dcd.Resource); err != nil { return nil, err } - switch r.Ready { + switch r.GetReady() { case v1beta1.Ready_READY_UNSPECIFIED: dcd.Ready = resource.ReadyUnspecified case v1beta1.Ready_READY_TRUE: diff --git a/response/response.go b/response/response.go index 75ee96e..714eccc 100644 --- a/response/response.go +++ b/response/response.go @@ -40,8 +40,8 @@ func To(req *v1beta1.RunFunctionRequest, ttl time.Duration) *v1beta1.RunFunction Tag: req.GetMeta().GetTag(), Ttl: durationpb.New(ttl), }, - Desired: req.Desired, - Context: req.Context, + Desired: req.GetDesired(), + Context: req.GetContext(), } } @@ -58,7 +58,7 @@ func SetContextKey(rsp *v1beta1.RunFunctionResponse, key string, v *structpb.Val // state that may have been accumulated by previous Functions in the pipeline, // unless they intend to. func SetDesiredCompositeResource(rsp *v1beta1.RunFunctionResponse, xr *resource.Composite) error { - if rsp.Desired == nil { + if rsp.GetDesired() == nil { rsp.Desired = &v1beta1.State{} } s, err := resource.AsStruct(xr.Resource) @@ -71,10 +71,10 @@ func SetDesiredCompositeResource(rsp *v1beta1.RunFunctionResponse, xr *resource. // state that may have been accumulated by previous Functions in the pipeline, // unless they intend to. func SetDesiredComposedResources(rsp *v1beta1.RunFunctionResponse, dcds map[resource.Name]*resource.DesiredComposed) error { - if rsp.Desired == nil { + if rsp.GetDesired() == nil { rsp.Desired = &v1beta1.State{} } - if rsp.Desired.Resources == nil { + if rsp.GetDesired().GetResources() == nil { rsp.Desired.Resources = map[string]*v1beta1.Resource{} } for name, dcd := range dcds { @@ -98,10 +98,10 @@ func SetDesiredComposedResources(rsp *v1beta1.RunFunctionResponse, dcds map[reso // Fatal adds a fatal result to the supplied RunFunctionResponse. func Fatal(rsp *v1beta1.RunFunctionResponse, err error) { - if rsp.Results == nil { + if rsp.GetResults() == nil { rsp.Results = make([]*v1beta1.Result, 0, 1) } - rsp.Results = append(rsp.Results, &v1beta1.Result{ + rsp.Results = append(rsp.GetResults(), &v1beta1.Result{ Severity: v1beta1.Severity_SEVERITY_FATAL, Message: err.Error(), }) @@ -109,10 +109,10 @@ func Fatal(rsp *v1beta1.RunFunctionResponse, err error) { // Warning adds a warning result to the supplied RunFunctionResponse. func Warning(rsp *v1beta1.RunFunctionResponse, err error) { - if rsp.Results == nil { + if rsp.GetResults() == nil { rsp.Results = make([]*v1beta1.Result, 0, 1) } - rsp.Results = append(rsp.Results, &v1beta1.Result{ + rsp.Results = append(rsp.GetResults(), &v1beta1.Result{ Severity: v1beta1.Severity_SEVERITY_WARNING, Message: err.Error(), }) @@ -120,10 +120,10 @@ func Warning(rsp *v1beta1.RunFunctionResponse, err error) { // Normal adds a normal result to the supplied RunFunctionResponse. func Normal(rsp *v1beta1.RunFunctionResponse, message string) { - if rsp.Results == nil { + if rsp.GetResults() == nil { rsp.Results = make([]*v1beta1.Result, 0, 1) } - rsp.Results = append(rsp.Results, &v1beta1.Result{ + rsp.Results = append(rsp.GetResults(), &v1beta1.Result{ Severity: v1beta1.Severity_SEVERITY_NORMAL, Message: message, })