@@ -12,8 +12,13 @@ import (
1212	"text/template" 
1313)
1414
15+ const  (
16+ 	testGOOS    =  "linux" 
17+ 	testGOARCH  =  "amd64" 
18+ )
19+ 
1520// The environment to pass to `go` commands when they are invoked. 
16- var  commandEnv  =  []string {"GOPATH=/does-not-exist" , "GO111MODULE=off" }
21+ var  commandEnv  =  []string {"GOPATH=/does-not-exist" , "GO111MODULE=off" ,  "GOOS="   +   testGOOS ,  "GOARCH="   +   testGOARCH }
1722
1823var  markdownTemplate  =  template .Must (template .New ("markdown" ).Parse (` 
1924--- 
@@ -24,11 +29,13 @@ The following table shows all Go standard library packages and whether they can
2429
2530Note that the fact they can be imported, does not mean that all functions and types in the program can be used. For example, sometimes using some functions or types of the package will still trigger compiler errors. 
2631
32+ Test results are for {{.goos}}/{{.goarch}}. 
33+ 
2734Package | Importable | Passes tests 
28- --- | --- | --- |{{ range .}} 
35+ --- | --- | --- |{{ range .pkgs }} 
2936{{.Path}} | {{if .CanBeCompiled}} <span style="color: green">✔</span> yes {{else}} [<span style="color: red">✗</span> no](#{{.Link}}) {{end}} | {{if .PassesTests}} <span style="color: green">✔</span> yes {{else if .CanBeCompiled}} [<span style="color: red">✗</span> no](#{{.Link}}) {{else}} <span style="color: gray">✗</span> no {{end}} | {{ end }} 
3037
31- {{range .}} 
38+ {{range .pkgs }} 
3239{{if not .PassesTests }} 
3340## {{.Path}} 
3441
@@ -234,7 +241,11 @@ func checkPackages(goroot string) error {
234241	}
235242
236243	// Print the output to stdout. 
237- 	return  markdownTemplate .Execute (os .Stdout , pkgMap )
244+ 	return  markdownTemplate .Execute (os .Stdout , map [string ]interface {}{
245+ 		"pkgs" :   pkgMap ,
246+ 		"goos" :   testGOOS ,
247+ 		"goarch" : testGOARCH ,
248+ 	})
238249}
239250
240251func  (pkg  * Package ) runTest () (result  testResult ) {
@@ -252,6 +263,7 @@ func (pkg *Package) runTest() (result testResult) {
252263
253264	// Run the compile test. 
254265	cmd  :=  exec .Command ("tinygo" , "build" , "-o" , temporaryExecutableFile , temporaryGoFile )
266+ 	cmd .Env  =  append (cmd .Environ (), "GOOS=" + testGOOS , "GOARCH=" + testGOARCH )
255267	buf  :=  new (bytes.Buffer )
256268	cmd .Stdout  =  buf 
257269	cmd .Stderr  =  buf 
@@ -261,6 +273,7 @@ func (pkg *Package) runTest() (result testResult) {
261273	// Run the actual test. 
262274	if  result .compiles  {
263275		cmd  :=  exec .Command ("tinygo" , "test" , pkg .Path )
276+ 		cmd .Env  =  append (cmd .Environ (), "GOOS=" + testGOOS , "GOARCH=" + testGOARCH )
264277		buf  :=  new (bytes.Buffer )
265278		cmd .Stdout  =  buf 
266279		cmd .Stderr  =  buf 
0 commit comments