use golangci-lint v1.20

pull/227/head
iwilltry42 5 years ago
parent a13a4cc2ce
commit 97739d12d1
  1. 2
      .travis.yml
  2. 17
      Makefile

@ -8,7 +8,7 @@ git:
depth: 1
install: true
before_script:
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ${GOPATH}/bin v1.17.1
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOPATH}/bin v1.20.0
- go get github.com/mitchellh/gox@v1.0.1
script:
- make fmt check build-cross

@ -32,10 +32,11 @@ BINARIES := k3d
# Go Package required
PKG_GOX := github.com/mitchellh/gox@v1.0.1
PKG_GOLANGCI_LINT := github.com/golangci/golangci-lint/cmd/golangci-lint@v1.17.1
PKG_GOLANGCI_LINT_VERSION := v1.20.0
PKG_GOLANGCI_LINT := github.com/golangci/golangci-lint/cmd/golangci-lint@${PKG_GOLANGCI_LINT_VERSION}
# configuration adjustments for golangci-lint
GOLANGCI_LINT_DISABLED_LINTERS := typecheck # disabling typecheck, because it currently (06.09.2019) fails with Go 1.13
GOLANGCI_LINT_DISABLED_LINTERS := "" # disabling typecheck, because it currently (06.09.2019) fails with Go 1.13
# Use Go Modules for everything
export GO111MODULE=on
@ -44,7 +45,7 @@ export GO111MODULE=on
# DIRS defines a single level directly, we only look at *.go in this directory.
# REC_DIRS defines a source code tree. All go files are analyzed recursively.
DIRS := .
REC_DIRS := cmd
REC_DIRS := cli
# Rules for finding all go source files using 'DIRS' and 'REC_DIRS'
GO_SRC := $(foreach dir,$(DIRS),$(wildcard $(dir)/*.go))
@ -58,7 +59,7 @@ LINT_DIRS := $(DIRS) $(foreach dir,$(REC_DIRS),$(dir)/...)
all: clean fmt check build
build:
$(GO) build -i $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)/$(BINARIES)'
CGO_ENABLED=0 $(GO) build -i $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)/$(BINARIES)'
build-cross: LDFLAGS += -extldflags "-static"
build-cross:
@ -68,8 +69,8 @@ clean:
@rm -rf $(BINDIR) _dist/
extra-clean: clean
go clean -i $(PKG_GOX)
go clean -i $(PKG_GOLANGCI_LINT)
$(GO) clean -i $(PKG_GOX)
$(GO) clean -i $(PKG_GOLANGCI_LINT)
# fmt will fix the golang source style in place.
fmt:
@ -90,8 +91,8 @@ HAS_GOLANGCI := $(shell command -v golangci-lint 2> /dev/null)
install-tools:
ifndef HAS_GOX
(go get $(PKG_GOX))
($(GO) get $(PKG_GOX))
endif
ifndef HAS_GOLANGCI
(curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ${GOPATH}/bin v1.19.1)
(curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ${GOPATH}/bin ${PKG_GOLANGCI_LINT_VERSION})
endif

Loading…
Cancel
Save