Skip to content

Commit 91d148f

Browse files
author
Dean Karn
committed
lint fixes
1 parent 64cee4e commit 91d148f

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
lint:
2+
golangci-lint run
3+
4+
bench:
5+
$(ENVS) go test -run=NONE -bench=. -benchmem ./...
6+
7+
test:
8+
$(ENVS) go test -race -cover ./...
9+
10+
.PHONY: lint bench test

lexer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ func tokenizeNumber(data []byte) (result LexerResult, err error) {
153153
})
154154

155155
if end > 0 && !badNumber {
156-
n, err := strconv.ParseFloat(string(data[:end]), 64)
156+
var n float64
157+
n, err = strconv.ParseFloat(string(data[:end]), 64)
157158
if err != nil {
158159
err = ErrInvalidNumber{s: string(data[:end])}
159160
} else {
@@ -256,7 +257,7 @@ func tokenizeIdentifier(data []byte) (result LexerResult, err error) {
256257

257258
func tokenizeString(data []byte, quote byte) (result LexerResult, err error) {
258259
var lastBackslash, endedWithTerminator bool
259-
260+
260261
end := takeWhile(data[1:], func(b byte) bool {
261262
switch b {
262263
case '\\':
@@ -371,7 +372,6 @@ func Tokenize(src []byte) (tokens []Token, err error) {
371372
}
372373
tokens = append(tokens, token)
373374
}
374-
return
375375
}
376376

377377
func isAlphanumeric(c byte) bool {

lexer_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ func Test(t *testing.T) {
267267
t.Run(tc.name, func(t *testing.T) {
268268
t.Parallel()
269269

270-
Tokenize([]byte(tc.input))
271270
tokens, err := Tokenize([]byte(tc.input))
272271
if tc.err != nil {
273272
assert.Error(err)

0 commit comments

Comments
 (0)