Skip to content

Commit 1c406c2

Browse files
perdasilvaPer Goncalves da Silva
andauthored
cleanup: add vet and make it pass (#3241)
* make go vet pass Signed-off-by: Per Goncalves da Silva <[email protected]> * add vet to makefile 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]>
1 parent ef919fe commit 1c406c2

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ endif
4141
.PHONY: FORCE
4242
FORCE:
4343

44+
.PHONY: vet
45+
vet:
46+
go vet $(MOD_FLAGS) ./...
47+
4448
all: test build
4549

4650
test: clean cover.out
@@ -73,7 +77,7 @@ coverage-html: cover.out
7377
go tool cover -html=cover.out
7478

7579
build: build_cmd=build
76-
build: clean $(CMDS)
80+
build: clean vet $(CMDS)
7781

7882
# build versions of the binaries with coverage enabled
7983
build-coverage: build_cmd=test -c -covermode=count -coverpkg ./pkg/controller/...

pkg/api/client/clientset/versioned/fake/decorator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func NewReactionForwardingClientsetDecorator(objects []runtime.Object, options .
4747

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

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

8282
// PrependReactor adds a reactor to the beginning of the chain.
8383
func (c *ReactionForwardingClientsetDecorator) PrependReactor(verb, resource string, reaction testing.ReactionFunc) {
84-
c.ReactionChain = append([]testing.Reactor{&testing.SimpleReactor{verb, resource, reaction}}, c.ReactionChain...)
84+
c.ReactionChain = append([]testing.Reactor{&testing.SimpleReactor{Verb: verb, Resource: resource, Reaction: reaction}}, c.ReactionChain...)
8585
}

pkg/lib/clientfake/decorator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func NewReactionForwardingClientsetDecorator(objects []runtime.Object, options .
3434

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

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

6969
// PrependReactor adds a reactor to the beginning of the chain.
7070
func (c *ReactionForwardingClientsetDecorator) PrependReactor(verb, resource string, reaction testing.ReactionFunc) {
71-
c.ReactionChain = append([]testing.Reactor{&testing.SimpleReactor{verb, resource, reaction}}, c.ReactionChain...)
71+
c.ReactionChain = append([]testing.Reactor{&testing.SimpleReactor{Verb: verb, Resource: resource, Reaction: reaction}}, c.ReactionChain...)
7272
}

pkg/lib/operatorstatus/csv_reporter_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestGetNewStatus(t *testing.T) {
3737
},
3838
Spec: v1alpha1.ClusterServiceVersionSpec{
3939
Version: version.OperatorVersion{
40-
semver.Version{
40+
Version: semver.Version{
4141
Major: 1, Minor: 0, Patch: 0,
4242
},
4343
},
@@ -100,7 +100,7 @@ func TestGetNewStatus(t *testing.T) {
100100
},
101101
Spec: v1alpha1.ClusterServiceVersionSpec{
102102
Version: version.OperatorVersion{
103-
semver.Version{
103+
Version: semver.Version{
104104
Major: 1, Minor: 0, Patch: 0,
105105
},
106106
},
@@ -180,7 +180,7 @@ func TestGetNewStatus(t *testing.T) {
180180
},
181181
Spec: v1alpha1.ClusterServiceVersionSpec{
182182
Version: version.OperatorVersion{
183-
semver.Version{
183+
Version: semver.Version{
184184
Major: 1, Minor: 0, Patch: 0,
185185
},
186186
},
@@ -260,7 +260,7 @@ func TestGetNewStatus(t *testing.T) {
260260
},
261261
Spec: v1alpha1.ClusterServiceVersionSpec{
262262
Version: version.OperatorVersion{
263-
semver.Version{
263+
Version: semver.Version{
264264
Major: 1, Minor: 0, Patch: 0,
265265
},
266266
},

0 commit comments

Comments
 (0)