I have following code
package main
import (
"fmt"
)
var dog struct {
Name string
Age int
Breed string
}
func main() {
dog.Name = "Pongo"
dog.Age = 7
dog.Breed = "Dalmatian"
fmt.Println(dog)
// Reset struct.
dog{} --- Problem point with error
fmt.Println(dog)
dog.Name = "Fluffy"
dog.Breed = "Poodle"
fmt.Println(dog)
}
I am trying to clear out the global struct in Reset. I know I can do it individually. I am looking into golang way of doing like we can do it for struct as follow
type Dog struct {
Name string
Age int
Breed string
}
dog = Dog {}