aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/objabi
diff options
context:
space:
mode:
authorRichard Musiol <mail@richard-musiol.de>2019-03-23 14:18:19 +0100
committerRichard Musiol <neelance@gmail.com>2019-03-23 20:33:57 +0000
commitb434bbf197b3683643d4d6b52bca687982e336b5 (patch)
tree2f58d67db593aa97a598b80348cf7a5f0e7abdc2 /src/cmd/internal/objabi
parent2396101e0590cb7d77556924249c26af0ccd9eff (diff)
downloadgo-b434bbf197b3683643d4d6b52bca687982e336b5.tar.xz
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>
Diffstat (limited to 'src/cmd/internal/objabi')
-rw-r--r--src/cmd/internal/objabi/util.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cmd/internal/objabi/util.go b/src/cmd/internal/objabi/util.go
index 665c8b3be6..c007f6c475 100644
--- a/src/cmd/internal/objabi/util.go
+++ b/src/cmd/internal/objabi/util.go
@@ -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)
}