Live data from Hacker News

Learn Go in five minutes

gist.github.com

121–130 of 137 posts

Re: Learn Go in five minutes

#121
post #93

No offense to the author here ... but I need to vent some personal frustration. Every tutorial goes through these exact same motions for learning a new language. It sucks! Programmers can figure out what a variable is, or how to use an array or a map. Those things really don't change a whole lot between languages. What about how to import code from different modules? Best practices for organizing code? How your langu…

99% of the “learn programming language” literature is written by people who likely couldn’t do your job because they haven’t ever been programming. This is why languages need good documentation. It seems like it’s a booming industry though. I mean, there are entire sites like udemy where amateurs teach amateurs things they’ll never use in a real job, and that place, and others like it, seems to be doing just fine. He…

Packt books are woefully bad. What’s their business model? Print on demand?

Re: Learn Go in five minutes

#122
Most comments here don't seem to see the context. It's done as companion or reply to the highly celebrated post "A half-hour to learn Rust", which was posted several times at HN and many people got overly excited how easy Rust is.

The takeaway is: The HN community is highly biased. So if you're looking for advice regarding technology choice, take it with a large grain of salt.

Re: Learn Go in five minutes

#123

Earlier quoted context omitted.

It probably doesn't work to convince you, still I see that differently ;) About generics, it depends on the problem at hand. When writing a generic Matrix multiplication type that for instance should work both on real and complex numbers (or more obscure types) generics are a thing. On the other hand, when working for instance with golang.org/x/net/html, I really appreciate the interface definitions and the possibili…

I'm aware of stack traces on panics, but my understanding is you only get them if you let them bubble up and kill the application (so not really a "first class" option for errors in places like web handlers) Has that changed, or did I misunderstand? But I also think the stack trace message example is the perfect example of what I mean by "take the Go mentality with you" In a language like Kotlin for example, Go got m…

You can get the full stack of the crash point (and a few extra frames that handles the stack generation) in a deferred recover, ie https://play.golang.org/p/XvZteY6Y6fh

github.com/pkg/errors is a simple way to dump expensive stacktraces into each new/wrapped error. Or you can just panic and recover in your own app, it's possible though discouraged.

Re: Learn Go in five minutes

#124
post #102

Earlier quoted context omitted.

And that's saying something give that neither Node nor TypeScript have ever had productivity as a main selling point! Imagine evaluating the time to market for an experimental back-end written in Rails, Laravel, Phoenix, etc vs Go! The difference is staggering.

>Rails, Laravel, Phoenix, etc vs Go! Comparing frameworks and a language, really?

Absolutely! There are obvious productivity differences between the languages themselves and frameworks can make it even more apparent.

Different languages make writing the DSLs used in Rails-like frameworks easy, difficult or impossible. Much of my professional career was spent working on Node back-ends with a variety of frameworks and none of them were even close in terms of succinctness or productivity.

Re: Learn Go in five minutes

#125
post #101

Earlier quoted context omitted.

>What I would really like is an up to date "learn how to handle Go project in 30 minutes" 1. git init 2. git remote add %something% 3. go mod init %name_of_your_module% (where in most common case name is your repo address without the https part) 4. https://github.com/golang-standards/project-layout - this repo has the default project structure. Each subfolder has README that describes the purpose of the folder 5. go…

Damn. > https://github.com/golang-standards/project-layout I was almost with you but please don't share that repo. It's a terrible layout and the docs aren't accurate. The issues are full of Go community folk saying it's misleading and looks official but isn't.

It is not official and does not say otherwise (neither do I).

We are using similar layout (albeit we just need cmd and internal directories for most of our project) and it works perfectly.

Anyway - this is not Rails or any other framework were the developer may be dependent on project structure. I just shared a possible option.

>It's a terrible

Why though?

PS: I just realized it has golang-standards in its path. Okay, this part can actually be misleading.

Re: Learn Go in five minutes

#126

Earlier quoted context omitted.

Damn. > https://github.com/golang-standards/project-layout I was almost with you but please don't share that repo. It's a terrible layout and the docs aren't accurate. The issues are full of Go community folk saying it's misleading and looks official but isn't.

I have had this issue with my current golang projects. I haven't found any clear standard for project layout. We have a bunch of microservices with grpc api endpoints, and some which are event driven. Has anyone found a better resource? As it is, even our internal projects are fairly inconsistent in their project structure, which is a bit annoying.

There is no such thing as a standard here.

In our team we have most projects structured like this:

/project-folder

|

|__/build (/.gitlab-ci for projects moved to our own gitlab instance)

|

|__/cmd (folder for your entrypoints. One or more if your projects generates more than 1 binary)

   |__/bin_name1

   |__/bin_name2
|

|__/internal (folder for your sources packages)

   |__/config (package config)

   |__/http (package HTTPServer, api, etc)

      |__/api

      |__/models

   |__/database (package database)

   |__...
|

|__/api (swagger and such)

|

|__/docs (godoc)

|

|__/.golangci.yml

|

|__...

Something like this.

Re: Learn Go in five minutes

#127

No offense to the author here ... but I need to vent some personal frustration. Every tutorial goes through these exact same motions for learning a new language. It sucks! Programmers can figure out what a variable is, or how to use an array or a map. Those things really don't change a whole lot between languages. What about how to import code from different modules? Best practices for organizing code? How your langu…

It would be nice to have a collection of resources for each language for whatever you have mentioned above. It'd be very helpful to just deep dive and learn any language than focusing on declaring variables and for loops.

Re: Learn Go in five minutes

#128

No offense to the author here ... but I need to vent some personal frustration. Every tutorial goes through these exact same motions for learning a new language. It sucks! Programmers can figure out what a variable is, or how to use an array or a map. Those things really don't change a whole lot between languages. What about how to import code from different modules? Best practices for organizing code? How your langu…

It would be nice to have a collection of resources for each language for whatever you have mentioned above. It'd be very helpful to just deep dive and learn any language than focusing on declaring variables and for loops.

A hacker wiki of sorts. It’s a great idea.

Re: Learn Go in five minutes

#129

No offense to the author here ... but I need to vent some personal frustration. Every tutorial goes through these exact same motions for learning a new language. It sucks! Programmers can figure out what a variable is, or how to use an array or a map. Those things really don't change a whole lot between languages. What about how to import code from different modules? Best practices for organizing code? How your langu…

Would you be up for venting that frustration in to a git repo and setting the tone by making public exactly that type of thing for the languages you do know?

Asking for a friend

Re: Learn Go in five minutes

#130

No offense to the author here ... but I need to vent some personal frustration. Every tutorial goes through these exact same motions for learning a new language. It sucks! Programmers can figure out what a variable is, or how to use an array or a map. Those things really don't change a whole lot between languages. What about how to import code from different modules? Best practices for organizing code? How your langu…

Would you be up for venting that frustration in to a git repo and setting the tone by making public exactly that type of thing for the languages you do know? Asking for a friend

You have presented an interesting challenge. I am going to chew on this and see what can be done. Good question.
Post reply on HN