Skip to content

Commit

Permalink
cleanup: add vet and make it pass (#3241)
Browse files Browse the repository at this point in the history
* make go vet pass

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>

* add vet to makefile

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>

---------

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Co-authored-by: Per Goncalves da Silva <pegoncal@redhat.com>
  • Loading branch information
perdasilva and Per Goncalves da Silva authored May 10, 2024
1 parent ef919fe commit 1c406c2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ endif
.PHONY: FORCE
FORCE:

.PHONY: vet
vet:
go vet $(MOD_FLAGS) ./...

all: test build

test: clean cover.out
Expand Down Expand Up @@ -73,7 +77,7 @@ coverage-html: cover.out
go tool cover -html=cover.out

build: build_cmd=build
build: clean $(CMDS)
build: clean vet $(CMDS)

# build versions of the binaries with coverage enabled
build-coverage: build_cmd=test -c -covermode=count -coverpkg ./pkg/controller/...
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/client/clientset/versioned/fake/decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func NewReactionForwardingClientsetDecorator(objects []runtime.Object, options .

// Swap out the embedded ReactionChain with a Reactor that reduces over the decorator's ReactionChain.
decorator.ReactionChain = decorator.Clientset.ReactionChain
decorator.Clientset.ReactionChain = []testing.Reactor{&testing.SimpleReactor{"*", "*", decorator.reduceReactions}}
decorator.Clientset.ReactionChain = []testing.Reactor{&testing.SimpleReactor{Verb: "*", Resource: "*", Reaction: decorator.reduceReactions}}

// Apply options
for _, option := range options {
Expand Down Expand Up @@ -81,5 +81,5 @@ func (c *ReactionForwardingClientsetDecorator) reduceReactions(action testing.Ac

// PrependReactor adds a reactor to the beginning of the chain.
func (c *ReactionForwardingClientsetDecorator) PrependReactor(verb, resource string, reaction testing.ReactionFunc) {
c.ReactionChain = append([]testing.Reactor{&testing.SimpleReactor{verb, resource, reaction}}, c.ReactionChain...)
c.ReactionChain = append([]testing.Reactor{&testing.SimpleReactor{Verb: verb, Resource: resource, Reaction: reaction}}, c.ReactionChain...)
}
4 changes: 2 additions & 2 deletions pkg/lib/clientfake/decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewReactionForwardingClientsetDecorator(objects []runtime.Object, options .

// Swap out the embedded ReactionChain with a Reactor that reduces over the decorator's ReactionChain.
decorator.ReactionChain = decorator.Clientset.ReactionChain
decorator.Clientset.ReactionChain = []testing.Reactor{&testing.SimpleReactor{"*", "*", decorator.reduceReactions}}
decorator.Clientset.ReactionChain = []testing.Reactor{&testing.SimpleReactor{Verb: "*", Resource: "*", Reaction: decorator.reduceReactions}}

// Apply options
for _, option := range options {
Expand Down Expand Up @@ -68,5 +68,5 @@ func (c *ReactionForwardingClientsetDecorator) reduceReactions(action testing.Ac

// PrependReactor adds a reactor to the beginning of the chain.
func (c *ReactionForwardingClientsetDecorator) PrependReactor(verb, resource string, reaction testing.ReactionFunc) {
c.ReactionChain = append([]testing.Reactor{&testing.SimpleReactor{verb, resource, reaction}}, c.ReactionChain...)
c.ReactionChain = append([]testing.Reactor{&testing.SimpleReactor{Verb: verb, Resource: resource, Reaction: reaction}}, c.ReactionChain...)
}
8 changes: 4 additions & 4 deletions pkg/lib/operatorstatus/csv_reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestGetNewStatus(t *testing.T) {
},
Spec: v1alpha1.ClusterServiceVersionSpec{
Version: version.OperatorVersion{
semver.Version{
Version: semver.Version{
Major: 1, Minor: 0, Patch: 0,
},
},
Expand Down Expand Up @@ -100,7 +100,7 @@ func TestGetNewStatus(t *testing.T) {
},
Spec: v1alpha1.ClusterServiceVersionSpec{
Version: version.OperatorVersion{
semver.Version{
Version: semver.Version{
Major: 1, Minor: 0, Patch: 0,
},
},
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestGetNewStatus(t *testing.T) {
},
Spec: v1alpha1.ClusterServiceVersionSpec{
Version: version.OperatorVersion{
semver.Version{
Version: semver.Version{
Major: 1, Minor: 0, Patch: 0,
},
},
Expand Down Expand Up @@ -260,7 +260,7 @@ func TestGetNewStatus(t *testing.T) {
},
Spec: v1alpha1.ClusterServiceVersionSpec{
Version: version.OperatorVersion{
semver.Version{
Version: semver.Version{
Major: 1, Minor: 0, Patch: 0,
},
},
Expand Down

0 comments on commit 1c406c2

Please sign in to comment.