News for hackers. Stuff that matters.
Re:Best practices for a new Go developer by peteretep on Wednesday September 02, 2015 @04:58AM (#10158115)

    > You will realize eventually that what you first thought
    > was worth criticizing was actually a deep work of
    > genius.
Funny, I found the more I used it the less I liked it.

    > I’ve seen a lot of criticism of Go’s “shortcomings”
    > from people who are true experts in many languages
    > other than Go.
Cool, normally I just call those people "experts".

    > I can’t recall similar criticism from someone who’s
    > worked with Go at a very deep level for a year or two.
You would do well to understand the meaning of the term "survivorship bias".
Re:Best practices for a new Go developer by SomeCollegeBro on Wednesday September 02, 2015 @08:40AM (#10158768)
I completely agree - the more I used it the less I liked it. I really enjoyed its implicit simplicity at first. The code I wrote had purpose and was clear, consice, and easy to understand. However, as the codebase grew larger I really ran into the issues more people talk about. Specifically lack of generics. I was using reflection to simulate this, however my performance was terrible on large sets of data. I had to end up relying on a code generator, which seems to be the direction Go is heading.

Edit: Package versioning was another pain point, as someone mentioned below. Their built in package manager is almost too simple. As with anything simple, it's great at first but not so great when more complexities arise.

Re:Best practices for a new Go developer by bkeroack on Wednesday September 02, 2015 @12:42PM (#10160457)
If you are using reflection, unsafe or even interface{} heavily, you almost certainly are not writing idiomatic Go. This will doom you to frustration and a poor experience overall.
Re:Best practices for a new Go developer by pzduniak on Wednesday September 02, 2015 @11:10AM (#10159737)
The package versioning issue has been solved in 1.5 for most of the popular use cases with the vendor experiment. Works just fine for me!
Re:Best practices for a new Go developer by drakenot on Wednesday September 02, 2015 @02:35PM (#10161153)
I hadn't heard about the vendor experiment. Is it now possible to point at individual tags/branches of a remote repository?
Re:Best practices for a new Go developer by lobster_johnson on Wednesday September 02, 2015 @03:24PM (#10161397)
The new "vendor" system is basically that the Go compiler will look in vendor/ for your import before trying to traverse the GOPATH. This means you can manually download and freeze dependencies there. However, Go leaves the management of this vendor directory to you or some hypothetical helper tool — or with git submodules, for that matter. "go get", for example, still works just like before (ie., stores stuff in $GOPATH/src).
Re:Best practices for a new Go developer by sepeth on Wednesday September 02, 2015 @07:57AM (#10158593)
Not directly related, but there's one tweet I like:

"No no no no. The voice of newbies is one of your biggest assets. Why don't they understand? What is the confusion?" John Resig

https://twitter.com/jeresig/status/584030561313943552

Re:Best practices for a new Go developer by fauigerzigerk on Wednesday September 02, 2015 @07:10AM (#10158441)
The thing about Go is that some parts, like channels and goroutines (also some of the library designs and tooling), are so addictive that pretty soon it gets hard to imagine ever having to live without them.

But I don't think everyone using Go really believes or supports this "but in practice it's not a problem and if it's a problem then the problem is YOU!" kind of response to every criticism.

We live in a world of trade-offs. It's disingenuous to act like that wasn't the case.

Re:Best practices for a new Go developer by danieldk on Wednesday September 02, 2015 @10:36AM (#10159458)
The thing about Go is that some parts, like channels and goroutines

I have written a fair share of Go now and have only rarely used channels or goroutines. In practice, channels are only a good model for a subset of concurrency scenarios and they come with problems.

Also, those criticizing Go are right (of course). No amount of Go usage will alleviate its shortcomings. The lack of parametric polymorphism is incredibly annoying, error handling is mediocre (Rust handles this much better), and the lack of support for even simple abstractions (algebraic data types) is jarring.

Nonetheless, I continue to use Go, because they also got a lot of things right: compile times, tooling, a very-well documented standard library, good compatibility between 1.x releases, a UNIX feel, low-barrier entry for other contributors to Go projects, and a thriving ecosystem for a relatively young language. (Of course, the JVM and Java do as well on these points, except for UNIX-feel.)

Re:Best practices for a new Go developer by fauigerzigerk on Wednesday September 02, 2015 @11:47AM (#10160012)
Where goroutines have helped me a lot is with networking code. The part of the system I'm writing in Go controls several instances of three different kinds of networked services, plus one command line tool.

There are hundereds of tasks that request access to these services. The job of my Go code is to schedule, rate limit and coordinate access by these tasks to the network services.

I did parts of it in C++ initially (because other parts of the system are written in C++) using queues and timers (could have done the same in Java) and then I rewrote it in node.js but wasn't happy with the asychronous design or with my productivity.

So I think the reason why goroutines and channels have helped me so much is specific to this kind of project. Go's other language features (or lack thereof) wouldn't have enticed me into taking a closer look. But now that I have taken a closer look, I do like the library and tools a lot as well.

To sum it up, if a program is basically a ton of loops doing blocking reads and writes that depend on each other, then goroutines and channels make the code look very similar to the idea. Mental load drops. Life is easier.

Re:Best practices for a new Go developer by mda on Wednesday September 02, 2015 @08:35AM (#10158739)
"like channels and goroutines"

Channels and goroutines advertised as the poster child of Go language features for simplifying concurrency since the beginning. When I tried to use them I was surprised how difficult actually it is to use them correctly, so many subtleties to deal with.

Yes they are addictive, but I suspect beginners really are not using them correctly.

Re:Best practices for a new Go developer by fauigerzigerk on Wednesday September 02, 2015 @08:56AM (#10158845)
Beginners don't remain beginners forever. My yardstick for whether or not I like a particular approach is looking at old code that I have written months ago. The more quickly I can get back into it without fear of breaking things, the better the design is.

By that admittedly subjective standard, goroutines and channels have been a big success (compared to asynchronous code).

Re:Best practices for a new Go developer by danieldk on Wednesday September 02, 2015 @10:39AM (#10159484)
By that admittedly subjective standard, goroutines and channels have been a big success (compared to asynchronous code).

Well, your barrier is also very low :). Try e.g. Erlang's actor model.

Re:Best practices for a new Go developer by fauigerzigerk on Wednesday September 02, 2015 @12:00PM (#10160124)
What puts me off Erlang is its dynamic typing and lack of speed for algorithmic code. I'm just not smart enough for dynamically typed languages it seems (even though I do like some of them -- Python).
Re:Best practices for a new Go developer by fweespeech on Wednesday September 02, 2015 @09:38AM (#10159026)
> The thing about Go is that some parts, like channels and goroutines (also some of the library designs and tooling), are so addictive that pretty soon it gets hard to imagine ever having to live without them.

Honestly, I'm fine with actors.

Go is a good language but its for, frankly, good for a very narrow set of applications [cli; microservices]. Outside of those two applications, I find myself never wanting to use Go, honestly.

Re:Best practices for a new Go developer by Kiro on Wednesday September 02, 2015 @05:24AM (#10158182)
What's with the condescending tone?
Re:Best practices for a new Go developer by jasode on Wednesday September 02, 2015 @05:34AM (#10158209)
Can't speak for peteretep but here's my guess...

If you look at the quotes peteretep pasted, those "I-have-wisdom-that-you-don't" type of remarks can be interpreted as condescension. Therefore, it's human nature to respond to condescension with more condescension.

To be clear, the blog author (Satish Talim) didn't write those quotes -- he's quoting Baron Schwartz.

Re:Best practices for a new Go developer by colin_jack on Wednesday September 02, 2015 @06:52AM (#10158395)
The quote he was commenting on had a very condescending tone too:

" Do not complain about something you think is missing, wrong, or stupid. You are ignorant and new to the language, no matter how much of an expert you are on programming in general."

Re:Best practices for a new Go developer by wiremine on Wednesday September 02, 2015 @07:31AM (#10158507)
I actually think it's pretty good advice. If you haven't used a language [1] before, park the opinion and get to work learning it.

[1] or database or framework or whatever...

Re:Best practices for a new Go developer by smosher_ on Wednesday September 02, 2015 @10:38AM (#10159475)
I think it's a canary. How many languages do you hear this said about? I've only heard it in regards to Go which is fairly pedestrian (read: looks and acts something like C / Java) as far as these things go.

More exotic languages, which take the uninitiated longer to acclimate to, don't seem to be trying to tell people they're not allowed to think deeper about and question the design of the language. Good criticisms of Go were made on day 1 and are being made to this day, Rob Pike's ego notwithstanding.

At the end of the day, if I see a problem with a developing language I am interested in, I'm going to report it. If I'm met with: "I don't know you but I'll assume you don't know what you're talking about" that's a second problem and I'm not about to double-down on it.

Re:Best practices for a new Go developer by jerf on Wednesday September 02, 2015 @11:44AM (#10159990)
"I think it's a canary. How many languages do you hear this said about?"

In general, I see "This new language I'm learning sucks because it needs to work more like the language I know best" for all kinds of languages. "Python needs to use braces instead of indentation." "$X needs to handle errors more like $Y." (lots of things can be filled in there!) Complaints about the dynamic/optional/static typing in a language. "Haskell may be pretty but isolating IO effects like that is impractical, it ought to work more like most languages."

No, it's not even remotely isolated to Go.

Re:Best practices for a new Go developer by smosher_ on Wednesday September 02, 2015 @12:16PM (#10160245)
FYI the quote above refers to the develeoper/community response to criticisms/ideas (eg. see the comment I replied to), not the criticisms/ideas offered by newcomers.
Re:Best practices for a new Go developer by colin_jack on Wednesday September 02, 2015 @10:53AM (#10159615)
Is that really a general problem in the Go community?

I ask because I've seen people explaining the tradeoffs Go makes pretty clearly online without any rudeness or condescending attitude.

Re:Best practices for a new Go developer by smosher_ on Wednesday September 02, 2015 @11:17AM (#10159780)
I don't know what it's like now. Rob Pike in particular made a lot of noise like this early on. There was a lot of parrotting of that, so it was hard to have a serious conversation. It seems like it's still getting play but I don't know how widespread that is today.
Re:Best practices for a new Go developer by colin_jack on Wednesday September 02, 2015 @08:27AM (#10158698)
Yeah I agree, but to my mind its good advice delivered in a very condescending style.
Re:Best practices for a new Go developer by OJFord on Wednesday September 02, 2015 @11:11AM (#10159739)
I don't think it's intended. I gather you refer to 'ignorant'(?) but it's innocent enough in meaning.