Go Series: Learning How to Build a Web Service Using Go from Scratch Pt. 6— Struct & Receiver
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…