Skip to content

Commit

Permalink
Merge pull request #64 from negz/protocol
Browse files Browse the repository at this point in the history
Bump golangci-lint to v1.55.1
  • Loading branch information
negz authored Oct 25, 2023
2 parents 142a5c0 + a11b5d9 commit 086e9dd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 11 additions & 11 deletions response/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}

Expand All @@ -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)
Expand All @@ -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 {
Expand All @@ -98,32 +98,32 @@ 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(),
})
}

// 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(),
})
}

// 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,
})
Expand Down

0 comments on commit 086e9dd

Please sign in to comment.