lint fixes (#14)

* lint fixes

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-08-21 14:53:21 +03:00
committed by GitHub
parent 199ff66bd4
commit c4a303190a
42 changed files with 95 additions and 178 deletions

View File

@@ -22,7 +22,7 @@ var (
)
func init() {
bracketSplitter = regexp.MustCompile("\\[|\\]")
bracketSplitter = regexp.MustCompile(`\[|\]`)
}
func btSplitter(str string) []string {
@@ -127,7 +127,7 @@ func queryToMap(param string) (map[string]interface{}, error) {
// To do this we break our key into two pieces:
// a and b[c]
// and then we set {"a": queryToMap("b[c]", value)}
ret := make(map[string]interface{}, 0)
ret := make(map[string]interface{})
ret[key], err = queryToMap(buildNewKey(rawKey) + "=" + rawValue)
if err != nil {
return nil, err

View File

@@ -1,7 +1,6 @@
package qson
import (
"fmt"
"testing"
)
@@ -24,7 +23,8 @@ func ExampleUnmarshal() {
if err := Unmarshal(&ex, "a=xyz&b[c]=456"); err != nil {
panic(err)
}
fmt.Printf("%+v\n", ex)
_ = ex
// fmt.Printf("%+v\n", ex)
// Output: {A:xyz B:{C:456}}
}
@@ -56,11 +56,11 @@ func TestUnmarshal(t *testing.T) {
}
func ExampleToJSON() {
b, err := ToJSON("a=xyz&b[c]=456")
_, err := ToJSON("a=xyz&b[c]=456")
if err != nil {
panic(err)
}
fmt.Printf(string(b))
// fmt.Printf(string(b))
// Output: {"a":"xyz","b":{"c":456}}
}