TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Go 1.21 Release Candidate

337 pointsby pk2200almost 2 years ago

32 comments

physiclesalmost 2 years ago
This is at least the biggest release since 1.18 with generics, possibly bigger. I’m excited because the changes demonstrate a transition from the traditional go philosophy of almost fanatical minimalism, to a more utilitarian approach.<p>Loop variable capture is a foot-gun that in the last six years has cost me about 10-20 hours of my life. So happy to see that go. (Next on my list of foot-guns would be the default infinite network timeouts — in other words, your code works perfectly for 1-N months and then suddenly breaks in production. I always set timeouts now; there’s basically no downside)<p>Interesting to see them changing course on some fundamental decisions made very early on. The slices *Func() functions use cmp() int instead of less() bool, which is a huge win in my book. Less was the Elegant yet bizarre choice — it often needs to be called twice, and isn’t as composable as cmp.<p>The slog package is much closer to the ecosystem consensus for logging. It’s very close to Uber’s zap, which we’re using now. The original log package was so minimal as to be basically useless. I wonder why they’re adding this now.<p>I’ve already written most of what’s in the slices and maps packages, but it’ll be nice to have blessed versions of those that have gone through much more API design rigor. I’ll be able to delete several hundred lines across our codebase.<p>What’s next? An http server that doesn’t force you to write huge amounts of boilerplate? Syntactic sugar for if err != nil? A blessed version of testify&#x2F;assert? Maybe not, but I’m happy about these new additions.
评论 #36427941 未加载
评论 #36428848 未加载
评论 #36427800 未加载
评论 #36428783 未加载
评论 #36427817 未加载
评论 #36427664 未加载
评论 #36427581 未加载
nu11ptralmost 2 years ago
It is interesting to see them add things like the &quot;clear&quot; function for maps and slices after suggesting to simply loop and delete each key one at a time for so long. Is this a result of the generics work that makes implementation easier vs. the extra work of making a new &quot;magic&quot; function (like &quot;make&quot;, etc.)?
评论 #36424335 未加载
评论 #36425759 未加载
评论 #36425043 未加载
评论 #36424385 未加载
评论 #36424271 未加载
评论 #36426567 未加载
评论 #36427409 未加载
Hakkinalmost 2 years ago
Huh, I&#x27;m glad to see generic Min&#x2F;Max functions, but the fact that they&#x27;re built-ins is a little odd to me. I would have expected them to put a generic math library into the stdlib instead. The fact the stdlib math package only works with float64s has always struck me as a poorly thought out decision.
评论 #36424551 未加载
评论 #36424826 未加载
评论 #36425274 未加载
cube2222almost 2 years ago
I&#x27;m a bit surprised that the slog package was added to the stdlib, but it does seem to use the API that I think is the most ergonomic across libraries I saw in Go (specifically, varargs for key values, and the ability to create subloggers using .With), so I guess it&#x27;s nice most of the community will standardize around it.<p>If all goes well, you won&#x27;t have different libraries using different loggers anymore, in some not too distant future, which should improve easy composability.
评论 #36424582 未加载
评论 #36424794 未加载
评论 #36425282 未加载
评论 #36425572 未加载
djsavvyalmost 2 years ago
The new experimental fix for loop variable capture [0] is huge; this is the biggest footgun with the language in my experience.<p>I hope the experimental fix makes it into the next version of Go by default.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;wiki&#x2F;LoopvarExperiment">https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;wiki&#x2F;LoopvarExperiment</a>
评论 #36427212 未加载
monocasaalmost 2 years ago
Nice, my push for actually using the sha256 instructions on amd64 finally got released. 3x-4x increase in hash speed on most x86 which is really nice for content addressable storage use cases like handling container images.
评论 #36424312 未加载
评论 #36424393 未加载
ubavicalmost 2 years ago
I enjoy Go so much. It is almost perfect language for getting things done, but I still can&#x27;t understand some design choices.<p>Does someone knows why Go uses env variables (like GOOS and GOARCH) instead command line arguments?
评论 #36424619 未加载
评论 #36424466 未加载
评论 #36425963 未加载
评论 #36424396 未加载
评论 #36424338 未加载
idbfsalmost 2 years ago
Worth noting that the release announcement was written by Eli Bendersky, of <a href="https:&#x2F;&#x2F;eli.thegreenplace.net&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;eli.thegreenplace.net&#x2F;</a> fame. It&#x27;s a fantastic technical blog with literally decades of content.
silisilialmost 2 years ago
These new packages, like slices and maps, were a long time coming. So glad it&#x27;s finally here.<p>I cannot even begin to tell you how many different itemInSlice functions I&#x27;ve written over the years.
评论 #36426680 未加载
评论 #36425208 未加载
w10-1almost 2 years ago
Overall, a release more for engineering than language. Even the new API&#x27;s are mainly optimizations, and optimizations are netting ~10% (pretty good for an mature toolset).<p>The WASI preview shows Google is committing engineering resources to WASM, which could grow the community a touch.
评论 #36427110 未加载
jsd1982almost 2 years ago
A good first step for better WASM support, however it&#x27;s currently incompatible with tinygo&#x27;s WASM target.<p>For example, I&#x27;m working on a custom WASM host (non-browser) and have a tinygo WASM package with import bindings like this:<p><pre><code> &#x2F;&#x2F;go:wasm-module rex &#x2F;&#x2F;export wait_for_event func wait_for_event(timeout_usec uint32, o_event *uint32) bool </code></pre> Both these comment directives are tinygo-specific of course, and now Go has added its own third and different directive of course.<p>When I add Go&#x27;s desired `&#x2F;&#x2F;go:wasmimport rex wait_for_event` directive, it complains about the types `*uint32` and `bool` being unsupported. Tinygo supports these types just fine and does what is expected (converting the types to uint32). On the surface, I understand why Go complains about it, but it&#x27;s such a trivial conversion to have the compiler convert them to `uint32` values without requiring the developer to use unsafe pointer conversion and other tricks.<p>Hopefully I can find a way to keep both tinyo and Go 1.21rc2 happy with the same codebase going forward and be able to switch between them to evaluate their different strengths and weaknesses.
评论 #36427099 未加载
showdedddalmost 2 years ago
I wonder if the new stdlib logger is featured enough to get rid of logrus&#x2F;zerolog.
评论 #36424474 未加载
Karupanalmost 2 years ago
<i>Release candidate</i>
philosopher1234almost 2 years ago
Seems like a really substantial release to me. The new built in functions min, max, and clear are a bit surprising, even having followed the discussions around them. The perf improvements seem pretty great, I’m sure those will get much love here.<p>Personally, I’m most excited about log&#x2F;slog and the experimental fix to loop variable shadowing. I’ve never worked in a language with a sane logging ecosystem, so I think slog will be a bit personally revolutionary. And the loop fix will allow me to delete a whole region of my brain. Pretty nice.
评论 #36424217 未加载
评论 #36424147 未加载
评论 #36424039 未加载
SergeAxalmost 2 years ago
Please add &quot;RC1&quot; to post title. Currently it&#x27;s misleading than a stable release is here.
bbkanealmost 2 years ago
I love the new stdlib additions- I&#x27;ve been pulling in these dependencies since generics arrived and it&#x27;ll be nice to have them built-in.
earthboundkidalmost 2 years ago
An extremely generic release.
评论 #36423921 未加载
评论 #36424222 未加载
评论 #36424166 未加载
评论 #36425882 未加载
openasocketalmost 2 years ago
Glad to see the crypto performance improvements, I noticed a major regression in the performance of some auth code with 1.20
29_29almost 2 years ago
This is a big release. Lots of new packages. The language is changing
评论 #36425814 未加载
throwaway5959almost 2 years ago
Why is map copy &quot;dst, src&quot; vs &quot;src, dst&quot;?
评论 #36424598 未加载
评论 #36424623 未加载
评论 #36426905 未加载
tastysandwichalmost 2 years ago
Really glad to see some of these new packages (sort, map, etc) making use of generics. Should reduce the need for a lot of helper functions.<p>Also really excited to see loop capture variables finally getting sorted out. It is a constant pain point with new devs, and I have no good answer when they ask &quot;but WHY is it like this?&quot;<p>More information about loop capture here for those interested <a href="https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;discussions&#x2F;56010">https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;discussions&#x2F;56010</a>
评论 #36427506 未加载
H1Supremealmost 2 years ago
The new built in functions for slice manipulation are a welcome addition!
suessflorianalmost 2 years ago
Nice - but hang on a second, I thought you cannot shadow language keywords in Go. So projects bumping to 1.21 in the future should be aware that you will run into compile time errors all of a sudden… doesn’t that actually break the compatibility promise?<p><pre><code> max := something() </code></pre> <a href="https:&#x2F;&#x2F;go.dev&#x2F;doc&#x2F;go1compat" rel="nofollow noreferrer">https:&#x2F;&#x2F;go.dev&#x2F;doc&#x2F;go1compat</a>
评论 #36426726 未加载
评论 #36426632 未加载
评论 #36426678 未加载
nasretdinovalmost 2 years ago
I am honestly surprised nobody mentioned the intention of Go team to make multipath TCP the default in later releases
评论 #36424923 未加载
slantedviewalmost 2 years ago
This is great, but why do I get the sense that Golang&#x27;s development is so slow? Ex:<p>Java: We added structured concurrency and virtual threads!<p>Golang: We added a min function!<p>Most of the standard lib still doesn&#x27;t properly support generics, and at this pace, it will be another 5 years at least before it does.
评论 #36427547 未加载
评论 #36427814 未加载
WhereIsTheTruthalmost 2 years ago
&gt; New built-in functions: min, max and clear.<p>What a mistake.. reserved keywords are words I can no longer use for myself...<p>Zig does it better by requiring a prefix @ for most their builtin needs
评论 #36425419 未加载
评论 #36424716 未加载
评论 #36425322 未加载
评论 #36425054 未加载
评论 #36425222 未加载
panzialmost 2 years ago
Wait is this now heap allocating a value in every iteration of every loop? I hope that allocation is optimized out in every case where there isn&#x27;t a closure over the loop variable?
评论 #36424577 未加载
评论 #36425169 未加载
评论 #36425035 未加载
评论 #36424576 未加载
评论 #36424567 未加载
synergy20almost 2 years ago
really hope Go has something like MERN for node.js or Django for Python, so I can use it for ready-to-go backend framework. There are gin and echo etc, just not as widely adopted as MERN or Django.<p>in some of my use cases, I need make sure source code is fully protected, neither Node nor Django can do that well, Go will be perfect as it is compiled, however there is nothing like MERN or Django in Go(yet). Another option will be Java, but I do not know Java.
throwawaygoalmost 2 years ago
Can we get arenas yet?
评论 #36431115 未加载
pizzafeelsrightalmost 2 years ago
Was there a push to get it released today?
评论 #36425475 未加载
throwawaygoalmost 2 years ago
So I guess with new builtin functions we will be breaking backwards compatibility?
评论 #36425533 未加载
Cybergenikalmost 2 years ago
Wrote a blog explicitly asking for some of these changes last year: <a href="https:&#x2F;&#x2F;www.lremes.com&#x2F;posts&#x2F;golang&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.lremes.com&#x2F;posts&#x2F;golang&#x2F;</a><p>Nice to see their going in a good direction.