Skip to content

Instantly share code, notes, and snippets.

@thecrypticace
Created November 15, 2018 18:18
Show Gist options
  • Save thecrypticace/391888088b806dae7a871caf905bcec1 to your computer and use it in GitHub Desktop.
Save thecrypticace/391888088b806dae7a871caf905bcec1 to your computer and use it in GitHub Desktop.
Go Panic
=== RUN TestNextToken
=== RUN TestNextToken/{,}
=== RUN TestNextToken/{a,}
=== RUN TestNextToken/{ab,c}
=== RUN TestNextToken/{1..10}
=== RUN TestNextToken/{1...10}
panic: runtime error: slice bounds out of range [recovered]
panic: runtime error: slice bounds out of range
goroutine 24 [running]:
testing.tRunner.func1(0xc00011e600)
/usr/local/Cellar/go/1.11.2/libexec/src/testing/testing.go:792 +0x387
panic(0x129a2e0, 0x14ff300)
/usr/local/Cellar/go/1.11.2/libexec/src/runtime/panic.go:513 +0x1b9
github.com/pittfit/ortho/lexer.(*Lexer).matchToken(0xc000051ef0, 0xc000051ec0, 0x18, 0x1, 0x1)
/Users/jordanpittman/go/src/github.com/pittfit/ortho/lexer/lexer.go:78 +0x1b9
github.com/pittfit/ortho/lexer.(*Lexer).readToken(0xc000051ef0, 0xc0000aeb40, 0xc000051ec0, 0xc0000aeb40, 0xc0000aeb40)
/Users/jordanpittman/go/src/github.com/pittfit/ortho/lexer/lexer.go:71 +0x39
github.com/pittfit/ortho/lexer.(*Lexer).NextToken(0xc0000c3ef0, 0xc00011e600, 0x12acd80, 0xc0000aeb20, 0x12acd80)
/Users/jordanpittman/go/src/github.com/pittfit/ortho/lexer/lexer.go:62 +0x2f
github.com/pittfit/ortho/lexer.TestNextToken.func1(0xc00011e600)
/Users/jordanpittman/go/src/github.com/pittfit/ortho/lexer/lexer_test.go:187 +0x163
testing.tRunner(0xc00011e600, 0xc000095050)
/usr/local/Cellar/go/1.11.2/libexec/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
/usr/local/Cellar/go/1.11.2/libexec/src/testing/testing.go:878 +0x353
exit status 2
FAIL github.com/pittfit/ortho/lexer 0.017s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment