Go Series: Learning How to Build a Web Service Using Go from Scratch Pt. 6— Struct & Receiver

Jonathan Chao
2 min readMay 11, 2023

Struct is like an object where you define the attributes inside. The typical example to go for is a car object. In Go, we can define it like this:

type Car struct {
Wheels int
Model string
Brand string
Color string
}

func main() {
// we can initialize our variable "ford" by giving attributes
ford…

--

--

Jonathan Chao

I am a software developer who has been in this industry for close to a decade. I share my experience to people who are or want to get into the industry