Skip to content

Commit 9f967c8

Browse files
h3n4lclaude
andcommitted
fix: lint issues and DocumentDB test compatibility
- Fix ineffectual assignment lint error in extractCreateIndexesArgs - Remove redundant nil check before len() (staticcheck S1009) - Skip TestServerStatus on DocumentDB (serverStatus unsupported) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9cc4379 commit 9f967c8

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

admin_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ func TestCollectionStats(t *testing.T) {
558558
}
559559

560560
func TestServerStatus(t *testing.T) {
561-
testutil.RunOnAllDBs(t, func(t *testing.T, db testutil.TestDB) {
561+
// serverStatus is not supported on DocumentDB
562+
testutil.RunOnMongoDBOnly(t, func(t *testing.T, db testutil.TestDB) {
562563
dbName := fmt.Sprintf("testdb_server_status_%s", db.Name)
563564
defer testutil.CleanupDatabase(t, db.Client, dbName)
564565

internal/translator/collection.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,11 +2208,11 @@ func (v *visitor) extractCreateIndexesArgs(ctx mongodb.ICreateIndexesMethodConte
22082208
var keyDoc bson.D
22092209
for _, field := range doc {
22102210
if field.Key == "key" {
2211-
keyDoc, ok = field.Value.(bson.D)
2211+
keyDoc, _ = field.Value.(bson.D)
22122212
break
22132213
}
22142214
}
2215-
if keyDoc == nil || len(keyDoc) == 0 {
2215+
if len(keyDoc) == 0 {
22162216
v.err = fmt.Errorf("createIndexes() element %d must have a non-empty 'key' document", i)
22172217
return
22182218
}

0 commit comments

Comments
 (0)