diff --git a/go.mod b/go.mod index 1053de0..86e3da2 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-querystring +module github.com/nk915/go-querystring go 1.10 diff --git a/query/encode.go b/query/encode.go index 9f2a8ec..bec7c55 100644 --- a/query/encode.go +++ b/query/encode.go @@ -244,6 +244,8 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error { k := name if opts.Contains("numbered") { k = fmt.Sprintf("%s%d", name, i) + } else if opts.Contains("spotnumbered") { + k = fmt.Sprintf("%s.%d", name, i+1) } values.Add(k, valueString(sv.Index(i), opts, sf)) } diff --git a/query/encode_test.go b/query/encode_test.go index a94b44d..f9dae33 100644 --- a/query/encode_test.go +++ b/query/encode_test.go @@ -237,7 +237,12 @@ func TestValues_Slices(t *testing.T) { }{[2]string{"a", "b"}}, url.Values{"V0": {"a"}, "V1": {"b"}}, }, - + { + struct { + V [2]string `url:",spotnumbered"` + }{[2]string{"a", "b"}}, + url.Values{"V.1": {"a"}, "V.2": {"b"}}, + }, // custom delimiters { struct {