From 5e599a07ec6aacd85b7806805908c4a78fa0e5ce Mon Sep 17 00:00:00 2001 From: hakusai22 Date: Wed, 8 May 2024 12:07:58 +0800 Subject: [PATCH] fix: typo (#7003) * fix: typo * fix: covered --- scan.go | 2 +- tests/embedded_struct_test.go | 2 +- tests/non_std_test.go | 2 +- tests/query_test.go | 4 ++-- tests/transaction_test.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scan.go b/scan.go index e95e6d30..89b46c0a 100644 --- a/scan.go +++ b/scan.go @@ -244,7 +244,7 @@ func Scan(rows Rows, db *DB, mode ScanMode) { rel = rel.FieldSchema.Relationships.Relations[name] relFields = append(relFields, rel.Field) } - // lastest name is raw dbname + // latest name is raw dbname dbName := names[subNameCount-1] if field := rel.FieldSchema.LookUpField(dbName); field != nil && field.Readable { fields[idx] = field diff --git a/tests/embedded_struct_test.go b/tests/embedded_struct_test.go index 873bba2a..3351ed8e 100644 --- a/tests/embedded_struct_test.go +++ b/tests/embedded_struct_test.go @@ -279,6 +279,6 @@ func TestEmbeddedTagSetting(t *testing.T) { err = DB.Save(&t1).Error AssertEqual(t, err, nil) if t1.Tag1.Id == 0 { - t.Errorf("embedded struct's primary field should be rewrited") + t.Errorf("embedded struct's primary field should be rewritten") } } diff --git a/tests/non_std_test.go b/tests/non_std_test.go index 8ae42691..5178859f 100644 --- a/tests/non_std_test.go +++ b/tests/non_std_test.go @@ -37,7 +37,7 @@ func TestNonStdPrimaryKeyAndDefaultValues(t *testing.T) { } animal = Animal{From: "somewhere"} // No name fields, should be filled with the default value (galeone) - DB.Save(&animal).Update("From", "a nice place") // The name field shoul be untouched + DB.Save(&animal).Update("From", "a nice place") // The name field should be untouched DB.First(&animal, animal.Counter) if animal.Name != "galeone" { t.Errorf("Name fields shouldn't be changed if untouched, but got %v", animal.Name) diff --git a/tests/query_test.go b/tests/query_test.go index d0ed675a..79f7182b 100644 --- a/tests/query_test.go +++ b/tests/query_test.go @@ -1337,7 +1337,7 @@ func TestQueryResetNullValue(t *testing.T) { Number1 int64 `gorm:"default:NULL"` Number2 uint64 `gorm:"default:NULL"` Number3 float64 `gorm:"default:NULL"` - Now *time.Time `gorm:"defalut:NULL"` + Now *time.Time `gorm:"default:NULL"` Item1Id string Item1 *QueryResetItem `gorm:"references:ID"` Item2Id string @@ -1427,7 +1427,7 @@ func TestQueryScanToArray(t *testing.T) { t.Fatal(err) } if users[0] == nil || users[0].Name != "testname1" { - t.Error("users[0] not covere") + t.Error("users[0] not covered") } if users[1] != nil { t.Error("users[1] should be empty") diff --git a/tests/transaction_test.go b/tests/transaction_test.go index 126ccb23..d2cbc9a9 100644 --- a/tests/transaction_test.go +++ b/tests/transaction_test.go @@ -67,7 +67,7 @@ func TestTransaction(t *testing.T) { return tx5.First(&User{}, "name = ?", "transaction-2").Error }) }); err != nil { - t.Fatalf("prepare statement and nested transcation coexist" + err.Error()) + t.Fatalf("prepare statement and nested transaction coexist" + err.Error()) } }) }