peterbourgon / how-i-start-go Goto Github PK
View Code? Open in Web Editor NEWHow I Start: Go
Home Page: http://howistart.org/posts/go/1
How I Start: Go
Home Page: http://howistart.org/posts/go/1
Any chance of updating this for Go modules at a minimum?
This is an extremely good introductory tutorial to Go, Peter. IMHO, it has the perfect mix of "how to" for beginners and introducing more essential topics/concepts (like interfaces). The result is making the reader want to know more. Thanks for sharing.
Went thru this tutorial today and enjoyed it!
I especially like how it gave a practical example for using goroutines & channels.
Only problem I noticed is that near the end of the tutorial here: http://howistart.org/posts/go/1
your code won't compile because you use the "time" and "log" variables without ever specifying the import statements for either one. This isn't necessarily the worst thing in the world, since it gets people to think more carefully about what they're doing (kinda like my college professors LOVED to do). But just in case you weren't aware, I thought I'd post here.
That'd help for responsive view!
This function won't work anymore as is without API key:
func (w openWeatherMap) temperature(city string) (float64, error) {
resp, err := http.Get("http://api.openweathermap.org/data/2.5/weather?q=" + city)
if err != nil {
return 0, err
}
Hey @peterbourgon
Thanks for the excellent article. ❤️
It taught me a lot about developing clean handlers in Go.
In general, I had a conceptual question regarding the handling erroneous goroutines i.e. goroutines returning an error.
Suppose I have 10 different weatherProviders
and I use concurrency to fetch the temperature from all of them using 10 goroutines. Now, if the fastest of these providers return an error
, the multiWeatherProvider
returns according to the current implementation.
However, all the other 9 goroutines are still running in background, right?
Might be worth updating your post which is very good to note:
An example of how to call it now: https://github.com/karlhungus/dweeb/blob/0f1f795e9c301a89916e5a6d25d5e375de1aefdf/weather.go#L47
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.