"bytes"
"flag"
"fmt"
+ "go/build"
"io/ioutil"
"os"
+ "os/exec"
"path/filepath"
"sort"
"strings"
}
}
}
+
+func BenchmarkAll(b *testing.B) {
+ stds, err := exec.Command("go", "list", "std").Output()
+ if err != nil {
+ b.Fatal(err)
+ }
+ b.ResetTimer()
+ pkgNames := strings.Fields(string(stds))
+
+ for _, c := range contexts {
+ c.Compiler = build.Default.Compiler
+ }
+
+ for i := 0; i < b.N; i++ {
+ for _, context := range contexts {
+ w := NewWalker(context, filepath.Join(build.Default.GOROOT, "src/pkg"))
+ for _, name := range pkgNames {
+ if name != "unsafe" && !strings.HasPrefix(name, "cmd/") {
+ w.export(w.Import(name))
+ }
+ }
+ w.Features()
+ }
+ }
+}