reflectx: fixes to items reported by megacheck

This commit is contained in:
Michał Matczuk
2018-05-25 11:00:45 +02:00
parent aef66f4663
commit daad194304
2 changed files with 1 additions and 6 deletions

View File

@@ -269,9 +269,7 @@ type typeQueue struct {
// A copying append that creates a new slice each time. // A copying append that creates a new slice each time.
func apnd(is []int, i int) []int { func apnd(is []int, i int) []int {
x := make([]int, len(is)+1) x := make([]int, len(is)+1)
for p, n := range is { copy(x, is)
x[p] = n
}
x[len(x)-1] = i x[len(x)-1] = i
return x return x
} }

View File

@@ -603,7 +603,6 @@ func TestMapperMethodsByName(t *testing.T) {
A0 *B `db:"A0"` A0 *B `db:"A0"`
B `db:"A1"` B `db:"A1"`
A2 int A2 int
a3 int
} }
val := &A{ val := &A{
@@ -811,8 +810,6 @@ func TestMustBe(t *testing.T) {
t.Error("expected panic with *reflect.ValueError") t.Error("expected panic with *reflect.ValueError")
return return
} }
if valueErr.Method != "github.com/jmoiron/sqlx/reflectx.TestMustBe" {
}
if valueErr.Kind != reflect.String { if valueErr.Kind != reflect.String {
t.Errorf("unexpected Kind: %s", valueErr.Kind) t.Errorf("unexpected Kind: %s", valueErr.Kind)
} }