From ed9744dff5341ab692154eab1e6e0f1a3c138733 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 24 Mar 2023 22:25:18 -0700 Subject: [PATCH] cmd/compile: allow go:wasmimport in syscall The go:wasmimport compiler directive is used by the wasi port to access host APIs, some of need to implemented in the syscall package. Co-authored-by: Richard Musiol Co-authored-by: Achille Roussel Co-authored-by: Julien Fabre Co-authored-by: Evan Phoenix Change-Id: I3851e154c6989094effcd25bba5864faa133564e Reviewed-on: https://go-review.googlesource.com/c/go/+/479615 Reviewed-by: Cherry Mui Auto-Submit: Johan Brandhorst-Satzkorn Reviewed-by: Matthew Dempsky TryBot-Result: Gopher Robot Run-TryBot: Johan Brandhorst-Satzkorn --- src/cmd/compile/internal/noder/noder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/noder/noder.go b/src/cmd/compile/internal/noder/noder.go index c846130976..483ff64686 100644 --- a/src/cmd/compile/internal/noder/noder.go +++ b/src/cmd/compile/internal/noder/noder.go @@ -237,7 +237,7 @@ func (p *noder) pragma(pos syntax.Pos, blankLine bool, text string, old syntax.P p.error(syntax.Error{Pos: pos, Msg: "usage: //go:wasmimport importmodule importname"}) break } - if !base.Flag.CompilingRuntime && base.Ctxt.Pkgpath != "syscall/js" && base.Ctxt.Pkgpath != "syscall/js_test" { + if !base.Flag.CompilingRuntime && base.Ctxt.Pkgpath != "syscall/js" && base.Ctxt.Pkgpath != "syscall/js_test" && base.Ctxt.Pkgpath != "syscall" { p.error(syntax.Error{Pos: pos, Msg: "//go:wasmimport directive cannot be used outside of runtime or syscall/js"}) break } -- 2.50.0