From 36d1c4540af3ef058d68092e41af05aa4a8c5eca Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 8 Mar 2018 18:48:26 +0100 Subject: all: fix gometalinter warnings Fix typos, non-canonical code, remove dead code, etc. --- pkg/ast/parser.go | 8 ++++---- pkg/ast/test_util.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'pkg/ast') diff --git a/pkg/ast/parser.go b/pkg/ast/parser.go index b28658de8..fb3327223 100644 --- a/pkg/ast/parser.go +++ b/pkg/ast/parser.go @@ -88,13 +88,13 @@ type parser struct { } // Skip parsing till the next NEWLINE, for error recovery. -var skipLine = errors.New("") +var errSkipLine = errors.New("") func (p *parser) parseTopRecover() Node { defer func() { switch err := recover(); err { case nil: - case skipLine: + case errSkipLine: // Try to recover by consuming everything until next NEWLINE. for p.tok != tokNewLine && p.tok != tokEOF { p.next() @@ -143,7 +143,7 @@ func (p *parser) parseTop() Node { } case tokIllegal: // Scanner has already producer an error for this one. - panic(skipLine) + panic(errSkipLine) default: p.expect(tokComment, tokDefine, tokInclude, tokResource, tokIdent) } @@ -178,7 +178,7 @@ func (p *parser) expect(tokens ...token) { str = append(str, tok.String()) } p.s.Error(p.pos, fmt.Sprintf("unexpected %v, expecting %v", p.tok, strings.Join(str, ", "))) - panic(skipLine) + panic(errSkipLine) } func (p *parser) parseComment() *Comment { diff --git a/pkg/ast/test_util.go b/pkg/ast/test_util.go index fbec645b7..3ffefcccb 100644 --- a/pkg/ast/test_util.go +++ b/pkg/ast/test_util.go @@ -61,7 +61,7 @@ func NewErrorMatcher(t *testing.T, file string) *ErrorMatcher { } } -var errorLocationRe = regexp.MustCompile("at [a-z][a-z0-9]+\\.txt:[0-9]+:[0-9]+") +var errorLocationRe = regexp.MustCompile(`at [a-z][a-z0-9]+\.txt:[0-9]+:[0-9]+`) func (em *ErrorMatcher) ErrorHandler(pos Pos, msg string) { if match := errorLocationRe.FindStringSubmatchIndex(msg); match != nil { -- cgit mrf-deployment