Following the C to Go translation, some useless variables
were left in the code. In fmt.go, this was harmless.
In lex.go, it broke the error message related to
non-canonical import paths.
Fix it, and remove the useless variables.
The added test case is ignored in the go/types tests, since
the behavior of the non-canonical import path check seems
to be different.
Fixes #11362
Change-Id: Ic9129139ede90357dc79ebf167af638cf44536fa
Reviewed-on: https://go-review.googlesource.com/15580
Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
sf := flag
sm := setfmode(&flag)
- var r int
- _ = r
str := symfmt(s, flag)
flag = sf
fmtmode = sm
flag |= obj.FmtUnsigned
}
- var r int
- _ = r
str := typefmt(t, flag)
if fmtmode == FTypeId && (sf&obj.FmtUnsigned != 0) {
sf := flag
sm := setfmode(&flag)
- var r int
- _ = r
var str string
switch fmtmode {
case FErr, FExp:
sf := flag
sm := setfmode(&flag)
- var r int
- _ = r
sep := "; "
if fmtmode == FDbg {
sep = "\n"
// local imports should be canonicalized already.
// don't want to see "encoding/../encoding/base64"
// as different from "encoding/base64".
- var q string
- _ = q
- if path.Clean(name) != name {
+ if q := path.Clean(name); q != name {
Yyerror("non-canonical import path %q (should be %q)", name, q)
return "", false
}
"issue7746.go", // large constants - consumes too much memory
"issue11326.go", // large constants
"issue11326b.go", // large constants
+ "issue11362.go", // canonical import path check
)
}
--- /dev/null
+// errorcheck
+
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 11362: prints empty canonical import path
+
+package main
+
+import _ "unicode//utf8" // ERROR "non-canonical import path .unicode//utf8. \(should be .unicode/utf8.\)" "can't find import: .unicode//utf8."
+
+func main() {
+}
+