mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 03:53:42 +00:00
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`.
This commit is contained in:
committed by
Ron Evans
parent
51238fba50
commit
c810628a20
@@ -0,0 +1,29 @@
|
||||
package pprof
|
||||
|
||||
// TinyGo does not implement pprof. However, a dummy shell is needed for the
|
||||
// testing package (and testing/internal/pprof).
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
)
|
||||
|
||||
var ErrUnimplemented = errors.New("runtime/pprof: unimplemented")
|
||||
|
||||
type Profile struct {
|
||||
}
|
||||
|
||||
func StartCPUProfile(w io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func StopCPUProfile() {
|
||||
}
|
||||
|
||||
func Lookup(name string) *Profile {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Profile) WriteTo(w io.Writer, debug int) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
Reference in New Issue
Block a user