aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vet/main.go
diff options
context:
space:
mode:
authorMarvin Stenger <marvin.stenger94@gmail.com>2016-03-01 21:18:56 +0100
committerRob Pike <r@golang.org>2016-03-02 00:49:39 +0000
commita8d4463e50fb67448981a5c36a8fd6cb0da5c86f (patch)
tree361b51236556dede6c0b1abaa3e445a336b2069f /src/cmd/vet/main.go
parent5fea2ccc77eb50a9704fa04b7c61755fe34e1d95 (diff)
downloadgo-a8d4463e50fb67448981a5c36a8fd6cb0da5c86f.tar.gz
go-a8d4463e50fb67448981a5c36a8fd6cb0da5c86f.zip
cmd/vet: polish output of shadow test
This commit modifies the style of a error message in case of -shadow. Previously such a message would look like: foo.go:42: declaration of err shadows declaration at shadow.go:13: Changes of the commit include highlighting the variable name and removing the ": "(space intended) at the end of the line: foo.go:42: declaration of "err" shadows declaration at shadow.go:13 Fixes #14585. Change-Id: Ia6a6bf396668dcba9a24f025a08d8826db31f434 Reviewed-on: https://go-review.googlesource.com/20093 Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/cmd/vet/main.go')
-rw-r--r--src/cmd/vet/main.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/vet/main.go b/src/cmd/vet/main.go
index fc3873997b..c401fed0b4 100644
--- a/src/cmd/vet/main.go
+++ b/src/cmd/vet/main.go
@@ -435,17 +435,17 @@ func (f *File) loc(pos token.Pos) string {
// expression instead of the inner part with the actual error, the
// precision can mislead.
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.
func (f *File) Warn(pos token.Pos, args ...interface{}) {
- fmt.Fprint(os.Stderr, f.loc(pos)+fmt.Sprintln(args...))
+ fmt.Fprintf(os.Stderr, "%s: %s", f.loc(pos), fmt.Sprintln(args...))
}
// Warnf reports a formatted error but does not set the exit code.
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, "%s: %s\n", f.loc(pos), fmt.Sprintf(format, args...))
}
// walkFile walks the file's tree.