admin管理员组文章数量:1405613
I’m trying to set up GoLand for Go development, specifically for compiling WebAssembly (WASM) files. I’m running into an issue that I hope someone can help me with.
When I attempt to import the syscall/js
package in my Go code, I receive the following error:
build constraints exclude all Go files in 'Ilusr/local/go/src/syscall/js'.
To resolve this, I added the following build constraint at the top of my Go file:
//go:build js && wasm
This change allowed me to bypass the error, but unfortunately, it led to a new problem: I no longer have access to GoLand's documentation and code suggestions. This is a significant setback for my development process as I rely heavily on these features for writing and navigating my code.
I’m trying to set up GoLand for Go development, specifically for compiling WebAssembly (WASM) files. I’m running into an issue that I hope someone can help me with.
When I attempt to import the syscall/js
package in my Go code, I receive the following error:
build constraints exclude all Go files in 'Ilusr/local/go/src/syscall/js'.
To resolve this, I added the following build constraint at the top of my Go file:
//go:build js && wasm
This change allowed me to bypass the error, but unfortunately, it led to a new problem: I no longer have access to GoLand's documentation and code suggestions. This is a significant setback for my development process as I rely heavily on these features for writing and navigating my code.
Share Improve this question edited Mar 8 at 21:32 desertnaut 60.5k32 gold badges155 silver badges182 bronze badges asked Mar 8 at 2:49 Seyed AliSeyed Ali 335 bronze badges1 Answer
Reset to default 1Configuring GoLand for WebAssembly (Wasm) projects
Initial project configuration
When you first open or start a WebAssembly project in GoLand, it won'’t understand the “syscall/js” package. That’s easily fixable, by changing the GOOS and GOARCH values in the project settings, as shown in the below screenshots.
The screenshot below shows how to access Settings on a Linux desktop. If you're using macOS, you'll probably need to access them through the standard macOS Preferences option. GoLand Wasm.
Configuring Run/Debug settings
With the initial project settings changed, you'll probably want to configure the Run/Debug settings next.
That will let you recompile the .wasm file by just launching Run (Shift+F10 on Linux).
Finished, your GoLand setup should now be complete.
Source: Go Wiki: Configuring GoLand for WebAssembly
版权声明:本文标题:go - How to setup Goland (or any other jetbrains product) for WASM development with Golang - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744904505a2631538.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论