Skip to content

Commit

Permalink
Updated linter and fixed warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Jun 6, 2019
1 parent c428dc3 commit 3dca577
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
run:
skip-dirs:
- legacy

linters-settings:
govet:
check-shadowing: true
Expand All @@ -21,6 +25,9 @@ linters-settings:
linters:
enable-all: true
disable:
- goimports
- gocritic
- gochecknoglobals
- gosec
- deadcode
- dupl
Expand Down
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ env:
# build and immediately stop. It's sorta like having set -e enabled in bash.
# Make sure golangci-lint is vendored.
before_install:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.10.2
# Download the binary to bin folder in $GOPATH
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.16.0

install: true

Expand Down
14 changes: 5 additions & 9 deletions common/formatter/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,14 @@ type Formatter interface {
// PrintFunc represents a function used to print formatted data.
type PrintFunc func(Formatter, interface{}) error

var formatters map[string]Formatter
var defaultFormatter Formatter
var formatters = map[string]Formatter{
"text": &TextFormatter{},
"json": &JSONFormatter{},
}
var defaultFormatter = formatters["text"]

var logger *logrus.Logger

func init() {
formatters = make(map[string]Formatter, 2)
AddCustomFormatter("text", &TextFormatter{})
AddCustomFormatter("json", &JSONFormatter{})
defaultFormatter = formatters["text"]
}

// SetFormatter sets the defaults format to the one specified, if valid. Otherwise it returns an error.
func SetFormatter(formatName string) error {
if !IsSupported(formatName) {
Expand Down
7 changes: 4 additions & 3 deletions configs/navigate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ func TestNavigate(t *testing.T) {
"inheritance",
}
for _, tt := range tests {
t.Run(tt, func(t *testing.T) {
pwd := paths.New("testdata", "navigate", tt, "first", "second")
golden := filepath.Join("testdata", "navigate", tt, "golden.yaml")
_tt := tt
t.Run(_tt, func(t *testing.T) {
pwd := paths.New("testdata", "navigate", _tt, "first", "second")
golden := filepath.Join("testdata", "navigate", _tt, "golden.yaml")

config, _ := configs.NewConfiguration()

Expand Down

0 comments on commit 3dca577

Please sign in to comment.