Skip to content

Commit

Permalink
Update linter to golangci-lint and fix associated issues
Browse files Browse the repository at this point in the history
Signed-Off-By: Joe Handzik <[email protected]>
  • Loading branch information
joehandzik committed Jun 19, 2019
1 parent 3e7964a commit fcf073d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sudo: false

language: go
go:
- 1.8.x
- 1.11.x
- tip

before_install:
Expand Down
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
GO ?= GO15VENDOREXPERIMENT=1 go
GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
PROMU ?= $(GOPATH)/bin/promu
GOLINTER ?= $(GOPATH)/bin/gometalinter
GOLINTER ?= $(GOPATH)/bin/golangci-lint
#aligncheck and gosimple took unfortunately too long at travisCI
GOLINTER_OPT ?= --vendor --deadline 6m --cyclo-over=20 --disable=aligncheck --disable=gosimple --disable=gotype
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
TARGET ?= lustre_exporter

Expand All @@ -35,8 +34,7 @@ format:

gometalinter: $(GOLINTER)
@echo ">> linting code"
@$(GOLINTER) --install --update > /dev/null
@$(GOLINTER) $(GOLINTER_OPT) ./...
@$(GOLINTER) run

build: $(PROMU)
@echo ">> building binaries"
Expand All @@ -51,9 +49,9 @@ $(GOPATH)/bin/promu promu:
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
$(GO) get -u github.com/prometheus/promu

$(GOPATH)/bin/gometalinter lint:
$(GOPATH)/bin/golangci-lint lint:
@GOOS=$(shell uname -s | tr A-Z a-z) \
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
$(GO) get -u github.com/alecthomas/gometalinter
$(GO) get -u github.com/golangci/golangci-lint/cmd/golangci-lint

.PHONY: all format vet build test promu clean $(GOPATH)/bin/promu $(GOPATH)/bin/gometalinter lint
2 changes: 1 addition & 1 deletion sources/proc_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func convertToBytes(s string) string {
}
numericS := ""
uppercaseS := strings.ToUpper(s)
multiplier := float64(1)
var multiplier float64
switch finalChar := uppercaseS[len(uppercaseS)-1:]; finalChar {
case "K":
numericS = strings.TrimSuffix(uppercaseS, "K")
Expand Down
3 changes: 0 additions & 3 deletions sources/procsys.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ func (s *lustreProcsysSource) Update(ch chan<- prometheus.Metric) (err error) {
}

func parseSysStatsFile(helpText string, promName string, statsFile string) (metric lustreStatsMetric, err error) {
if err != nil {
return metric, err
}
// statsMap contains the index mapping for the provided statistic
statsMap := map[string]int{
lnetAllocatedHelp: 0,
Expand Down

0 comments on commit fcf073d

Please sign in to comment.