Category Archives: web

Go’s interfaces

One of the key aspects of Go are interfaces, this article covers what an interface is, how to implement them and why they are used.

To start with, Go has struct’s, you could look at these as classes in an OO language, but they aren’t. They are Structures that hold data, be it another structure or some other native type such as a string or []byte.

Any logic in a go program is contain within a function (func), thus to enable you to pass different types to these functions they need’s to be a means to associate the different types, this is where interfaces come in. Continue reading

Posted in example, Go, interfaces, web | 4 Comments

Go Templates, {.repeated} & Arrays/Slices

This article looks at how to use Go Templates with Arrays or Slices & {.repeated section field } notation.  It assumes that you have an understanding of using {.section field} in Go templates and {field} in Go Templates.

Posted in example, Go, golang, html, templates, web | 4 Comments

Adding logic to Go Templates

This article assumes you know how to create a struct and use Go’s *Template.Execute() with a html template and a struct to create merged content. In the previous article I demonstrated a very simple example, in this article I’ll show … Continue reading

Posted in example, Go, html, templates, web | Leave a comment

Use Go’s HTML Templates

This article assumes you know how to create a simple http server to respond to different requests.  If you don’t know it only take 5 mins, check out how to setup a basic Http Server on go before continuing. Regardless … Continue reading

Posted in example, Go, golang, html, templates, web | 5 Comments

GO & web.go

Thus far I’ve only talked about using Go’s built-in http packages directly.  And while it’s very extensive you have to implement many of the standard features yourself, Such as Session State and cookies.  While these features are relatively simple you don’t want to “re-design the … Continue reading

Posted in Go, html, web | Leave a comment