I installed the WSL, Visual Studio Code, and are able to compile and run the sample go webserver application.
However, snapcraft automatically installs the golang-go system package, which is version 1.10.
Is there a way to use a newer version of Go, preferably one that supports go modules?
There seems to be a "go-channel" keyword for snapcraft 3.x, but I'm not sure how to update the WSL snapcraft which is only version 2.43...
Our system is build on Ubuntu core18.04 LTS, the default Go lang version is 1.10 for compatibility reason. If you like to install later verions see several guides on the internet.
The snapcraft version used actually is not updateable in WSL because the later versions are only available as a snap not as an apt package. Therefore an update would need some more effort/knowledge because the later snapcraft version are working with multipass or lxd containers for its building process only. And therefor a WSL2 would be necessary that this in untested until now. The other way is using a VM with a native ubuntu installed, like also mentioned in the SDK documentation.
See also some information about go applications in snaps provided by canonical.
Thank you for your reply. I installed another Go version in WSL, but snapcraft still tried to download the system golang-go package with version 1.10 and use it for building the snap.
Initially I tried to get it working in the Ubuntu VM, but was not successful -- that's why I switched to WSL. Maybe I have to give it another try.
Is an update to core20 planned in the future?