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.

I Love Go; I Hate Go

279 pointsby tominousalmost 9 years ago

18 comments

_skelalmost 9 years ago
The most frustrating thing for me, by far, is that Go won&#x27;t let you import unused packages. When you are commenting stuff out to debug a program, or adding debug statements and removing them later, it constantly requires you to go back to the top of the file and comment out the unused libraries, only to uncomment them later when you&#x27;ve solved your problem.<p>The fact that there is not a compiler flag to disable this behavior, and that the core team is opposed to adding such a flag (<a href="https:&#x2F;&#x2F;golang.org&#x2F;doc&#x2F;faq#unused_variables_and_imports" rel="nofollow">https:&#x2F;&#x2F;golang.org&#x2F;doc&#x2F;faq#unused_variables_and_imports</a>), is simply ridiculous and makes programming in Go a real pain in the ass.<p>I can&#x27;t think of any other language that does this.
评论 #12208174 未加载
评论 #12208131 未加载
评论 #12209785 未加载
评论 #12208097 未加载
评论 #12208349 未加载
评论 #12208107 未加载
评论 #12209030 未加载
评论 #12208115 未加载
评论 #12208108 未加载
评论 #12209428 未加载
评论 #12208209 未加载
评论 #12208394 未加载
评论 #12208863 未加载
评论 #12209124 未加载
评论 #12217910 未加载
评论 #12210468 未加载
评论 #12208154 未加载
评论 #12208104 未加载
dpc_pwalmost 9 years ago
Oh. Go love-hate relationship post. My turn. So I really like channels and coroutines built into language and used everywhere: it makes some patterns compose nicely and language very productive.<p>But just as in the article - some of Golang choices are opinionated and IMO just stupid. Lack of assertions is one: Sure programmers are prone to ignoring errors, but Go is not helping at all. Just bans assertions and provides no improvements. No `try!`&amp;`Result` like Rust, not even warning by default if you ignored returned error (IIRC, go lint or go vet checks it) . So what&#x27;s the point?<p>How do you decrement an atomic in Go?<p>AddUint32(&amp;x, ^uint32(c-1))<p>That&#x27;s how. Easy to read, and self-explaining. <a href="https:&#x2F;&#x2F;golang.org&#x2F;pkg&#x2F;sync&#x2F;atomic&#x2F;" rel="nofollow">https:&#x2F;&#x2F;golang.org&#x2F;pkg&#x2F;sync&#x2F;atomic&#x2F;</a> . I mean... come on.<p>Unused errors being an error is super annoying, and changing variable capitalization everywhere, because you want to change symbol visibility is another daily frustration source.<p>Oh, and all my contacts with the community were very unpleasant (maybe it&#x27;s just me, or bad luck). Any questions ended with some form of &quot;you must do it one true way, otherwise you&#x27;re stupid&quot;. Eg. once I was looking for a way to terminate unit test in case of error, instead of writing `if err != nil { t.Errorf(...) }` over and over again after every line, as in test, every error is just terminating condition. In Rust I would just `.unwrap()` or `.expect()`, which would fail the test, report backtrace, etc if anything unexpected went wrong. All the help that I got was just snarky comments for being lazy.<p>I will continue to use Go in some projects, as it gets the job done, performance is OK, has some userbase, and ecosystem is quite vital, but overall, it seems to me that it&#x27;s rooted in same form of stubborn crudeness that has no good reason in XXI century, ignoring years of research and good ideas. For anything more demanding, or fun I would always go with Rust.
评论 #12208584 未加载
评论 #12208284 未加载
评论 #12208325 未加载
评论 #12208607 未加载
评论 #12209091 未加载
评论 #12209027 未加载
EugeneOZalmost 9 years ago
&gt; Contrast this with Rust whose errors read like mind-bindingly inscrutable tax forms.<p>It was &quot;lol what?&quot; for me. Rust&#x27;s compiler error messages are very informative and sometimes contains tips what to change in your code to make it work (not just general words, but code you can use right now, with your variables&#x2F;functions etc.).<p>Borrow checker explains step-by-step where ownership starts, where it ends and where you are trying to use it.<p>Panicking messages - another story, but it&#x27;s not compiler&#x27;s error messages, it&#x27;s runtime. In example of code Adam using as proof, author is using &#x27;panic&#x27; and &#x27;unwrap&#x27; - reasons to don&#x27;t expect gentle behavior.<p>If you can&#x27;t write code in idiomatic way, try to catch your panics and give more descriptive runtime error message in your code - other users of language shouldn&#x27;t pay for it.
评论 #12208656 未加载
评论 #12208711 未加载
_ph_almost 9 years ago
I like Go quite a lot. Mainly I am a Lisp programmer, so I am not looking for the next most high level programming language. I am looking for a language which gets things done, where Lisp doesn&#x27;t quite fit. For jobs, which traditionally would have been done in C. Programs that run fast and have a reasonable complexity. It brings back the virtues of the Wirth computer language family back into modern times, as with strict type checking and the module system. On top of that it adds memory safetey due to the presence of GC.<p>Go it easy to learn, as its a moderately sized language, but it has just enough abstractions, that your programs are not held back by the lack of those, without opening the traps too &quot;powerful&quot; languages bring with themselves, namely complexety.<p>On top of all, the whole infrastructure is very well thought out and a pleasure to use. A very fast compiler which produces static executables, a good module system without header files, a rich standard library, many things. There are quite a few quirks, especially for the beginner, but the more I gain insight, the more I agree with the choices made - with some I don&#x27;t, but the agree to disagree ratio is surprisingly high. And most of them don&#x27;t get into the way of writing good programs, which is what counts.
评论 #12209588 未加载
评论 #12209847 未加载
评论 #12209564 未加载
评论 #12209930 未加载
cesparealmost 9 years ago
GOEXPERIMENT=framepointer will be the default in 1.7, due out in a few days (see <a href="https:&#x2F;&#x2F;golang.org&#x2F;issue&#x2F;15840" rel="nofollow">https:&#x2F;&#x2F;golang.org&#x2F;issue&#x2F;15840</a>), so using tools like perf (and presumably dtrace) will be somewhat improved out of the box.<p>Edit: and the author mentions that at the end of the post. That&#x27;s what I get for commenting before I&#x27;ve read the whole thing.
dcw303almost 9 years ago
I&#x27;m a little confused by the author&#x27;s belief Go needs to be more pragmatic. All the points made in the &quot;I Love Go&quot; section (gofmt, the toolchain, interfaces) display strong qualities of pragmatism to me. The article literally describe interfaces as &#x27;no-nonsense and pragmatic&#x27;. And, even if they do not personally like the opinionated nature, it is a prime example of solving questions in a practical way.<p>No language can be everything to everyone. One thing that encourages me to keep writing Go is the team has done a very good job at communicating their intentions for the language.<p>It&#x27;s very clear to me when to write Go and when not to. That&#x27;s a sign of strength to me, as it shows the language has the confidence to tell you &quot;perhaps I&#x27;m not the best choice for this particular problem&quot;.
评论 #12208188 未加载
fauigerzigerkalmost 9 years ago
My favorite little annoyance with Go is the way the := operator behaves with multiple assignment. It declares a new variable if there is no variable of that name in the current scope. But it refuses to do that if there are struct fields involved.<p><pre><code> var t int t, err := someFunc() &#x2F;&#x2F; that&#x27;s fine </code></pre> but this doesn&#x27;t compile:<p><pre><code> var s struct{ x int } s.x, err := someFunc() &#x2F;&#x2F; doesn&#x27;t compile</code></pre>
评论 #12218543 未加载
crenchalmost 9 years ago
<i>Weak opinions are what turn languages into unreadable mishmashes of overlapping mechanism.</i><p>Go&#x27;s opinions were, for me, especially helpful while learning the language.
fuzzy2almost 9 years ago
I don&#x27;t know, I found debugging with IntelliJ&#x27;s Go plugin intuitive and well-working. Pretty sure it uses Delve under the hood.<p>I think strong opinions are helping Go not being &quot;yet another language&quot;. So that&#x27;s good. Like most things, it isn&#x27;t for everyone.
jokoonalmost 9 years ago
I have great hopes for D since Andrei Alexandrescu joined to work on it.<p>When you see all those new system languages, (go, rust, swift), D was there before them, and did not pretend to be a new cool thing with good ideas, it just tries to be a nicer C++ to work with.<p>I don&#x27;t need to do things the right way, I just need a language that is usable and doesn&#x27;t try to do the job for me.
jefozabussalmost 9 years ago
Cached version in case of 503: <a href="http:&#x2F;&#x2F;webcache.googleusercontent.com&#x2F;search?q=cache:VcehlYQXduwJ:dtrace.org&#x2F;blogs&#x2F;ahl&#x2F;2016&#x2F;08&#x2F;02&#x2F;i-love-go-i-hate-go&#x2F;+&amp;cd=1&amp;hl=en&amp;ct=clnk&amp;gl=de" rel="nofollow">http:&#x2F;&#x2F;webcache.googleusercontent.com&#x2F;search?q=cache:VcehlYQ...</a>
评论 #12208507 未加载
kalekoldalmost 9 years ago
My take on Go: <a href="http:&#x2F;&#x2F;nomad.so&#x2F;2015&#x2F;03&#x2F;why-gos-design-is-a-disservice-to-intelligent-programmers&#x2F;" rel="nofollow">http:&#x2F;&#x2F;nomad.so&#x2F;2015&#x2F;03&#x2F;why-gos-design-is-a-disservice-to-in...</a><p>I still use it but I also have a love, hate relationship with it.
andrewfromxalmost 9 years ago
Here&#x27;s a way to love go, write a language in it <a href="https:&#x2F;&#x2F;github.com&#x2F;grubby&#x2F;grubby" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;grubby&#x2F;grubby</a>
评论 #12208301 未加载
评论 #12208126 未加载
donatjalmost 9 years ago
I think a persons opinion on Go really depends on where you&#x27;re coming from and what tooling they are used to. As a PHP&#x2F;Node&#x2F;Ruby dev I find Go does everything PHP&#x2F;Node&#x2F;Ruby does, faster, and more reliably due to static typing. Often more verbosely though.<p>I&#x27;ve simply never wanted for the things he asks as I&#x27;ve never had them. It&#x27;s all in the expectations is my point.
评论 #12212274 未加载
ahlalmost 9 years ago
FWIW this is the project that pulled me down this golang rabbit hole: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12211754" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12211754</a>
zzzcpanalmost 9 years ago
Those are really small annoyances compared to everything else in Go. I don&#x27;t mind Go being opinionated, everything is like that anyway and it&#x27;s kind of nice in some ways. But don&#x27;t mistake opinionatedness with misdesigned poor quality libraries and experimental ideas.<p>Take net package for example, it&#x27;s not opinionated, it&#x27;s just completely broken and misdesigned. There is so much mess with even the most basic things, like timeouts and cancellations [1][2] that it&#x27;s almost impossible not to fuck up somewhere.<p>This is because the whole net library is synchronous and pushed onto experimental ideas of goroutines and channels. Instead of having an actual event loop underneath with timers, signals and everything and use asynchronous writers and readers they just poll fds and wake goroutines when fds are ready, forcing themselves to deal with typical multithreaded concurrency hell.<p>[1] <a href="https:&#x2F;&#x2F;blog.cloudflare.com&#x2F;the-complete-guide-to-golang-net-http-timeouts&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.cloudflare.com&#x2F;the-complete-guide-to-golang-net...</a> [2] <a href="https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;16100" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;16100</a>
simplehumanalmost 9 years ago
Honest question: How does a post with just 4 points and posted 11 minutes ago get to be on the front page? Even amazing it is number 2 right now.
评论 #12208452 未加载
评论 #12208088 未加载
评论 #12208150 未加载
评论 #12208063 未加载
评论 #12208177 未加载
buberssonalmost 9 years ago
I agree and disagree with the post title.
评论 #12208129 未加载