1
0
mirror of https://github.com/golang/go synced 2024-11-05 15:56:12 -07:00

cmd/vet: fix line number in asm errors

Before:
: asm_amd64.s:16: [amd64] invalid offset new+16(FP); expected new+8(FP)
: asm_amd64.s:26: [amd64] invalid offset new+16(FP); expected new+8(FP)

After:
asm_amd64.s:16: [amd64] invalid offset new+16(FP); expected new+8(FP)
asm_amd64.s:26: [amd64] invalid offset new+16(FP); expected new+8(FP)

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/91510043
This commit is contained in:
Russ Cox 2014-05-19 12:31:28 -04:00
parent 6f17d00f0d
commit d8a81d8377

View File

@ -409,17 +409,17 @@ func (f *File) loc(pos token.Pos) string {
// expression instead of the inner part with the actual error, the // expression instead of the inner part with the actual error, the
// precision can mislead. // precision can mislead.
posn := f.fset.Position(pos) posn := f.fset.Position(pos)
return fmt.Sprintf("%s:%d", posn.Filename, posn.Line) return fmt.Sprintf("%s:%d: ", posn.Filename, posn.Line)
} }
// Warn reports an error but does not set the exit code. // Warn reports an error but does not set the exit code.
func (f *File) Warn(pos token.Pos, args ...interface{}) { func (f *File) Warn(pos token.Pos, args ...interface{}) {
fmt.Fprint(os.Stderr, f.loc(pos)+": "+fmt.Sprintln(args...)) fmt.Fprint(os.Stderr, f.loc(pos)+fmt.Sprintln(args...))
} }
// Warnf reports a formatted error but does not set the exit code. // Warnf reports a formatted error but does not set the exit code.
func (f *File) Warnf(pos token.Pos, format string, args ...interface{}) { func (f *File) Warnf(pos token.Pos, format string, args ...interface{}) {
fmt.Fprintf(os.Stderr, f.loc(pos)+": "+format+"\n", args...) fmt.Fprintf(os.Stderr, f.loc(pos)+format+"\n", args...)
} }
// walkFile walks the file's tree. // walkFile walks the file's tree.