go/loader: fix CreateFromFilenames example
The "sort" package is no longer quite as low-level as it once was. Change-Id: Ic62d780841ef1172f65d4c00ec500994f94cb4b7 Reviewed-on: https://go-review.googlesource.com/30931 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
41f4ee4e59
commit
992f6f9bcc
|
|
@ -92,10 +92,12 @@ func ExampleConfig_FromArgs() {
|
||||||
|
|
||||||
// This example creates and type-checks a single package (without tests)
|
// This example creates and type-checks a single package (without tests)
|
||||||
// from a list of filenames, and loads all of its dependencies.
|
// from a list of filenames, and loads all of its dependencies.
|
||||||
|
// (The input files are actually only a small part of the math/cmplx package.)
|
||||||
func ExampleConfig_CreateFromFilenames() {
|
func ExampleConfig_CreateFromFilenames() {
|
||||||
var conf loader.Config
|
var conf loader.Config
|
||||||
filename := filepath.Join(runtime.GOROOT(), "src/container/heap/heap.go")
|
conf.CreateFromFilenames("math/cmplx",
|
||||||
conf.CreateFromFilenames("container/heap", filename)
|
filepath.Join(runtime.GOROOT(), "src/math/cmplx/abs.go"),
|
||||||
|
filepath.Join(runtime.GOROOT(), "src/math/cmplx/sin.go"))
|
||||||
prog, err := conf.Load()
|
prog, err := conf.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
@ -103,10 +105,10 @@ func ExampleConfig_CreateFromFilenames() {
|
||||||
|
|
||||||
printProgram(prog)
|
printProgram(prog)
|
||||||
// Output:
|
// Output:
|
||||||
// created: [container/heap]
|
// created: [math/cmplx]
|
||||||
// imported: []
|
// imported: []
|
||||||
// initial: [container/heap]
|
// initial: [math/cmplx]
|
||||||
// all: [container/heap sort]
|
// all: [math math/cmplx unsafe]
|
||||||
}
|
}
|
||||||
|
|
||||||
// In the examples below, for stability, the chosen packages are
|
// In the examples below, for stability, the chosen packages are
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue