This PR modifies gometalinter installation step and fixes all the linter warnings.
Details:
gometalinter --install is deprecated. So install gometalinter using binaries as mentioned here
gometalinter -h
...
-i, --install Attempt to install all known linters (DEPRECATED - use binary packages).
...
Fixed various warnings that made make check fail:
config/config.go:162: Warning call has possible formatting directive %s
Use glog.Wargingf instead of glog.Warning.
config.go:60:14:warning: clientset.Core is deprecated: Core retrieves the default version of CoreClient. Please explicitly pick a version. (SA1019) (megacheck)
Cherry pick the fix from #33
warnings in endpoints controller:
...
? github.com/tczekajlo/kube-consul-register/controller/endpoints [no test files]
cd /Users/arunvelsriram/go/src/github.com/tczekajlo/kube-consul-register/controller/endpoints; gometalinter --deadline 720s --vendor -D gotype -D dupl -D gocyclo -D gas -D errcheck
controller.go:197::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:223::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:235::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:33:2:warning: var addedServices is unused (U1000) (megacheck)
controller.go:34:2:warning: var addedConsulServices is unused (U1000) (megacheck)
make: *** [github.com/tczekajlo/kube-consul-register/controller/endpoints] Error 1
Add error handlers
Removed unused variables
warnings in pods controller:
...
go test -race github.com/tczekajlo/kube-consul-register/controller/pods
ok github.com/tczekajlo/kube-consul-register/controller/pods (cached)
cd /Users/arunvelsriram/go/src/github.com/tczekajlo/kube-consul-register/controller/pods; gometalinter --deadline 720s --vendor -D gotype -D dupl -D gocyclo -D gas -D errcheck
controller.go:222::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:259::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:272::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:154:25:warning: this result of append is never used, except maybe in other appends (SA4010) (megacheck)
make: *** [github.com/tczekajlo/kube-consul-register/controller/pods] Error 1
Add error handlers
Ignore megacheck linter as it was reporting a false positive
warnings in services controller:
...
go test -race github.com/tczekajlo/kube-consul-register/controller/services
? github.com/tczekajlo/kube-consul-register/controller/services [no test files]
cd /Users/arunvelsriram/go/src/github.com/tczekajlo/kube-consul-register/controller/services; gometalinter --deadline 720s --vendor -D gotype -D dupl -D gocyclo -D gas -D errcheck
controller.go:295::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:327::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:338::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:347::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:351::warning: Errors unhandled.,LOW,HIGH (gosec)
controller.go:33:2:warning: var addedServices is unused (U1000) (megacheck)
controller.go:560:22:warning: func (*Controller).getPod is unused (U1000) (megacheck)
make: *** [github.com/tczekajlo/kube-consul-register/controller/services] Error 1
Add error handlers
Remove unused varable and method
warnings in controller factory:
go test -race github.com/tczekajlo/kube-consul-register/metrics
? github.com/tczekajlo/kube-consul-register/metrics [no test files]
cd /Users/arunvelsriram/go/src/github.com/tczekajlo/kube-consul-register/metrics; gometalinter --deadline 720s --vendor -D gotype -D dupl -D gocyclo -D gas -D errcheck
controller.go:15:2:warning: comment on exported var PodSuccess should be of the form "PodSuccess ..." (golint)
make: *** [github.com/tczekajlo/kube-consul-register/metrics] Error 1
This PR modifies
gometalinter
installation step and fixes all the linter warnings.Details:
gometalinter --install
is deprecated. So installgometalinter
using binaries as mentioned hereFixed various warnings that made
make check
fail:config/config.go:162: Warning call has possible formatting directive %s
glog.Wargingf
instead ofglog.Warning
.config.go:60:14:warning: clientset.Core is deprecated: Core retrieves the default version of CoreClient. Please explicitly pick a version. (SA1019) (megacheck)
warnings in endpoints controller:
megacheck
linter as it was reporting a false positive