Go 1.26 Release Notes

(go.dev)

47 points | by runesoerensen a day ago ago

6 comments

  • _ikke_ a day ago ago

    My favorite from this release.

    > The built-in new function, which creates a new variable, now allows its operand to be an expression, specifying the initial value of the variable.

    So no need for separate helpers anymore to instantiate a pointer to a literal.

    • candiddevmike a day ago ago

      Now if only the Go gods would grant us in line ternaries to avoid all of the overly verbose nil checks, I'd be more likely to use pointer values in structs. Right now they're big foot guns that the compiler won't catch (and AFAIK no linter will check if you did a nil check before accessing).

      I have a tech debt TODO on my backlog to rationalize null usage (waiting on encoding/jsonv2) where I'll go through structs and better determine which properties should be null (or even empty) both from a JSON and DB perspective, especially with custom types in the mix. Hopefully reducing the amount of possible values the TS frontend needs to handle...

  • gwd a day ago ago

    > The baseline runtime overhead of cgo calls has been reduced by ~30%.

    This is great, but tell me more? What happened?

    • prattmic a day ago ago

      We changed the way we track Go threads in syscalls/cgo calls, which allowed us to remove one atomic store and one atomic compare-and-swap from the cgo call path. https://go.dev/cl/646198 and https://go.dev/cl/708596 are the relevant changes.

      (It's basically an easter egg, but if you look at the source of the release notes, you will see that most entries in the release notes have an HTML comment referencing the Go CL or issue that the entry refers to.)

  • deagle50 a day ago ago

    > the compiler can now allocate the backing store for slices on the stack in more situations

    Any details on when this happens?