{"action":"opened","issue":{"url":"https://api.github.com/repos/go-playground/form/issues/1","repository_url":"https://api.github.com/repos/go-playground/form","labels_url":"https://api.github.com/repos/go-playground/form/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/go-playground/form/issues/1/comments","events_url":"https://api.github.com/repos/go-playground/form/issues/1/events","html_url":"https://github.com/go-playground/form/issues/1","id":160080644,"number":1,"title":"Odd decoding behavior","user":{"login":"falun","id":635538,"avatar_url":"https://avatars.githubusercontent.com/u/635538?v=3","gravatar_id":"","url":"https://api.github.com/users/falun","html_url":"https://github.com/falun","followers_url":"https://api.github.com/users/falun/followers","following_url":"https://api.github.com/users/falun/following{/other_user}","gists_url":"https://api.github.com/users/falun/gists{/gist_id}","starred_url":"https://api.github.com/users/falun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/falun/subscriptions","organizations_url":"https://api.github.com/users/falun/orgs","repos_url":"https://api.github.com/users/falun/repos","events_url":"https://api.github.com/users/falun/events{/privacy}","received_events_url":"https://api.github.com/users/falun/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-14T01:47:46Z","updated_at":"2016-06-14T01:47:46Z","closed_at":null,"body":"Hi there!\r\n\r\nFirst off thanks for this -- it solves a problem I was about to have with `gorilla/schema` (lack of keyed map support) but I hit a different problem with `form`.\r\n\r\nI've attached what I'm pretty sure this is an error case but I could be using it incorrectly, would appreciate some guidance.  The tl;dr is that when you have a slice of a struct there seems to be a different decoding behavior for populating a struct than if you're reading directly into one. Here's a repro case:\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\r\n\t\"github.com/go-playground/form\"\r\n)\r\n\r\ntype Struct1 struct {\r\n\tFoo string\r\n}\r\n\r\ntype Struct1Wrapper struct {\r\n\tInnerSlice []Struct1\r\n}\r\n\r\ntype Struct2 struct {\r\n\tFoo string\r\n\tBar string\r\n}\r\n\r\ntype Struct2Wrapper struct {\r\n\tInnerSlice []Struct2\r\n}\r\n\r\nfunc main() {\r\n\tsliceValues := map[string][]string{\r\n\t\t\"InnerSlice[0].Foo\": {\"foo-is-set\"},\r\n\t}\r\n\r\n\tsingleValues := map[string][]string{\r\n\t\t\"Foo\": {\"foo-is-set\"},\r\n\t}\r\n\r\n\tfd := form.NewDecoder();\r\n\r\n\tdst := Struct2Wrapper{}\r\n\terr := fd.Decode(&dst, sliceValues)\r\n\tfmt.Println(err)\r\n\tfmt.Printf(\"%#v\\n\", dst)\r\n\r\n\tdst2 := Struct2{}\r\n\terr = fd.Decode(&dst2, singleValues)\r\n\tfmt.Println(err)\r\n\tfmt.Printf(\"%#v\\n\", dst2)\r\n\r\n\tfmt.Println()\r\n\tfmt.Println()\r\n\tfmt.Println()\r\n\r\n\tdst3 := Struct1Wrapper{}\r\n\terr = fd.Decode(&dst3, sliceValues)\r\n\tfmt.Println(err)\r\n\tfmt.Printf(\"%#v\\n\", dst3)\r\n\r\n\tdst4 := Struct1{}\r\n\terr = fd.Decode(&dst4, singleValues)\r\n\tfmt.Println(err)\r\n\tfmt.Printf(\"%#v\\n\", dst4)\r\n}\r\n```\r\n\r\nAnd the output, when run:\r\n\r\n```\r\n$ go install test && ./test\r\n<nil>\r\nmain.Struct2Wrapper{InnerSlice:[]main.Struct2(nil)}\r\n<nil>\r\nmain.Struct2{Foo:\"foo-is-set\", Bar:\"\"}\r\n\r\n\r\n\r\n<nil>\r\nmain.Struct1Wrapper{InnerSlice:[]main.Struct1{main.Struct1{Foo:\"foo-is-set\"}}}\r\n<nil>\r\nmain.Struct1{Foo:\"foo-is-set\"}\r\n```\r\n\r\nI could also be doing something goofy in my test code. _Shrug_, 😄 \r\n\r\nMight try to take a look at this myself but I assume it'll be a much faster debug & fix from someone who already knows the codebase."}}
{"actor":{"display_login":"falun"}}