Go 1.27

(go.dev)

348 points | by database64128 3 hours ago

23 comments

  • e4m2 2 hours 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...

    • jeremyloy_wt 1 hour ago
      I’m so happy Russ still contributes even though he isn’t lead anymore. I always enjoy reading his blog posts
      • dvt 1 hour ago
        One of my engineering highlights was Russ reviewing a few of my contributions to Golang (to the core http library). He's a super cool and nice guy. I don't really write that much Go anymore, but it was a fun & cute language when it first came out.
  • xavdid 41 minutes ago
    I love these release notes but I really wish they would add syntax highlighting to the Go blog. I'm always a little bit surprised/disappointed whenever I land on a go.dev link since I know the code will be just a little harder to visually parse than it needs to be.
    • treyd 36 minutes ago
      There's a reason for this. Rob Pike was asked about it and said that syntax highlighting reminds him of the bright colors of children's toys and he personally disables it so that he can focus on the text.

      I don't know why it's still like that but that's the original reasoning.

      • tester457 32 minutes ago
        > Syntax highlighting is juvenile. When I was a child, I was taught arithmetic using colored rods (http://en.wikipedia.org/wiki/Cuisenaire_rods). I grew up and today I use monochromatic numerals.

        https://groups.google.com/g/golang-nuts/c/hJHCAaiL0so/m/kG3B...

        • IshKebab 8 minutes ago
          That must be why traffic lights and electrical wires and transit maps are all black and white...
      • xavdid 25 minutes ago
        That makes sense as a personal preference for him, but it's odd for that to still be the company/project stance. Like, surely he knows he's the minority for not wanting highlighting?
      • mparnisari 25 minutes ago
        that's an extremely odd explanation and it makes me think that he has some hidden PTSD. it's also insane that one person's preference trumps the rest of the world's.
        • pigeonhole123 17 minutes ago
          He also doesn't capitalize his sentences.
        • zanderwohl 15 minutes ago
          Welcome to Go as a project.
    • ClikeX 21 minutes ago
      I just have a tampermonkey profile for go.dev to fix that for me.
  • teabee89 2 hours 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 2 hours 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 2 hours ago
        Yes, and at that time the answer was "move over where?" now it's 2026 and x-wing is a draft still
        • halJordan 33 minutes ago
          Ah. This is a bold faced lie. There were plenty of options in 2016. Nist released final candidates in 2024 and published the candidates this year.

          ssh (as noted in tfa) has had pq defaults since 2022.

          • blandflakes 22 minutes ago
            In case you wanted to know, the expression is actually "bald-faced lie", i.e. unmasked, shameless.
          • taybin 9 minutes ago
            Calling it a lie is pretty heavy.
    • eterm 37 minutes ago
      The .NET team have been similarly busy on post-quantum lately, it completely dominated the .NET API reviews for the dotnet 11 release.

      It seems there's a big push happening behind the scenes.

      • stackskipton 1 minute ago
        US Government is starting to push hard so code first needs to support it.
      • amelius 5 minutes ago
        Ok, but when is it coming to our web browsers and email clients?
  • guessmyname 2 hours 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 2 hours 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.
    • dabber21 2 hours ago
      will 'go fix' take care of this?
  • Xeoncross 2 hours 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 1 hour ago
      Neat, stealing this.
  • olingern 2 hours 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

    • andreimackenzie 23 minutes ago
      This will shorten many test files!
    • konart 2 hours ago
      This is quite a QoL issue, but is it big? Nothing changes from functional point of view.
      • onionisafruit 31 minutes ago
        It will be very nice working with code generators like oapi-codegen that can generate either nested structs or very unwieldy struct names. So big in that context, but like you said just a nice qol improvement most of the time.
  • piinbinary 3 hours 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 2 hours 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 2 hours ago
      Tagged unions can be implemented in user code, you dont actually need language support to use them.

      https://github.com/splizard/tagged

      • mirashii 2 hours 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 1 hour ago
          You can also add support for exhaustive switches on tags.
      • shhsshs 1 hour 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.
        • kccqzy 55 minutes ago
          Tagged unions are not union types. A union type is a supertype for any arbitrary collection of types, but a tagged union aka sum type is a single type with multiple data constructors, and does not require subtyping to be implemented.
      • kccqzy 57 minutes ago
        The C++ committee said the same thing, and gave us std::variant. They are painful to work with and do not really deliver most of the benefits people want.
    • codegeek 2 hours 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.
      • osigurdson 1 hour ago
        Go is extremely easy to pickup. If you know any language you probably know Go already for the most part (channels notwithstanding).

        I wouldn't say it is a "beautiful" language however. Though that is in the eye of the beholder, I don't think the Go designers were even really going for beauty.

        • fragmede 1 hour ago
          They were going for readability. You can make some impossible to read code with C++ because the programmer was too clever, and the designers of golang wanted to avoid that.
  • tyho 2 hours 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.

  • patabyte 3 hours 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 3 hours ago
    FYI golangci-lint and gopls are both broken if you try using generic methods.
    • atsjie 2 hours ago
      Thank you for the headsup!
  • nick_ 2 hours 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 2 hours 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 2 hours 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.
  • olexsmir 2 hours ago
    Full release notes: https://go.dev/doc/go1.27
  • tschellenbach 2 hours ago
    Every release CPU load becomes a bit lower. Love it :)
  • tschellenbach 2 hours ago
    New JSON is amazing, and SIMD will be big for json, audio/video etc.
  • jeanbza 3 hours 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.

  • tonymet 2 hours 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 2 hours 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.
      • tonymet 1 hour ago
        true that, but we get a couple of these a year it seems, so their overall velocity is excellent, and without breaking anything. a dream language.
  • Hasz 2 hours 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.

  • kar1181 1 hour ago
    Go - the language no one likes, but frankly everyone needs.
    • amelius 19 minutes ago
      Python is already the language everyone needs.
  • dude250711 9 minutes ago
    Quarterly reminder that Go still exists.
    • IshKebab 5 minutes ago
      I can imagine using it for simple web stuff. E.g. its perfect for something like Forgejo. But yeah... Seems like the world has moved on mostly.
  • CurbStomper 2 hours ago
    [dead]
  • fatty_patty89 3 hours ago
    [flagged]
    • simlevesque 3 hours 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 2 hours ago
        no, it wasnt 40 upvotes in 40 minutes, it was at 8 upvotes after 34 minutes posted
    • applfanboysbgon 2 hours 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?
  • SpaceManNabs 1 hour ago
    Wait generics? What changed? Why is golang accepting of generics now?
  • pregnenolone 1 hour 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.
    • kermatt 1 hour ago
      A problem was so many others were screaming about the lack of generics, as though there were not other language options that provided them.