mirror of
https://github.com/wavetermdev/ssh_config.git
synced 2026-08-05 13:43:40 -07:00
switch staticcheck for megacheck and fix things it complains about
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -55,7 +55,6 @@ type UserSettings struct {
|
||||
systemConfigFinder configFinder
|
||||
userConfig *Config
|
||||
userConfigFinder configFinder
|
||||
username string
|
||||
loadConfigs sync.Once
|
||||
onceErr error
|
||||
}
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user