aim to balance between practical knowledge by doing side-projects, viewing/contributing to open-source projects and theoretical knowledge by learning algorithms and computation and complexity theories
Nice. One more thing is that are you sure you want to execute the template when the error is not equal to nil? Shouldn't you move that outside the condition and replace it with a error log
That way you'll only try to execute the template if your html file correctly loaded
aim to balance between practical knowledge by doing side-projects, viewing/contributing to open-source projects and theoretical knowledge by learning algorithms and computation and complexity theories
the first version was right I reverted the changes, If your question is how you're not going to handle the exception if there's an error, well It depends, if you're using this in a production environment or a user is going to interact with application you must add an else statement which shows to the user an error happened or output a user friendly message or you will provide a bad user experience for the user, but since the tutorial focused on Golang Templating I didn't bother trying to deal with exceptions, but of-course it would be more convenient to add something like this in case you're dealing with a user
for example you can add log.fatal(err) also this won't be user friendly it will be for you as a developer to know what is the error.
Hope this answers your question
Thank you, I fixed them
Nice. One more thing is that are you sure you want to execute the template when the error is not equal to nil? Shouldn't you move that outside the condition and replace it with a error log
That way you'll only try to execute the template if your html file correctly loaded
the first version was right I reverted the changes, If your question is how you're not going to handle the exception if there's an error, well It depends, if you're using this in a production environment or a user is going to interact with application you must add an else statement which shows to the user an error happened or output a user friendly message or you will provide a bad user experience for the user, but since the tutorial focused on Golang Templating I didn't bother trying to deal with exceptions, but of-course it would be more convenient to add something like this in case you're dealing with a user
for example you can add log.fatal(err) also this won't be user friendly it will be for you as a developer to know what is the error.
Hope this answers your question
You must have changed the code because I was referring to when you had:
if (err != nil) {
t.Execute(...)
}
I can see you have fixed this now.