Join Todd McLeod for an in-depth discussion in this video Parsing and executing template files, part of Code Clinic: Go.
- So here's the next step.…We're going to start using templates.…So we saw, in the previous video, how we can take data…and we can merge that with text.…We did that to stdout…and then we also did it to a file.…Well is there some way that we could take our text…and instead of having our text…be right in our main program,…just one big string of text right here in func main()?…Is there some way we could take that text and…have it in some sort of another file, like a template file?…So that's the idea behind "Let's create a template,"…and it's just going to be standing in its own file.…
It'll be this piece of text right here, this string,…with the fields into which we're going to merge data…and instead of having it in func main(),…it'll just be in a file by itself,…which will be better code organization,…and we'll call that a template.…So we're going to create a template and in Go…you could call the template whatever you want…because when you open up a file…you just say "this is the file, there's the extension,…it doesn't matter what the extension is."…
Todd introduces challenges and then provides overviews of his solutions in Go. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Skill Level Beginner
1. Problem 1—Exploring Lake Pend Oreille
2. Problem 2—Image Analysis
3. Problem 3—Eight Queens
4. Problem 4—Accessing Peripherals
5. Problem 5—Recursion and Directories
6. Problem 6—Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.