HTML templates - Go Lang Practical Programming Tutorial p.16

preview_player
Показать описание
Welcome to part 16 of the Go Language tutorial series, in this tutorial we will be covering HTML templates with Go. While we can do everything in your .go file, this can become...challenging, especially for larger projects with more complex HTML, styling, as well as the incorporation of JavaScript. With Go, we can use templating and some basic logic from within our HTML files, which will be parsed by Go's html/template package

Рекомендации по теме
Комментарии
Автор

'Don't you just love Go'. Loved the bonus content. Excellent series. Please keep making more videos on Go.

orijit
Автор

"Tutorial is over. Nothing to see here. Just doing what I normally do in a given day."

writingpanda
Автор

Debugging is the most important part of programming!

FlamyWai
Автор

"don't you just love go" made me laugh so much XD

bhavyakaushal
Автор

Loved the bonus. I am glad I can log out errors like that.

michaeltorres
Автор

Error won't occur after 'ParseFiles' in part because you're just reading in the HTML file.

In your example, the data is not applied to the template until you 'Execute' the template and send it to the response writer.

Thanks for the video. Think people have overlooked Go's great built-in system for too long.

bryandavis
Автор

Why use backticks (`) in struct tags?
If you’re wondering why backticks (`) are used to wrap around the struct tag, remember
that strings in Go are created using the double quotes (") and backticks (`). Single
quotes (') are used for runes (an int32 that represents a Unicode code point) only.
You’re already using double quotes inside the struct tag, so if you don’t want to escape
those quotes, you’ll have to use something else—hence the backticks.

taufiqrahman
Автор

Hey Sentdex, just wanted to say that i'm seeing all your golang videos. Thanks for making this material, it helped me a lot this weekend.

x_venture
Автор

the docs state that single quotes are reserved just for bytes and runes.

elderofzion
Автор

Just a guess, but single quotes have traditionally been used to designate a single character... at least that's how it is in C++. Double quotes are for strings, which are technically arrays of characters.

KarlHepler
Автор

Why don’t you use go linter ? So you don’t have to interrupt the video fir small errors

Ryu
Автор

For generating html/static stuff in golang, Hugo is awesome!

SoumitraChakravarti
Автор

How can i get the Handeler to accept input parameters from other functions?

jasonlee
Автор

I am newbie in Go, searching for an example for 'View Engines' in 'Go', template is another name for view engines?, So this can be considered as a simple view engine example ? (

kumarcok
Автор

I encountered a problem I’m sure I copied everything but then it says on the cmd it says .\gotut.go:25:26 undefined: indexHandler could anyone help?

miami
Автор

Love your videos, you are really charismatic. Thanks for the time you take to do this!

Triviorito
Автор

Golang's HTML templates are a lot like jinja2 that is used by Flask. I imagine that is a primary source of the syntax.

admercs
Автор

HI! I ran into this error when I execute the template: runtime error: invalid memory address or nil pointer dereference. My guess is Go can't find the file. I put the HTML file in the same folder as all the other go files. Why it can't find it?

zhuqingcheng
Автор

This is why you build the frontend separately, like reactJS, no more fiddling around html in go

teamerx
Автор

Also, to catch errors during variable initialization, check out template.Must().

admercs
welcome to shbcf.ru