by curioussavage · 2y ago · 0 comments
Even if there is some data I want to keep in memory there is no need for a global usually. In go I may just keep it in a var in a goroutine that doesn’t exit until the process does.
type Engine struct {
HorsePower int
}
func (e Engine) Start() {
fmt.Println("Engine is starting with", e.HorsePower, "horsepower.")
}