Closed
Description
I created the following test file:
package main
import (
"reflect"
"github.com/gopherjs/gopherjs/js"
)
func main() {
js.Global.Set("tester", map[string]interface{}{
"Tester": tester,
})
}
func tester(input string) string {
reflect.DeepEqual(nil, nil)
return input
}
I would like the Javascript that is generated to be constant across platforms. As such, I defined the following go generate
:
GOOS=darwin gopherjs build main.go -o go.js
However, the output of the generated Javascript for the reflect
package is subtly different. When run on a Darwin system versus a Linux system (tested in a Docker image).
Specifically, the code generated by Linux has extra $1
characters. Examples:
- typ[0] = tt.elem;
+ typ$1[0] = tt.elem;
- return wrapJsObject(typ[0], a[0][i[0]]);
+ return wrapJsObject(typ$1[0], a$1[0][i[0]]);
For now I can work around this by requiring the generation to be done in a Docker container so that the results are always consistent, but it would be much nicer if the output could be guaranteed to be stable/consistent for a given GOOS
regardless of the host environment.