Commit 5827dd05 authored by Robert Griesemer's avatar Robert Griesemer

go/scanner: better panic diagnostic

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5787045
parent a2f03971
...@@ -109,7 +109,7 @@ const ( ...@@ -109,7 +109,7 @@ const (
func (s *Scanner) Init(file *token.File, src []byte, err ErrorHandler, mode Mode) { func (s *Scanner) Init(file *token.File, src []byte, err ErrorHandler, mode Mode) {
// Explicitly initialize all fields since a scanner may be reused. // Explicitly initialize all fields since a scanner may be reused.
if file.Size() != len(src) { if file.Size() != len(src) {
panic("file size does not match src len") panic(fmt.Sprintf("file size (%d) does not match src len (%d)", file.Size(), len(src)))
} }
s.file = file s.file = file
s.dir, _ = filepath.Split(file.Name()) s.dir, _ = filepath.Split(file.Name())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment