gotype: fix default importer for Go 1.8.

Importer "source" does not exist in Go 1.8, so this means that
default usage of gotype is broken in that compiler version.

Change-Id: I517520b0cac7c62a3e213d0647a3d621e8ced58c
Reviewed-on: https://go-review.googlesource.com/40091
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Giovanni Bajo 2017-04-08 13:02:39 +02:00 committed by Robert Griesemer
parent 4436e54754
commit 5584fb0720
3 changed files with 5 additions and 1 deletions

View File

@ -108,7 +108,7 @@ var (
xtestFiles = flag.Bool("x", false, "consider only external test files in a directory")
allErrors = flag.Bool("e", false, "report all errors, not just the first 10")
verbose = flag.Bool("v", false, "verbose mode")
compiler = flag.String("c", "source", "compiler used for installed packages (gc, gccgo, or source)")
compiler = flag.String("c", defaultCompiler, "compiler used for installed packages (gc, gccgo, or source)")
// additional output control
printAST = flag.Bool("ast", false, "print AST (forces -seq)")

View File

@ -11,6 +11,8 @@ package main
import "go/types"
const defaultCompiler = "gc"
var gcArchSizes = map[string]*types.StdSizes{
"386": {4, 4},
"arm": {4, 4},

View File

@ -8,6 +8,8 @@ package main
import "go/types"
const defaultCompiler = "source"
func SizesFor(compiler, arch string) types.Sizes {
return types.SizesFor(compiler, arch)
}