diff options
| author | Taras Madan <tarasmadan@google.com> | 2024-09-10 12:34:20 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2024-09-10 14:05:26 +0000 |
| commit | 8c8b47c0c8cd80d1ff64780b9893d068439ead14 (patch) | |
| tree | 440a17d052b790f801e0d1063f1763fcc465127d /pkg/ast | |
| parent | c97c816133b42257d0bcf1ee4bd178bb2a7a2b9e (diff) | |
all: follow new linter recommendations
Diffstat (limited to 'pkg/ast')
| -rw-r--r-- | pkg/ast/parser.go | 2 | ||||
| -rw-r--r-- | pkg/ast/scanner.go | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/pkg/ast/parser.go b/pkg/ast/parser.go index 2f2e62055..839d8e6d6 100644 --- a/pkg/ast/parser.go +++ b/pkg/ast/parser.go @@ -180,7 +180,7 @@ func (p *parser) expect(tokens ...token) { for _, tok := range tokens { str = append(str, tok.String()) } - p.s.Error(p.pos, fmt.Sprintf("unexpected %v, expecting %v", p.tok, strings.Join(str, ", "))) + p.s.Errorf(p.pos, "unexpected %v, expecting %v", p.tok, strings.Join(str, ", ")) panic(errSkipLine) } diff --git a/pkg/ast/scanner.go b/pkg/ast/scanner.go index 594b9ea8d..aaabb5bcc 100644 --- a/pkg/ast/scanner.go +++ b/pkg/ast/scanner.go @@ -195,7 +195,7 @@ func (s *scanner) Scan() (tok token, lit string, pos Pos) { default: tok = punctuation[s.ch] if tok == tokIllegal { - s.Error(pos, "illegal character %#U", s.ch) + s.Errorf(pos, "illegal character %#U", s.ch) } s.next() } @@ -212,7 +212,7 @@ func (s *scanner) scanStr(pos Pos) string { } for s.next(); s.ch != closing; s.next() { if s.ch == 0 || s.ch == '\n' { - s.Error(pos, "string literal is not terminated") + s.Errorf(pos, "string literal is not terminated") return "" } } @@ -222,7 +222,7 @@ func (s *scanner) scanStr(pos Pos) string { pos1 := pos pos1.Col += i + 1 pos1.Off += i + 1 - s.Error(pos1, "illegal character %#U in string literal", lit[i]) + s.Errorf(pos1, "illegal character %#U in string literal", lit[i]) break } } @@ -232,7 +232,7 @@ func (s *scanner) scanStr(pos Pos) string { } decoded, err := hex.DecodeString(lit) if err != nil { - s.Error(pos, "bad hex string literal: %v", err) + s.Errorf(pos, "bad hex string literal: %v", err) } return string(decoded) } @@ -258,7 +258,7 @@ func (s *scanner) scanInt(pos Pos) string { return lit } } - s.Error(pos, fmt.Sprintf("bad integer %q", lit)) + s.Errorf(pos, "bad integer %q", lit) return "0" } @@ -266,7 +266,7 @@ func (s *scanner) scanChar(pos Pos) string { s.next() s.next() if s.ch != '\'' { - s.Error(pos, "char literal is not terminated") + s.Errorf(pos, "char literal is not terminated") return "0" } s.next() @@ -288,7 +288,7 @@ func (s *scanner) scanIdent(pos Pos) (tok token, lit string) { return } -func (s *scanner) Error(pos Pos, msg string, args ...interface{}) { +func (s *scanner) Errorf(pos Pos, msg string, args ...interface{}) { s.errors++ s.errorHandler(pos, fmt.Sprintf(msg, args...)) } @@ -320,7 +320,7 @@ func (s *scanner) next() { s.ch = s.data[s.off] s.col++ if s.ch == 0 { - s.Error(s.pos(), "illegal character \\x00") + s.Errorf(s.pos(), "illegal character \\x00") } } |
