News for hackers. Stuff that matters.

0xjnml

FTR: Go does not remove the semicolons. To the contrary, the lexer inserts them where the Go language grammar requires them. (Which avoids the parsing gotchas as you correctly pointed out.)
Re:Just Fucking Use Go on Saturday May 09, 2026 @09:48AM (#48074950)
> Yeah, it breaks when the author decides to move from Github into Gitlab to protest against Microsoft.

The import path is disconnected from where the build system looks for the files. Of course, the default is to use the import path as an URL, right, but nothing forces you to do that. And if you do, *you* lock yourself to the hosting you use. But that can be hardly blamed on Go.

Documentation here: https://pkg.go.dev/cmd/go#hdr-Remote_import_paths

Full example: https://github.com/rsc/swtch/blob/master/app/rsc-io/main.go

tl;dr: Serve this at your domain, update the repo-root when changing host platform for your code: <meta name="go-import" content="import-prefix vcs repo-root">. No one else has to do anything.

Re: on Friday March 27, 2026 @05:06AM (#47540456)
The results for the 26.03 benchmark run are in. (golang)

With the recent release of ncruces' drive switching from wazero to wasm2go, there have been expectations of possibly substantial improvements. Our numbers confirm this: the wasm2go-based driver (ncruces) has recovered significant ground compared to the February results, narrowing the gap with its competitors. The driver erased its worse performance on targets not natively supported by wazero. Well done, u/ncruces!

Re: on Tuesday March 17, 2026 @09:55AM (#47412745)
CGo-free as always. See CHANGELOG.md for details.

https://gitlab.com/cznic/sqlite/-/blob/master/CHANGELOG.md

Re:Defer Available in GCC and Clang on Friday February 20, 2026 @07:17AM (#47087094)
> I wonder what the thought process of the Go designers was when coming up with that approach.

Sometimes we need block scoped cleanup, other times we need the function one.

You can turn the function scoped defer into a block scoped defer in a function literal.

AFAICT, you cannot turn a block scoped defer into the function one.

So I think the choice was obvious - go with the more general(izable) variant. Picking the alternative, which can do only half of the job, would be IMO a mistake.

Re: on Friday January 30, 2026 @02:16PM (#46828617)
I wrote a post exploring egg, a new tool that generates recursive descent parsers from Go-style EBNF. The most interesting feature is that it doesn't generate struct nodes; it encodes the AST into a flat []int32 slice for cache locality and reduced GC pressure. I included a walkthrough of generating a JSON parser with it.
Re:Golang's Big Miss on Memory Arenas on Thursday December 11, 2025 @07:18AM (#46230458)
> If you really want an arena like behavior you could allocate a byte slice and use unsafe to cast it to literally any type.

Only if the type is not a pointer per se or does not contain any inner pointers.

Otherwise the garbage collector will bite you hard.

Re:The Green Tea Garbage Collector on Thursday October 30, 2025 @12:31PM (#45761890)
YouTube is one such.
Re:Qbecc – QBE based C compiler on Tuesday October 21, 2025 @05:46AM (#45654067)
Documentation for the QBE IL is here: https://c9x.me/compile/doc/il.html

I find it quite usable.

Re:Qbecc – QBE based C compiler on Friday October 03, 2025 @10:06AM (#45463181)
Maintainer here, AMA.
You took the wrong exit, sir. This is the right way: https://en.wikipedia.org/wiki/Request_for_Comments
Re:Comparing Golang SQLite to C SQLite on Saturday June 21, 2025 @09:52AM (#44337623)
> The page you linked compares golang bindings against each other, not C against golang like my test did

No one disputed that. But it follows that your benchmarks are comparing C to [some very] outdated versions of Go packages. Which is what I tried to point out.

Re:Comparing Golang SQLite to C SQLite on Friday June 20, 2025 @06:49AM (#44326500)
It seems you're using some old Go package versions for your benchmarks.

See https://pkg.go.dev/modernc.org/sqlite-bench#readme-tl-dr-sco... for the numbers using the more recent versions.

Re:Show HN: Pure Go QuickJS JavaScript engine (Golang) on Tuesday May 13, 2025 @04:23AM (#43970734)
It is transpiled from C to Go, meaning 90+% of the effort is mechanized.

Ad performance. In some micro benchmarks the Go version is ~4x slower: https://gitlab.com/cznic/libquickjs/-/blob/675ee343753c42341...

However, it's already ~25% faster, in a different benchmark, than another Go JS VM written from scratch: https://pkg.go.dev/modernc.org/[email protected]#hdr-Performan...

I am currently looking around if it can be improved more and there are some ideas to try out.

Re:Layered Design in Go on Tuesday April 22, 2025 @07:34AM (#43760927)
go.mod files have no dependencies, so neither they can have circular dependencies.

go.mod files just list the dependencies of their respective package.

Re:Tcl/Tk application binaries through Go on Tuesday February 25, 2025 @03:40AM (#43169549)
- Turn Tcl code into standalone executables

- Easily cross-compile these executables for other systems

Re:Are Golang slices dynamic arrays or fat pointers? (2024) on Friday January 03, 2025 @01:15PM (#42588053)
Go slice is neither of that, it is a window into an array.
Re:Being a Developer in the Age of Reasoning AI on Monday December 23, 2024 @04:28AM (#42493070)
Time spent writing code is IMO the smallest part of software engineering.

Optimizations give better results when care is taken first about the most costly parts.

Re:VisualMD: A CGo-free WYSIWYG Markdown editor in Golang on Saturday November 09, 2024 @04:16PM (#42096947)
Check it out!

$ CGO_ENABLED=0 go install modernc.org/visualmd@latest

Re:Equ: A Plain TeX Math Editor in Golang and Tk9.0 on Tuesday October 08, 2024 @04:50PM (#41781699)
Check it out!

Older »