From the course: Code Clinic: Go

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Working solution and another possible implementation

Working solution and another possible implementation - Go Tutorial

From the course: Code Clinic: Go

Working solution and another possible implementation

- So we've got all of the hard code written, and we have our data structure, and we're getting back our data, and we're going to parse a template. And then we're going to Create a file, and then we're going to execute our template, and write to that new file we created, the data, right, so we'll pass the data into that. And so we'll take the template, which is just this sort of html, into which we're going to embed all of our little curly braces, where the data should go. That'll be our form letter. And then we're going to Create a new file, and we'll call it index.html. And you'll notice the path here, I'm just going to drop it into the same directory where the template is stored. And I'm putting it there because there's certain html code that is referencing things in a directory, kind of, relative way, that needs to be in that folder. So I'm going to put it right there. And then we'll just pass the data in, and execute it. So we've done a lot of the hard coding, now all we have to…

Contents