Go

Go

Made by DeepSource

Audit required: SkipDefaultTransaction set to false GO-W1004

Bug risk
Major

GORM performs write (create/update/delete) operations 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.

Please note that toggling the SkipDefaultTransaction from false to true might lead to performance gains but can introduce bugs because, in some cases, ensuring data consistency might be preferred.

Bad practice

_ = &gorm.Config{SkipDefaultTransaction: false}

Recommended

_ = &gorm.Config{SkipDefaultTransaction: true}

References