diff --git a/Makefile b/Makefile index 4520f70..2d47cfd 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/config.go b/config.go index 8441fd3..6ef2351 100644 --- a/config.go +++ b/config.go @@ -55,7 +55,6 @@ type UserSettings struct { systemConfigFinder configFinder userConfig *Config userConfigFinder configFinder - username string loadConfigs sync.Once onceErr error } diff --git a/config_test.go b/config_test.go index 72e07c9..88b6dcd 100644 --- a/config_test.go +++ b/config_test.go @@ -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 { diff --git a/lexer.go b/lexer.go index 27bed12..6999d63 100644 --- a/lexer.go +++ b/lexer.go @@ -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 diff --git a/parser.go b/parser.go index feb1497..79b26a8 100644 --- a/parser.go +++ b/parser.go @@ -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}