switch staticcheck for megacheck and fix things it complains about

This commit is contained in:
Kevin Burke
2017-05-26 10:01:24 -07:00
parent 6dcd4cf595
commit 2b54512628
5 changed files with 7 additions and 18 deletions
+6 -4
View File
@@ -1,12 +1,14 @@
BUMP_VERSION := $(shell command -v bump_version)
STATICCHECK := $(shell command -v staticcheck)
MEGACHECK := $(shell command -v megaccheck)
IGNORES := 'github.com/kevinburke/ssh_config/config.go:U1000 github.com/kevinburke/ssh_config/config.go:S1002 github.com/kevinburke/ssh_config/token.go:U1000'
lint:
go vet ./...
ifndef STATICCHECK
go get -u honnef.co/go/tools/cmd/staticcheck
ifndef MEGACHECK
go get -u honnef.co/go/tools/cmd/megacheck
endif
staticcheck ./...
megacheck --ignore=$(IGNORES) ./...
test: lint
@# the timeout helps guard against infinite recursion
-1
View File
@@ -55,7 +55,6 @@ type UserSettings struct {
systemConfigFinder configFinder
userConfig *Config
userConfigFinder configFinder
username string
loadConfigs sync.Once
onceErr error
}
+1 -1
View File
@@ -293,7 +293,7 @@ var matchTests = []struct {
func TestMatches(t *testing.T) {
for _, tt := range matchTests {
patterns := make([]*Pattern, len(tt.in), len(tt.in))
patterns := make([]*Pattern, len(tt.in))
for i := range tt.in {
pat, err := NewPattern(tt.in[i])
if err != nil {
-1
View File
@@ -13,7 +13,6 @@ type sshLexer struct {
input *buffruneio.Reader // Textual source
buffer []rune // Runes composing the current token
tokens chan token
depth int
line uint32
col uint16
endbufferLine uint32
-11
View File
@@ -167,17 +167,6 @@ func (p *sshParser) parseComment() sshParserStateFn {
return p.parseStart
}
// assume peeks at the next token and ensures it's the right type
func (p *sshParser) assume(typ tokenType) {
tok := p.peek()
if tok == nil {
p.raiseErrorf(tok, "was expecting token %s, but token stream is empty", tok)
}
if tok.typ != typ {
p.raiseErrorf(tok, "was expecting token %s, but got %s instead", typ, tok)
}
}
func parseSSH(flow chan token, system bool, depth uint8) *Config {
result := newConfig()
result.position = Position{1, 1}