From 992f6f9bcc4275c91873caa9102e0f68b9ae0698 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Wed, 12 Oct 2016 11:10:48 -0400 Subject: [PATCH] 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 Reviewed-by: Brad Fitzpatrick --- go/loader/example_test.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/go/loader/example_test.go b/go/loader/example_test.go index 66ddb923..a5e5cfba 100644 --- a/go/loader/example_test.go +++ b/go/loader/example_test.go @@ -92,10 +92,12 @@ func ExampleConfig_FromArgs() { // This example creates and type-checks a single package (without tests) // 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() { var conf loader.Config - filename := filepath.Join(runtime.GOROOT(), "src/container/heap/heap.go") - conf.CreateFromFilenames("container/heap", filename) + conf.CreateFromFilenames("math/cmplx", + filepath.Join(runtime.GOROOT(), "src/math/cmplx/abs.go"), + filepath.Join(runtime.GOROOT(), "src/math/cmplx/sin.go")) prog, err := conf.Load() if err != nil { log.Fatal(err) @@ -103,10 +105,10 @@ func ExampleConfig_CreateFromFilenames() { printProgram(prog) // Output: - // created: [container/heap] + // created: [math/cmplx] // imported: [] - // initial: [container/heap] - // all: [container/heap sort] + // initial: [math/cmplx] + // all: [math math/cmplx unsafe] } // In the examples below, for stability, the chosen packages are