TinyGo 0.45.0 (github.com)

195 points by iaaan 8 hours ago

21 comments:

by neomantra 5 minutes ago

I was a drive-by contributor to TinyGo, focused on getting MacOS and JS/WASM working well this summer, along with getting BubbleTea to work with it (the last of which was finally merged yesterday!). It was a lot of work, but now it unlocked so much capability for me.

The TinyGo project is an intensely talented cadre of developers. They care deeply this alternative Go compiler/runtime. It was really neat to see them in action and how an already established project accelerated in a year.

It was interesting to see how they adopted LLMs (basically use them but you better know what's going on) and how they dealt with newcomers. The project's scaffolding has improved to keep pace.

While it was intended to get Golang on small devices, the same love makes it work well for WASM. Also it improves as LLVM improves.

I rather consistently get 50% size binaries that run 10% faster and use lower memory than Vanilla Go. The drawback is 5x slower build times. So I dev-loop with Vanilla go and then prod-loop with TinyGo.

Booba will help you embed your Golang in a browser, either Vanilla or TinyGo. There's still some go.mod friction, but the next BubbleTea release will fix that.

https://nimbleterminal.com/booba

Here's some TinyGo interactive graphics next to Vanilla:

https://nimblemarkets.github.io/ntcharts3d/?demo=gallery&com...

Pro-tip: use gc=boehm for JS/WASM targets

by donatj 2 hours ago

Very nice! I have really been enjoying TinyGo for a couple Pi Pico projects I've been toying with.

Way saner than the C pico projects I've helped my friend work on.

Maybe it's just me but I kind of wish there was more of a way to clearly differentiate a Go project from a Tiny Go project, like .tgo file extensions or like a "compiler tinygo" directive in go.mod or something.

by K0IN 13 minutes ago

Sorry, I did not use tiny go yet (it's on my bucket list for a long time), i thought it's compatible with go, why would you need a differentiation?

by gen2brain 2 hours ago

That is usually done with the build tags, for different OSes and arches, and TinyGo defines the tinygo build tag.

by dofm 5 hours ago

Part of my LLM-and-agentic-learning phase is giving up interpreted web dev languages and forcing myself to develop agentic skills by using a language I am less familiar with.

I have some Go experience (a small utility used by some dozens of quite niche customers) and trivial experience of macOS development.

So far my two projects have been Go/Gin/goose etc. — a web app — and a small desktop Swift app. But there's GUI stuff for Go and web stuff for Swift. (I could have written my mac app exactly in Golang because there's a package that does what I need)

I had hoped I would find that one of these languages was clearly better than the other. Go is obviously better for the LLM, maybe a bit tiresome to see enormous reams of it for me. Swift is a little harder on the LLM (and it builds more slowly) but it's a bit easier on the eye; I've been very productive in it.

Here, again, it will be hard to separate TinyGo and Embedded Swift.

And there's WASM support for both.

by shim__ 34 minutes ago

Swift has no garbage collector(just reference counting) as opposed to Go, which should make it a better fit for microcontrollers, since the runtime is lighter

by KingOfCoders 7 hours ago

I'm using it to generate WASM, sadly Go with the GC/goroutine infra is not as good a WASM language than e.g. Rust which is a very simple 'binary', TinyGo works well though.

by rcarmo 4 hours ago

Yep. I use it on https://github.com/rcarmo/go-rdp for my RDP web client.

by logicallee 7 hours ago

Could I ask how you do that? How do you actually build with a webassembly target? I might be interested.

by wffurr 5 hours ago

From the TinyGo docs, it’s as simple as

    GOOS=js GOARCH=wasm tinygo build -o wasm.wasm ./main.go
https://tinygo.org/docs/guides/webassembly/wasm/

It relies on LLVM’s Wasm backend and some JS glue libraries for the browser.

by KingOfCoders 6 hours ago
by childintime 4 hours ago

Appreciated.

by logicallee 6 hours ago

that's really interesting, thank you. I'm not sure we're ready to use that platform, though :)

by KingOfCoders 5 hours ago

Many aren't, it's a big ask. But I'm more interested in spreading the idea than selling something. I found WASM an underrated gem - e.g. https://pglite.dev/

by mrtimo 4 hours ago

Agreed. DuckDB wasm is amazing. [1]

[1] https://github.com/duckdb/duckdb-wasm

by 01HNNWZ0MV43FF 6 hours ago

So you want to take arbitrary code in arbitrary languages, and run it on someone else's computer inside a sandbox?

Yes, wasm can do that.

You can compile the code to wasm, then run it in a runtime like wasmer or wasmtime. Or you can ahead-of-time compile it with something like wasm2c, which generates C code.

by actionfromafar 4 hours ago

w2c2 is also very good

by ncruces 23 minutes ago

Or (shameless plug) if you want to generate Go from Wasm: https://github.com/ncruces/wasm2go

by ghoul2 an hour ago

awesome. I love tinygo - these days mainly to be able to 'dual serve' my go services as cloudflare workers via the tinygo wasm target. works beautifully.

by shit_game 5 hours ago

TinyGo has been my favorite means of using my Raspi Picos so far. My only gripe so far is that maps are nigh unusable due to their slowness, but this is generally simple enough to work around (at the expense of performance). I'm sure there are still more rough edges, but I don't think I'm experienced enough with embedded software to identify them.

by pjmlp 5 hours ago

Lots of goodies in the release.

Congratulations to the team.

Are some of the improvements coming from TamaGo? I know there was supposed to exist a collaboration with other Go toolchains, if I remember correctly a issue that I saw fly by in the past.

Data from: Hacker News, provided by Hacker News (unofficial) API