Go 1.27

(go.dev)

244 points | by database64128 2 hours ago

20 comments

  • e4m2 29 minutes ago
    Not mentioned: Floating-point parsing and formatting now uses Russ Cox's uscale algorithm.

    https://research.swtch.com/fp

    https://github.com/golang/go/blob/go1.27.0/src/internal/strc...

  • guessmyname 35 minutes ago
    Brace for a wave of drive-by pull-requests swapping google/uuid [1] out for the now-standard uuid package [2].

    Kubernetes project will be the first one [3] I guarantee it.

    [1] https://pkg.go.dev/github.com/google/uuid

    [2] https://go.dev/pkg/uuid

    [3] https://github.com/kubernetes/kubernetes/blob/2220c3853a2402...

    [4] https://github.com/google/uuid/issues/221

    • iaaan 21 minutes ago
      Unfortunately for people SELECTing UUIDs out of a DB directly into a uuid struct, the built-in uuid structs don't implement the necessary interface for that, so you'll have to continue using the google package, or a plain string.
      • reactordev 11 minutes ago
        Oooof… well played go team, well played.
      • deepsun 5 minutes ago
        Or just a number (128-bit).
    • dabber21 24 minutes ago
      will 'go fix' take care of this?
  • teabee89 1 hour ago
    I love how proactive the crypto team is about post quantum. They released https://pkg.go.dev/crypto/mldsa. The lead maintainer Filippo Valsorda wrote a nice piece here[1] to urge the tech world to start deploying good enough versions of post quantum crypto.

    [1] https://words.filippo.io/crqc-timeline/

    • halJordan 48 minutes ago
      While I'm highly sympathetic to competing priorities crowding out movement to pq cryptography. At the same time it's not sudden at all. It's been 10 years since nist first said "move shit over"?
      • Valodim 29 minutes ago
        Yes, and at that time the answer was "move over where?" now it's 2026 and x-wing is a draft still
  • Xeoncross 1 hour ago
    > First, generic methods are now supported > Generic functions can now be used without explicit type arguments

    Great! This was an ergonomic code issue I hit when trying to create a universal handler/controller generic that could hydrate/populate function arguments (from a request body) without having an actual copy of the arguments: https://github.com/xeoncross/mid/blob/main/handler.go#L12

    • iaaan 18 minutes ago
      Neat, stealing this.
  • olingern 1 hour ago
    > Second, a key in a struct literal may now be any valid field selector for the struct type, allowing fields in nested or embedded structs to be initialized directly

    It's been a while since I've written more than anything trivial in golang, but this seems like a big deal to me. As in, I can define a struct that is consistent and reusable in other structs

    • konart 35 minutes ago
      This is quite a QoL issue, but is it big? Nothing changes from functional point of view.
  • piinbinary 1 hour ago
    This makes me want to find a side project for an excuse to give Go another try (I last used it professionally pre-generics).

    I do still wish it had discriminated unions (algebraic data types) and some better error handling ergonomics.

    • ainar-g 1 hour ago
      Re unions:

      https://github.com/golang/go/issues/76920

      You might want to follow this proposal, if you aren't already. It's the most recent one, and it's supported by quite a few “core members” of the Go Team. I don't think it'll land in 1.28, but I like the fact that it's still a feature that's being actively discussed.

    • Splizard 41 minutes ago
      Tagged unions can be implemented in user code, you dont actually need language support to use them.

      https://github.com/splizard/tagged

      • mirashii 31 minutes ago
        This is only a small piece of the story for what people say when they want tagged unions. Without all of the ancillary support in the language, like exhaustive pattern matching, it really doesn't count.
        • Splizard 11 minutes ago
          You can also add support for exhaustive switches on tags.
      • shhsshs 16 minutes ago
        That is a LOT of code (very ugly code, I would add) that could be replaced by `type Float = float32 | float64` in a language with actual support for union types.
    • codegeek 46 minutes ago
      Do it. It is just a beautiful language to write and much simpler to pickup than many others. I am a fan boy of course but I love Go.
  • patabyte 1 hour ago
    I'm so glad the new uuid package landed - it's overdue but a very welcome addition! I've already replaced github.com/google/uuid with `uuid` in several projects
  • sethops1 1 hour ago
    FYI golangci-lint and gopls are both broken if you try using generic methods.
    • atsjie 1 hour ago
      Thank you for the headsup!
  • nick_ 1 hour ago
    Nice additions to go.

    I like to imagine that one day we'll have a language that launched with all the features languages eventually add. The whole ecosystem of packages would be built on them instead of a legacy of more primitive language feature sets.

    • fmbb 1 hour ago
      I don’t think launching Go today would have been better than 15 years ago.

      Standard ML is a perfect programming language from the 90s. It unfortunately does not have a great eco system of packages.

      • qaq 33 minutes ago
        I mean one thing frontier models are really good at is porting code with pretty low level of supervision. Provided there are enough fans porting packages from other ecosystems should not be a big challenge.
  • tyho 25 minutes ago
    The SIMD stuff is incredible. I have been having lots of fun with it. You can use LLMs as a scalar to SIMD transpiler, it works amazingly well.

    Sure a SIMD expert writing assembly can probably do a better job than an LLM using these new intrinsics, but it’s still massively faster.

  • tschellenbach 1 hour ago
    Every release CPU load becomes a bit lower. Love it :)
  • jeanbza 1 hour ago
    I have been waiting for generic methods and can't wait to use them!

    The `go fix` modernisers are also great, have already run them in several repos.

  • SpaceManNabs 8 minutes ago
    Wait generics? What changed? Why is golang accepting of generics now?
    • a2ff6eeb0 5 minutes ago
      They landed half a decade ago...
  • tschellenbach 1 hour ago
    New JSON is amazing, and SIMD will be big for json, audio/video etc.
  • olexsmir 1 hour ago
    Full release notes: https://go.dev/doc/go1.27
  • tonymet 1 hour ago
    I love Go because even minor versions deliver great value like this. The struct literal inits and generic methods are great conveniences to clean up clumsy boilerplate.

    Not to mention it’s just a dream language to work with , especially when building concurrent applications. I love engaging all of my cores. And memory is so expensive nowadays

    • radicalriddler 35 minutes ago
      Minor versions are basically major versions for Go. They’ll “never” create a Go v2 because they prioritise maintaining backwards compatibility as a language feature, thus following semver rules, no majors.
  • Hasz 1 hour ago
    I have recently been spending time learning go, really really liking the language, awesome standard lib, excellent tooling and great experience.

    It sounds like the dumbest thing in the world, but I love the import system auto-adding stuff inside of vscode when I need it. just slick.

  • CurbStomper 50 minutes ago
    [dead]
  • fatty_patty89 1 hour ago
    [flagged]
    • simlevesque 1 hour ago
      Being on the HN's homepage isn't as simple as "most upvoted articles in last X hours". They take into account upvote velocity: 40 upvotes in 40 minutes isn't the same as 40 upvotes in 4 yours.
      • fatty_patty89 1 hour ago
        no, it wasnt 40 upvotes in 40 minutes, it was at 8 upvotes after 34 minutes posted
    • applfanboysbgon 1 hour ago
      Would you rather have yet another LLM-generated slop article in its place instead of an article covering a major release for a widely-used language? Out of all the articles that reach the HN front page, this is the one you have a problem with?
  • pregnenolone 9 minutes ago
    Wasn't Go supposed to be "simple"? I remember how Go advocates used to boast about not having generics and now it almost seems like Go is trying to become some sort of C# or Java Frankenstein. I'm not even trying to badmouth Golang - just legitimately confused.