Join Miki Tebeka for an in-depth discussion in this video Solution: Channels, part of Go Essential Training.
- [Instructor] Let's have a look.…We have a function which is a returnType.…It gets a URL, and now it gets an additional parameter,…it's the output channel which is going to send the result.…We do a get, and if there is an error,…we just send an error to the channel,…otherwise we do the content-type…and we send the result to the channel.…In the main, we have the list of URLs…and we create the channel, which is the result channel.…
And every time we call go with returnType,…which we give it the URL and the channel…to send the result on.…Line 34, since we know the number of go routines,…which is how many URLs we want to look,…we can do for range urls,…and then we get the result from the result channel…and we print it out.…Let's save it and run.…Go run sites.go.…
And we get one from every site.…
- Go basic types, conditionals, and loops
- Go functions
- Object-oriented programming with Go
- Error handling
- Concurrent programming with channels
- Testing and project management
- Networking with JSON and HTTP
Skill Level Beginner
Programming Foundations: Fuzzy Logicwith Erin Colvin41m 50s Intermediate
Getting started1m 34s
1. Getting Started
2. Go Basics
5. Error Handling
7. Project Management
Next steps1m 12s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.