Go

Go

By DeepSource

Audit required: `SkipDefaultTransaction` set to `false`GO-W1004

Bug risk

GORM performs write (create/update/delete) operations that run inside a transaction to ensure data consistency. Consider disabling it during initialization if it is not required, and it'd gain about 30%+ performance improvement after setting SkipDefaultTransaction to true.

Examples

Bad practice

_ = &gorm.Config{SkipDefaultTransaction: false}

Recommended

_ = &gorm.Config{SkipDefaultTransaction: true}

References