cmd/gotype: use std lib go/types instead of x/tools version
Change-Id: I89ba20512129d0557f3f606d8242472d78ea37a9 Reviewed-on: https://go-review.googlesource.com/13898 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
6c9aff3429
commit
12c48ced94
|
@ -27,8 +27,8 @@ The flags are:
|
||||||
report all errors (not just the first 10)
|
report all errors (not just the first 10)
|
||||||
-v
|
-v
|
||||||
verbose mode
|
verbose mode
|
||||||
-gccgo
|
-c
|
||||||
use gccimporter instead of gcimporter
|
compiler used to compile packages (gc or gccgo); default: gc
|
||||||
|
|
||||||
Debugging flags:
|
Debugging flags:
|
||||||
-seq
|
-seq
|
||||||
|
|
|
@ -9,18 +9,16 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/ast"
|
"go/ast"
|
||||||
"go/build"
|
"go/build"
|
||||||
|
"go/importer"
|
||||||
"go/parser"
|
"go/parser"
|
||||||
"go/scanner"
|
"go/scanner"
|
||||||
"go/token"
|
"go/token"
|
||||||
|
"go/types"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/tools/go/gccgoimporter"
|
|
||||||
_ "golang.org/x/tools/go/gcimporter"
|
|
||||||
"golang.org/x/tools/go/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -28,7 +26,7 @@ var (
|
||||||
allFiles = flag.Bool("a", false, "use all (incl. _test.go) files when processing a directory")
|
allFiles = flag.Bool("a", false, "use all (incl. _test.go) files when processing a directory")
|
||||||
allErrors = flag.Bool("e", false, "report all errors (not just the first 10)")
|
allErrors = flag.Bool("e", false, "report all errors (not just the first 10)")
|
||||||
verbose = flag.Bool("v", false, "verbose mode")
|
verbose = flag.Bool("v", false, "verbose mode")
|
||||||
gccgo = flag.Bool("gccgo", false, "use gccgoimporter instead of gcimporter")
|
compiler = flag.String("c", "gc", "compiler used to compile packages (gc or gccgo)")
|
||||||
|
|
||||||
// debugging support
|
// debugging support
|
||||||
sequential = flag.Bool("seq", false, "parse sequentially, rather than in parallel")
|
sequential = flag.Bool("seq", false, "parse sequentially, rather than in parallel")
|
||||||
|
@ -195,12 +193,8 @@ func checkPkgFiles(files []*ast.File) {
|
||||||
}
|
}
|
||||||
report(err)
|
report(err)
|
||||||
},
|
},
|
||||||
Sizes: sizes,
|
Importer: importer.For(*compiler, nil),
|
||||||
}
|
Sizes: sizes,
|
||||||
if *gccgo {
|
|
||||||
var inst gccgoimporter.GccgoInstallation
|
|
||||||
inst.InitFromDriver("gccgo")
|
|
||||||
conf.Import = inst.GetImporter(nil, nil)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
Loading…
Reference in New Issue