aboutsummaryrefslogtreecommitdiffhomepage
path: root/loader/goroot.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2020-09-03 16:09:28 +0200
committerRon Evans <[email protected]>2020-09-03 22:10:14 +0200
commitc810628a20797f348a3345794df5e3a8fa12d424 (patch)
tree712ac4c92a9405c2c2fe4ec4e896fea216f277bb /loader/goroot.go
parent51238fba5040e31559d036ddf560adb3ab5f5d25 (diff)
downloadtinygo-c810628a20797f348a3345794df5e3a8fa12d424.tar.gz
tinygo-c810628a20797f348a3345794df5e3a8fa12d424.zip
loader: rewrite/refactor much of the code to use go list directly
There were a few problems with the go/packages package. While it is more or less designed for our purpose, it didn't work quite well as it didn't provide access to indirectly imported packages (most importantly the runtime package). This led to a workaround that sometimes broke `tinygo test`. This PR contains a number of related changes: * It uses `go list` directly to retrieve the list of packages/files to compile, instead of relying on the go/packages package. * It replaces our custom TestMain replace code with the standard code for running tests (generated by `go list`). * It adds a dummy runtime/pprof package and modifies the testing package, to get tests to run again with the code generated by `go list`.
Diffstat (limited to 'loader/goroot.go')
-rw-r--r--loader/goroot.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/loader/goroot.go b/loader/goroot.go
index c40a9f3af..964855071 100644
--- a/loader/goroot.go
+++ b/loader/goroot.go
@@ -212,7 +212,7 @@ func pathsToOverride(needsSyscallPackage bool) map[string]bool {
"reflect/": false,
"runtime/": false,
"sync/": true,
- "testing/": false,
+ "testing/": true,
}
if needsSyscallPackage {
paths["syscall/"] = true // include syscall/js