Open Joematpal opened 3 months ago
I saw that the tinygo GOROOT in the info command had just changed. So I re ran it.
$ joematpal/nano_33_test » tinygo flash -target=arduino-nano33 -port=/dev/ttyACM0
error: open /home/joseph/.cache/tinygo/goroot-a107edff9f5d5423085f0d0157bfbc7b3dc6033d6b19de196de3c0bcd288f8ae/src/crypto/internal/boring: no such file or directory
I got a new error. I haven't seen this.
I removed all of the GOROOTs that i had all over the place. I see now the differences in the caches. Each target has its own goroot cache..
for instance tinygo info
and tinygo info arudino-nan33
have to different caches.
What is the best way to identify which code is going to be in a cache?
the cache for tinygo info arudino-nano33
says it doesn't have certain modules.
$ joematpal/nano_33_test » tinygo info arduino-nano33
LLVM triple: thumbv6m-unknown-unknown-eabi
GOOS: linux
GOARCH: arm
build tags: cortexm baremetal linux arm atsamd21g18a atsamd21g18 atsamd21 sam arduino_nano33 tinygo math_big_pure_go gc.conservative scheduler.tasks serial.usb
garbage collector: conservative
scheduler: tasks
cached GOROOT: /home/joseph/.cache/tinygo/goroot-e71eb3d56fb851142fc9d23380549fc0b3b7fda074f81c24b8887b5e9bdf40f5
# my ide is throwing this error in the go.mod
error while importing tinygo.org/x/drivers/netlink: package net/netip is not in std (/home/joseph/.cache/tinygo/goroot-e71eb3d56fb851142fc9d23380549fc0b3b7fda074f81c24b8887b5e9bdf40f5/src/net/netip)
What is the output from running tinygo env
?
I'm having the same issue, but using a raspberry pico.
I set GOROOT
and GOFLAGS
from the result of tinygo info pico
command, run tinygo build -o main.uf2 main.go
and I get the error package sync/atomic is not in std
, but with a different path from the one I specified.
Apparently tinygo
keeps creating new folders, so it never compiles. I guess I'm going to try with an earlier version.
GOROOT and GOFLAGS are automatically set when running the tinygo command, so you don't need to configure them yourself. In general, it's better not to set them.
ok good to know!
Indeed. Don't set GOROOT
or GOFLAGS
, they will only mess things up. And make sure they aren't set by checking env
(run env | grep GOROOT
or similar).
For IDEs, you can set GOROOT
to the value in "cached GOROOT". For example, here is what the vscode-tinygo extension does:
https://github.com/tinygo-org/vscode-tinygo/blob/main/src/extension.ts#L51-L100
...but make sure these environment variables only apply inside the IDE! The IDE should (hopefully) have a way to configure these environment variables.
I got the similar error, go build
works well, tinygo build
report:
../../../../pkg/mod/github.com/gin-gonic/gin@v1.10.0/recovery.go:15:2: package net/http/httputil is not in std (/home/eric/.cache/tinygo/goroot-18fe219864c1abce0632092c6bb93c7ada89c1c5d45131f776258a833c68f038/src/net/http/httputil)
../../../../pkg/mod/github.com/gogf/gf@v1.16.9/net/ghttp/ghttp_server_pprof.go:10:2: package net/http/pprof is not in std (/home/eric/.cache/tinygo/goroot-18fe219864c1abce0632092c6bb93c7ada89c1c5d45131f776258a833c68f038/src/net/http/pprof)
../../../../pkg/mod/github.com/gogf/gf@v1.16.9/net/ghttp/internal/client/client.go:22:2: package net/http/cookiejar is not in std (/home/eric/.cache/tinygo/goroot-18fe219864c1abce0632092c6bb93c7ada89c1c5d45131f776258a833c68f038/src/net/http/cookiejar)
../../../../pkg/mod/golang.org/x/net@v0.25.0/http2/transport.go:26:2: package net/http/httptrace is not in std (/home/eric/.cache/tinygo/goroot-18fe219864c1abce0632092c6bb93c7ada89c1c5d45131f776258a833c68f038/src/net/http/httptrace)
I got this, tinygo support only a sub set of go std api: https://tinygo.org/docs/reference/lang-support/stdlib/
I set my GOROOT from the tinygo info.
I try to build. The build process looks for modules in the wrong cache directory.
I'm getting these errors. I think
package sync/atomic is not in std
package net/netip is not in std
I was using the latest version of tinygo and the same thing was happening so moved to 0.29
I'm sure I'm missing something in my setup. If anyone could help that would be great.
Why do new tinygo caches keep getting added to the cache dir? What is the rational around that? I just cleared everything and it just keeps growing. I feel like everytime I run
tinygo flash
it adds a new one.