From 00c50be004aec869f5018ea3e954c08300f8469b Mon Sep 17 00:00:00 2001 From: Michael McLoughlin Date: Wed, 5 Dec 2018 00:49:12 -0800 Subject: [PATCH] enable some more linters --- .golangci.yml | 23 +++++++++++++++++++++++ .travis.yml | 2 ++ internal/load/load.go | 3 +-- script/lint | 3 +++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..e1606a0 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,23 @@ +linters: + enable-all: false + enable: + - structcheck + - varcheck + - ineffassign + - typecheck + - megacheck + - deadcode + - govet + - errcheck + - goimports + - depguard + - goconst + - unconvert + - gocritic + +linters-settings: + depguard: + list-type: whitelist + packages: + - github.com/mmcloughlin/avo + - golang.org/x/arch/x86 diff --git a/.travis.yml b/.travis.yml index 884c4da..826d9ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: go go: - 1.11.1 +install: +- ./script/bootstrap script: - ./script/lint - go test ./... diff --git a/internal/load/load.go b/internal/load/load.go index fbc87fd..417b55a 100644 --- a/internal/load/load.go +++ b/internal/load/load.go @@ -374,8 +374,7 @@ func operand(op opcodesxml.Operand) inst.Operand { func datasize(f opcodesxml.Form) int { // Determine from encoding bits. e := f.Encoding - switch { - case e.VEX != nil && e.VEX.W == nil: + if e.VEX != nil && e.VEX.W == nil { return 128 << e.VEX.L } diff --git a/script/lint b/script/lint index 0dce6cc..8293fc5 100755 --- a/script/lint +++ b/script/lint @@ -3,3 +3,6 @@ # Ensure the repository is clean after code generation. ./script/generate test -z "$(git status --porcelain)" + +# Run suite of golangci-lint checks. +golangci-lint run