From 2664dd35d13c1d8796685be93adb6d3e0333e904 Mon Sep 17 00:00:00 2001 From: Antti Kupila Date: Fri, 1 Mar 2019 09:19:32 +0100 Subject: [PATCH] replace gometalinter with golangci-lint (#4) --- .circleci/config.yml | 13 ++++++------- parser_test.go | 4 +++- printer.go | 24 ++++++++++++------------ 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 057feeb..805cecb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,16 +9,15 @@ jobs: steps: - checkout - run: - name: Install gometalinter + name: Install golangci-lint + environment: + GOLANGCI_LINT_TAG: v1.15.0 command: | - go get github.com/alecthomas/gometalinter - gometalinter --install + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -d -b $GOPATH/bin $GOLANGCI_LINT_TAG - run: - name: Run gometalinter - environment: - CGO_ENABLED: 0 + name: Lint command: | - gometalinter ./... + golangci-lint run ./... -v - run: name: Test command: | diff --git a/parser_test.go b/parser_test.go index 268307e..62613aa 100644 --- a/parser_test.go +++ b/parser_test.go @@ -233,7 +233,9 @@ func setupRemote(t *testing.T, dir string) (string, func()) { func setupCommands(t *testing.T, dir, commands string) { commands = "set -eo pipefail\n" + commands script := path.Join(dir, "setup.sh") - ioutil.WriteFile(script, []byte(commands), 0644) + if err := ioutil.WriteFile(script, []byte(commands), 0644); err != nil { + t.Fatal(err) + } cmd := exec.Command("bash", "setup.sh") var stderr bytes.Buffer var stdout bytes.Buffer diff --git a/printer.go b/printer.go index 37d3eff..0ee5db5 100644 --- a/printer.go +++ b/printer.go @@ -12,12 +12,12 @@ import ( const ( tAttribute rune = '@' - tColor = '#' - tReset = '_' - tData = '%' - tGroupOp = '[' - tGroupCl = ']' - tEsc = '\\' + tColor rune = '#' + tReset rune = '_' + tData rune = '%' + tGroupOp rune = '[' + tGroupCl rune = ']' + tEsc rune = '\\' ) var attrs = map[rune]uint8{ @@ -53,12 +53,12 @@ var colors = map[rune]uint8{ const ( head rune = 'h' - untracked = 'u' - modified = 'm' - staged = 's' - conflicts = 'c' - ahead = 'a' - behind = 'b' + untracked rune = 'u' + modified rune = 'm' + staged rune = 's' + conflicts rune = 'c' + ahead rune = 'a' + behind rune = 'b' ) type group struct {