Skip to content

Instantly share code, notes, and snippets.

@ara-ta3
Created September 15, 2017 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ara-ta3/7acb72a2d61b7588939e5ad858849e57 to your computer and use it in GitHub Desktop.
Save ara-ta3/7acb72a2d61b7588939e5ad858849e57 to your computer and use it in GitHub Desktop.
package main
import "fmt"
type Hoge struct {
AAA string
}
type Fuga struct {
hs map[string]Hoge
}
func main() {
f1 := Fuga{
hs: map[string]Hoge{
"xxx": {AAA: "yyy"},
},
}
f2 := Fuga{
hs: map[string]Hoge{
"xxx": Hoge{AAA: "yyy"}, // Redundant type Declaration
},
}
fmt.Printf("%+v\n", f1)
fmt.Printf("%+v\n", f2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment