TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Upcoming Features in Go 1.18

152 点作者 dcu超过 3 年前

12 条评论

shakezula超过 3 年前
Something I don’t see the Go team get enough praise for is their ability to bring major language changes like generics into the language in an actually backwards compatible minor version update.<p>If nothing else, I find myself choosing Go frequently because it’s not going anywhere and it’s not changing.
评论 #29163685 未加载
评论 #29163636 未加载
评论 #29165407 未加载
评论 #29170111 未加载
PaulKeeble超过 3 年前
We need a shortcut for the<p>if x,err = f(); err!=nil { return _,err }<p>pattern that is so common in go code. This is my biggest daily gripe and I work around it with a snippet but so much of integration code is this or a variant of it which captures the stack trace and it constantly distracts from the main flow of algorithm.
评论 #29164338 未加载
评论 #29166495 未加载
评论 #29164363 未加载
评论 #29166907 未加载
评论 #29164885 未加载
qaq超过 3 年前
1.18 shaping up to be a great release! My only remaining desired features:<p>* sum types (would be really nice)<p>* some equivalent of ? in Rust (can live without but would be nice)<p>After playing with a ton of languages have settled on Go for most projects.
评论 #29163635 未加载
marcus_holmes超过 3 年前
Dreading the wave of shitty badly-thought-out library &quot;updates&quot; to include generics (and the wave of shitty new libraries from people who never learned how to use interfaces and now think they know how to use generics). It&#x27;s going to be a year or so before the community settles down again after this.
评论 #29164630 未加载
评论 #29166380 未加载
评论 #29167624 未加载
评论 #29164313 未加载
woah超过 3 年前
Generics will be insanely useful for me. I work in an environment that uses a huge Golang KV store for all persistence. This means we write all of our own indexing code etc. None of it is reusable because of the lack of generics, so each module has much of the same boilerplate for building second indexes, etc, often written in slightly different styles because it was written by different people.<p>Generics will let us build a set of tools for DB access and indexing tools which can be reused across all types.
评论 #29163826 未加载
2pEXgD0fZ5cF超过 3 年前
Been a while since I worked with Go but I&#x27;m considering it for an upcoming project. Is there any word on a new, updated version of &quot;The Go Programming Language&quot; (Donovan, Kernighan) to cover all the new features since then? I really enjoyed working through that book.<p>If not: Any tips for a good resource to really get up to date with the new additions&#x2F;changes since ~2015?
评论 #29166004 未加载
评论 #29165993 未加载
Zababa超过 3 年前
Generics will be nice, and fuzzing is great too. I&#x27;m not a huge fan of Go itself, but it works well for my use case, websites and CLI tools. The integrated tooling (test, fuzz, race detector, benchmark, format, vet, package management, building) is very nice.
bithavoc超过 3 年前
wow I didn&#x27;t know about the workspace file, replace directives are messy. It seems like I&#x27;m going to remove 149 replace directives of my own, what a nightmare.<p><pre><code> grep -rnw &#x27;.&#x27; --include=\*.mod -e &#x27;replace&#x27; | grep &quot;&quot; -c 149</code></pre>
评论 #29163861 未加载
评论 #29163761 未加载
Andys超过 3 年前
&gt; With Go 1.17 it took 56 seconds to format all files<p>This sounded extremely slow to me - go fmt is normally instant. Granted, cockroachdb is a big project<p>But I had to download and try, and on my computer (Ryzen 5950X) it only took ~3.1s on Go 1.17. I didn&#x27;t bother trying tip.
评论 #29170611 未加载
rmanolis超过 3 年前
Now with generics, it will eat the pie from Java market.
评论 #29163454 未加载
评论 #29164620 未加载
评论 #29163533 未加载
superbaconman超过 3 年前
Wow the IP stuff looks awesome! Generating ranges of IP addresses should have been in the stdlib for a long time.
gauchojs超过 3 年前
Can generic sorting be implemented now ?