From 46603152a1ed44344e84527683193e34e2868e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Matczuk?= Date: Thu, 21 Sep 2017 21:14:28 +0200 Subject: [PATCH] error: %s replaced with %q in missing field errors --- integration_test.go | 4 ++-- iterx.go | 2 +- queryx.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/integration_test.go b/integration_test.go index 002c18a..138d38a 100644 --- a/integration_test.go +++ b/integration_test.go @@ -231,7 +231,7 @@ func TestUnsafe(t *testing.T) { t.Run("safe get", func(t *testing.T) { var v UnsafeTable i := gocqlx.Iter(session.Query(`SELECT * FROM unsafe_table`)) - if err := i.Get(&v); err == nil || err.Error() != "missing destination name testtextunbound in *gocqlx_test.UnsafeTable" { + if err := i.Get(&v); err == nil || err.Error() != "missing destination name \"testtextunbound\" in *gocqlx_test.UnsafeTable" { t.Fatal("expected ErrNotFound", "got", err) } }) @@ -239,7 +239,7 @@ func TestUnsafe(t *testing.T) { t.Run("safe select", func(t *testing.T) { var v []UnsafeTable i := gocqlx.Iter(session.Query(`SELECT * FROM unsafe_table`)) - if err := i.Select(&v); err == nil || err.Error() != "missing destination name testtextunbound in *gocqlx_test.UnsafeTable" { + if err := i.Select(&v); err == nil || err.Error() != "missing destination name \"testtextunbound\" in *gocqlx_test.UnsafeTable" { t.Fatal("expected ErrNotFound", "got", err) } if cap(v) > 0 { diff --git a/iterx.go b/iterx.go index 860d845..b68faff 100644 --- a/iterx.go +++ b/iterx.go @@ -228,7 +228,7 @@ func (iter *Iterx) StructScan(dest interface{}) bool { // if we are not unsafe and are missing fields, return an error if !iter.unsafe { if f, err := missingFields(iter.fields); err != nil { - iter.err = fmt.Errorf("missing destination name %s in %T", columns[f], dest) + iter.err = fmt.Errorf("missing destination name %q in %T", columns[f], dest) return false } } diff --git a/queryx.go b/queryx.go index 50f0346..92c1aad 100644 --- a/queryx.go +++ b/queryx.go @@ -138,7 +138,7 @@ func bindStructArgs(names []string, arg0 interface{}, arg1 map[string]interface{ } else { val, ok := arg1[names[i]] if !ok { - return arglist, fmt.Errorf("could not find name %s in %#v and %#v", names[i], arg0, arg1) + return arglist, fmt.Errorf("could not find name %q in %#v and %#v", names[i], arg0, arg1) } arglist = append(arglist, val) } @@ -166,7 +166,7 @@ func bindMapArgs(names []string, arg map[string]interface{}) ([]interface{}, err for _, name := range names { val, ok := arg[name] if !ok { - return arglist, fmt.Errorf("could not find name %s in %#v", name, arg) + return arglist, fmt.Errorf("could not find name %q in %#v", name, arg) } arglist = append(arglist, val) }