summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Beck <marcel@beck.im>2019-05-02 18:56:57 +0200
committerMarcel Beck <marcel@beck.im>2019-05-02 19:02:56 +0200
commitb65e14e1fda1c005a07ec9b98e746ce3d699521a (patch)
treed141336079455501063b2c11c70fcfd0057d2978
parent20937becaa32cdec93e77a84ad04c73e9155b8e7 (diff)
chore: Switch from gometalinter to golangci-lint
Github Issue: #546
-rw-r--r--Makefile43
-rw-r--r--cmd/gomplate/main.go10
-rw-r--r--data/datasource_test.go10
-rw-r--r--random/random.go3
4 files changed, 29 insertions, 37 deletions
diff --git a/Makefile b/Makefile
index 591f5c8d..56587076 100644
--- a/Makefile
+++ b/Makefile
@@ -117,39 +117,32 @@ gomplate.png: gomplate.svg
cloudconvert -f png -c density=288 $^
lint:
- gometalinter --vendor --disable-all \
- --enable=gosec \
- --enable=goconst \
- --enable=gocyclo \
- --enable=golint \
- --enable=gotypex \
- --enable=ineffassign \
- --enable=vet \
- --enable=vetshadow \
- --enable=misspell \
- --enable=goimports \
- --enable=gofmt \
- ./...
- gometalinter --vendor --skip tests --disable-all \
- --enable=deadcode \
- ./...
+ golangci-lint run --tests --disable-all \
+ --enable gosec \
+ --enable goconst \
+ --enable gocyclo \
+ --enable golint \
+ --enable ineffassign \
+ --enable govet \
+ --enable misspell \
+ --enable goimports \
+ --enable gofmt
+ golangci-lint run --tests=false --disable-all \
+ --enable deadcode
slow-lint:
- gometalinter -j $(LINT_PROCS) --vendor --skip tests --deadline 120s \
- --disable gotype \
+ golangci-lint run --concurrency $(LINT_PROCS) --tests=false --deadline 120s \
--enable gofmt \
--enable goimports \
- --enable misspell \
- ./...
- gometalinter -j $(LINT_PROCS) --vendor --deadline 120s \
- --disable gotype \
- --disable megacheck \
+ --enable misspell
+ golangci-lint run --concurrency $(LINT_PROCS) --tests --deadline 120s \
--disable deadcode \
+ --disable errcheck \
+ --disable unused \
--enable gofmt \
--enable goimports \
--enable misspell \
- ./tests/integration
- megacheck -tags integration ./tests/integration
+ tests/integration
.PHONY: gen-changelog clean test build-x compress-all build-release build test-integration-docker gen-docs lint clean-images clean-containers docker-images
.DELETE_ON_ERROR:
diff --git a/cmd/gomplate/main.go b/cmd/gomplate/main.go
index 3c125c7d..e2d77da0 100644
--- a/cmd/gomplate/main.go
+++ b/cmd/gomplate/main.go
@@ -77,12 +77,10 @@ func postRunExec(cmd *cobra.Command, args []string) error {
signal.Notify(sigs)
go func() {
// Pass signals to the sub-process
- select {
- case sig := <-sigs:
- if c.Process != nil {
- // nolint: gosec
- c.Process.Signal(sig)
- }
+ sig := <-sigs
+ if c.Process != nil {
+ // nolint: gosec
+ _ = c.Process.Signal(sig)
}
}()
diff --git a/data/datasource_test.go b/data/datasource_test.go
index 32c1219d..ea542b10 100644
--- a/data/datasource_test.go
+++ b/data/datasource_test.go
@@ -12,6 +12,8 @@ import (
"github.com/stretchr/testify/assert"
)
+const osWindows = "windows"
+
func TestNewData(t *testing.T) {
d, err := NewData(nil, nil)
assert.NoError(t, err)
@@ -63,7 +65,7 @@ func TestParseSourceWithAlias(t *testing.T) {
assert.True(t, s.URL.IsAbs())
assert.Equal(t, "/otherdir/foo.json", s.URL.Path)
- if runtime.GOOS == "windows" {
+ if runtime.GOOS == osWindows {
s, err = parseSource("data=foo.json")
assert.NoError(t, err)
assert.Equalf(t, byte(':'), s.URL.Path[1], "Path was %s", s.URL.Path)
@@ -111,7 +113,7 @@ func TestDatasource(t *testing.T) {
fs := afero.NewMemMapFs()
var uPath string
var f afero.File
- if runtime.GOOS == "windows" {
+ if runtime.GOOS == osWindows {
_ = fs.Mkdir("C:\\tmp", 0777)
f, _ = fs.Create("C:\\tmp\\" + fname)
_, _ = f.Write(contents)
@@ -158,7 +160,7 @@ func TestDatasourceReachable(t *testing.T) {
fs := afero.NewMemMapFs()
var uPath string
var f afero.File
- if runtime.GOOS == "windows" {
+ if runtime.GOOS == osWindows {
_ = fs.Mkdir("C:\\tmp", 0777)
f, _ = fs.Create("C:\\tmp\\" + fname)
uPath = "C:/tmp/" + fname
@@ -205,7 +207,7 @@ func TestInclude(t *testing.T) {
var uPath string
var f afero.File
- if runtime.GOOS == "windows" {
+ if runtime.GOOS == osWindows {
_ = fs.Mkdir("C:\\tmp", 0777)
f, _ = fs.Create("C:\\tmp\\" + fname)
uPath = "C:/tmp/" + fname
diff --git a/random/random.go b/random/random.go
index 58a44d7d..7dcb4179 100644
--- a/random/random.go
+++ b/random/random.go
@@ -19,8 +19,7 @@ const defaultSet = "-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstu
// StringRE - Generate a random string that matches a given regular
// expression. Defaults to "[a-zA-Z0-9_.-]"
func StringRE(count int, match string) (r string, err error) {
- var chars []rune
- chars = []rune(defaultSet)
+ var chars = []rune(defaultSet)
if match != "" {
chars, err = matchChars(match)
if err != nil {