Commit 3dca5774 authored by Cristian Maglie's avatar Cristian Maglie Committed by Cristian Maglie

Updated linter and fixed warnings

parent c428dc37
run:
skip-dirs:
- legacy
linters-settings: linters-settings:
govet: govet:
check-shadowing: true check-shadowing: true
...@@ -21,6 +25,9 @@ linters-settings: ...@@ -21,6 +25,9 @@ linters-settings:
linters: linters:
enable-all: true enable-all: true
disable: disable:
- goimports
- gocritic
- gochecknoglobals
- gosec - gosec
- deadcode - deadcode
- dupl - dupl
......
...@@ -10,9 +10,7 @@ env: ...@@ -10,9 +10,7 @@ env:
# build and immediately stop. It's sorta like having set -e enabled in bash. # build and immediately stop. It's sorta like having set -e enabled in bash.
# Make sure golangci-lint is vendored. # Make sure golangci-lint is vendored.
before_install: before_install:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.10.2 - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.16.0
# 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
install: true install: true
......
...@@ -37,18 +37,14 @@ type Formatter interface { ...@@ -37,18 +37,14 @@ type Formatter interface {
// PrintFunc represents a function used to print formatted data. // PrintFunc represents a function used to print formatted data.
type PrintFunc func(Formatter, interface{}) error type PrintFunc func(Formatter, interface{}) error
var formatters map[string]Formatter var formatters = map[string]Formatter{
var defaultFormatter Formatter "text": &TextFormatter{},
"json": &JSONFormatter{},
}
var defaultFormatter = formatters["text"]
var logger *logrus.Logger 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. // SetFormatter sets the defaults format to the one specified, if valid. Otherwise it returns an error.
func SetFormatter(formatName string) error { func SetFormatter(formatName string) error {
if !IsSupported(formatName) { if !IsSupported(formatName) {
......
...@@ -36,9 +36,10 @@ func TestNavigate(t *testing.T) { ...@@ -36,9 +36,10 @@ func TestNavigate(t *testing.T) {
"inheritance", "inheritance",
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt, func(t *testing.T) { _tt := tt
pwd := paths.New("testdata", "navigate", tt, "first", "second") t.Run(_tt, func(t *testing.T) {
golden := filepath.Join("testdata", "navigate", tt, "golden.yaml") pwd := paths.New("testdata", "navigate", _tt, "first", "second")
golden := filepath.Join("testdata", "navigate", _tt, "golden.yaml")
config, _ := configs.NewConfiguration() config, _ := configs.NewConfiguration()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment