diff --git a/cmd/present/dir.go b/cmd/present/dir.go index 0276351370..19aec87e76 100644 --- a/cmd/present/dir.go +++ b/cmd/present/dir.go @@ -113,7 +113,7 @@ func parse(name string, mode present.ParseMode) (*present.Doc, error) { return nil, err } defer f.Close() - return present.Parse(f, name, 0) + return present.Parse(f, name, mode) } // dirList scans the given path and writes a directory listing to w. diff --git a/go/ssa/sanity.go b/go/ssa/sanity.go index b15ad9fb1e..0d13beb952 100644 --- a/go/ssa/sanity.go +++ b/go/ssa/sanity.go @@ -209,7 +209,7 @@ func (s *sanity) checkInstr(idx int, instr Instruction) { // enclosing Function or Package. } -func (s *sanity) checkFinalInstr(idx int, instr Instruction) { +func (s *sanity) checkFinalInstr(instr Instruction) { switch instr := instr.(type) { case *If: if nsuccs := len(s.block.Succs); nsuccs != 2 { @@ -324,7 +324,7 @@ func (s *sanity) checkBlock(b *BasicBlock, index int) { if j < n-1 { s.checkInstr(j, instr) } else { - s.checkFinalInstr(j, instr) + s.checkFinalInstr(instr) } // Check Instruction.Operands. diff --git a/imports/fix.go b/imports/fix.go index 8dbbd27a15..de6608790e 100644 --- a/imports/fix.go +++ b/imports/fix.go @@ -800,8 +800,8 @@ func findImportGoPath(pkgName string, symbols map[string]bool, filename string) // Fast path for the standard library. // In the common case we hopefully never have to scan the GOPATH, which can // be slow with moving disks. - if pkg, rename, ok := findImportStdlib(pkgName, symbols); ok { - return pkg, rename, nil + if pkg, ok := findImportStdlib(pkgName, symbols); ok { + return pkg, false, nil } if pkgName == "rand" && symbols["Read"] { // Special-case rand.Read. @@ -1047,7 +1047,7 @@ func (fn visitFn) Visit(node ast.Node) ast.Visitor { return fn(node) } -func findImportStdlib(shortPkg string, symbols map[string]bool) (importPath string, rename, ok bool) { +func findImportStdlib(shortPkg string, symbols map[string]bool) (importPath string, ok bool) { for symbol := range symbols { key := shortPkg + "." + symbol path := stdlib[key] @@ -1055,18 +1055,18 @@ func findImportStdlib(shortPkg string, symbols map[string]bool) (importPath stri if key == "rand.Read" { continue } - return "", false, false + return "", false } if importPath != "" && importPath != path { // Ambiguous. Symbols pointed to different things. - return "", false, false + return "", false } importPath = path } if importPath == "" && shortPkg == "rand" && symbols["Read"] { - return "crypto/rand", false, true + return "crypto/rand", true } - return importPath, false, importPath != "" + return importPath, importPath != "" } // fileInDir reports whether the provided file path looks like diff --git a/imports/fix_test.go b/imports/fix_test.go index bb5fcb9e5b..bc18772cf0 100644 --- a/imports/fix_test.go +++ b/imports/fix_test.go @@ -1273,12 +1273,12 @@ func TestFindImportStdlib(t *testing.T) { {"ioutil", []string{"Discard"}, "io/ioutil"}, } for _, tt := range tests { - got, rename, ok := findImportStdlib(tt.pkg, strSet(tt.symbols)) + got, ok := findImportStdlib(tt.pkg, strSet(tt.symbols)) if (got != "") != ok { t.Error("findImportStdlib return value inconsistent") } - if got != tt.want || rename { - t.Errorf("findImportStdlib(%q, %q) = %q, %t; want %q, false", tt.pkg, tt.symbols, got, rename, tt.want) + if got != tt.want { + t.Errorf("findImportStdlib(%q, %q) = %q, want %q", tt.pkg, tt.symbols, got, tt.want) } } }