Skip to content

Commit

Permalink
Merge pull request #318 from jrasell/use-golangci
Browse files Browse the repository at this point in the history
Use golangci rather than deprecated metalinter for lint checks.
  • Loading branch information
jrasell committed Dec 6, 2019
2 parents 38ecc67 + 7fa8ed3 commit b3b7510
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 27 deletions.
44 changes: 44 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
run:
deadline: 5m
issues-exit-code: 1
tests: true

output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true

linters:
enable:
- deadcode
- errcheck
- goimports
- gofmt
- golint
- govet
- ineffassign
- misspell
- structcheck
- unconvert
- varcheck
- interfacer
- unparam
- depguard
- goconst
- gocyclo
- gosec
- maligned
- prealloc
disable:
# - nakedret
# - gosimple
# - staticcheck
# - stylecheck
# - unused
# - dupl
# - gochecknoinits
# - gochecknoglobals
# - lll
# - typecheck
enable-all: false
disable-all: true
24 changes: 3 additions & 21 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ default: check test build
tools: ## Install the tools used to test and build
@echo "==> Installing build tools"
go get github.com/ahmetb/govvv
go get github.com/alecthomas/gometalinter
gometalinter --install
GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

.PHONY: build
build: ## Build Levant for development purposes
Expand All @@ -29,26 +28,9 @@ release: ## Trigger the release build script
@goreleaser --rm-dist

.PHONY: check
check: ## Run the gometalinter suite
check: ## Run golangci-lint
@echo "==> Running $@..."
gometalinter \
--deadline 10m \
--vendor \
--sort="path" \
--aggregate \
--disable-all \
--enable golint \
--enable-gc \
--enable goimports \
--enable misspell \
--enable vet \
--enable deadcode \
--enable varcheck \
--enable ineffassign \
--enable structcheck \
--enable errcheck \
--enable gofmt \
./...
golangci-lint run buildtime/... client/... command/... helper/... levant/... logging/... scale/... template/... version/...

HELP_FORMAT=" \033[36m%-25s\033[0m %s\n"
.PHONY: help
Expand Down
2 changes: 1 addition & 1 deletion levant/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (l *levantDeployment) deploymentWatcher(depID string) (success bool) {
deploymentChan := make(chan interface{})

t := time.Now()
wt := time.Duration(5 * time.Second)
wt := 5 * time.Second

// Setup the canaryChan and launch the autoPromote go routine if autoPromote
// has been enabled.
Expand Down
4 changes: 2 additions & 2 deletions levant/job_status_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (l *levantDeployment) jobStatusChecker(evalID *string) bool {

// Run the initial job status check to ensure the job reaches a state of
// running.
jStatus := l.simpleJobStatusChecker(*l.config.Template.Job.ID)
jStatus := l.simpleJobStatusChecker()

// Periodic and parameterized batch jobs do not produce evaluations and so
// can only go through the simplest of checks.
Expand All @@ -40,7 +40,7 @@ func (l *levantDeployment) jobStatusChecker(evalID *string) bool {

// simpleJobStatusChecker is used to check that jobs which do not emit initial
// evaluations at least reach a job status of running.
func (l *levantDeployment) simpleJobStatusChecker(jobID string) bool {
func (l *levantDeployment) simpleJobStatusChecker() bool {

q := &nomad.QueryOptions{WaitIndex: 1}

Expand Down
6 changes: 3 additions & 3 deletions levant/structs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ type DeployConfig struct {
// and force the count based on the rendered job file.
ForceCount bool

// VaultToken is a string with the vault token.
VaultToken string

// EnvVault is a boolean flag that can be used to enable reading the VAULT_TOKEN
// from the enviromment.
EnvVault bool

// VaultToken is a string with the vault token.
VaultToken string
}

// ClientConfig is the config struct which houses all the information needed to connect
Expand Down

0 comments on commit b3b7510

Please sign in to comment.