Live data from Hacker News

How I Start: Go

howistart.org

11–20 of 36 posts

Re: How I Start: Go

#11
post #5

If you'd prefer to play with golang on linux, I've got quick a Vagrantfile ready to go at https://github.com/adlawson/vagrantfiles curl -O https://raw.githubusercontent.com/adlawson/vagrantfiles/master/go/Vagrantfile vagrant up ...

Why do you assume we're all using a Mac?

Re: How I Start: Go

#12
(with "you" being the author or anyone):

Would you be able to explain why you iterate over the range of providers instead of iterating over the channel in your concurrency example?

Re: How I Start: Go

#13
post #11
post #5

If you'd prefer to play with golang on linux, I've got quick a Vagrantfile ready to go at https://github.com/adlawson/vagrantfiles curl -O https://raw.githubusercontent.com/adlawson/vagrantfiles/master/go/Vagrantfile vagrant up ...

Why do you assume we're all using a Mac?

No assumption, just offering another way to install.

Maybe just chill your beans and enjoy Peter's writeup.

Re: How I Start: Go

#14
It's actually annoying Go is shown as a web language in many tutorials. It's simply not. If you use Go for systems programming and other stuff like creating daemons, services, you will fall in love with it more and will not go back to any other language. That's why I believe those Go start tutorials should not be showing the net/http side of things.

Re: How I Start: Go

#15
post #5

If you'd prefer to play with golang on linux, I've got quick a Vagrantfile ready to go at https://github.com/adlawson/vagrantfiles curl -O https://raw.githubusercontent.com/adlawson/vagrantfiles/master/go/Vagrantfile vagrant up ...

Why do it in a Vagrant? If you download the go tarball from golang.org, it will work just fine with no dependencies on any desktop linux. You can have multiple versions, and switch between them by changing your GOROOT.

Plus, it'll be faster.

Re: How I Start: Go

#16
post #12

(with "you" being the author or anyone): Would you be able to explain why you iterate over the range of providers instead of iterating over the channel in your concurrency example?

Range over a channel only terminates when the channel is closed, which that example doesn't do.

Since the channel is created as buffered, you could do a normal for-loop over cap(chan), which would be the same as len(providers).

Re: How I Start: Go

#17
post #14

It's actually annoying Go is shown as a web language in many tutorials. It's simply not. If you use Go for systems programming and other stuff like creating daemons, services, you will fall in love with it more and will not go back to any other language. That's why I believe those Go start tutorials should not be showing the net/http side of things.

Go definitely shines as a server language, so I think some kind of server is indeed the best way to illustrate Go's capabilities. It's true that net/http is kind of... boring, and maybe not the best choice for a beginner tutorial due to some of its quirks, but it has the benefit of being a well-understood reference point.

Re: How I Start: Go

#18
post #9

Don't use println(), use fmt.Println() or other equivalent functions instead. Current implementations provide several built-in functions useful during bootstrapping. These functions are documented for completeness but are not guaranteed to stay in the language. http://golang.org/ref/spec#Bootstrapping And for beginners, it could be interesting to know that decoders also support simple maps in addition to tagged struc…

    > Don't use println()
println() is nice because it doesn't require an import. For "the smallest possible program" I think it's a good match.

    > decoders also support simple maps in addition to tagged 
    > structs
I think it's a mistake to teach Go programmers to decode into map[string]interface{}. It's pretty rare that you actually want to do that.

Re: How I Start: Go

#19
Nice post there. Easy to understand and it gives us a solid entry point.

I've been building my own backend for a couple of weeks (yes, very slowly) and I'm still wondering how to write proper test. Unit testing is a charm and there is nothing complex there, but mocking my dao package for example is a little harder.

I'd like to see how you write beautiful unit tests (w/ or w/o mock) in Go.

Re: How I Start: Go

#20

I like the idea of this series, because I think it's more useful than Hello World type examples. There's an implicit trust that whoever is writing the article knows what they're doing, which could be a problem for someone new to a community. I skimmed over the Ruby one (I know Ruby better than Go), and it seemed pretty solid, and was written by a Rails core contributor, so it should be. Hopefully they'll get more of…

Hi! I wrote the Ruby one. As far as I know, it's super solid, let me know if something is weird. :)

I'm going to do a Rust one around the 1.0 timeline too, hopefully.

Post reply on HN