mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go: add GOWASM environment variable
This change adds the environment variable GOWASM, which is a comma separated list of experimental WebAssembly features that the compiled WebAssembly binary is allowed to use. The default is to use no experimental features. Initially there are no features avaiable. More information about feature proposals can be found at https://github.com/WebAssembly/proposals Change-Id: I4c8dc534c99ecff8bb075dded0186ca8f8decaef Reviewed-on: https://go-review.googlesource.com/c/go/+/168881 Run-TryBot: Richard Musiol <neelance@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
2396101e05
commit
b434bbf197
4 changed files with 38 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ var (
|
|||
GOMIPS = gomips()
|
||||
GOMIPS64 = gomips64()
|
||||
GOPPC64 = goppc64()
|
||||
GOWASM = gowasm()
|
||||
GO_LDSO = defaultGO_LDSO
|
||||
Version = version
|
||||
)
|
||||
|
|
@ -76,6 +77,29 @@ func goppc64() int {
|
|||
panic("unreachable")
|
||||
}
|
||||
|
||||
type gowasmFeatures struct {
|
||||
// no features yet
|
||||
}
|
||||
|
||||
func (f *gowasmFeatures) String() string {
|
||||
var flags []string
|
||||
// no features yet
|
||||
return strings.Join(flags, ",")
|
||||
}
|
||||
|
||||
func gowasm() (f gowasmFeatures) {
|
||||
for _, opt := range strings.Split(envOr("GOWASM", ""), ",") {
|
||||
switch opt {
|
||||
// no features yet
|
||||
case "":
|
||||
// ignore
|
||||
default:
|
||||
log.Fatalf("Invalid GOWASM value. No such feature: " + opt)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Getgoextlinkenabled() string {
|
||||
return envOr("GO_EXTLINK_ENABLED", defaultGO_EXTLINK_ENABLED)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue