Skip to content

feat: BeforeUpdate hook supports update using struct #2552

feat: BeforeUpdate hook supports update using struct

feat: BeforeUpdate hook supports update using struct #2552

GitHub Actions / golangci succeeded Aug 21, 2024 in 0s

reviewdog [golangci] report

reported by reviewdog 🐶

Findings (0)
Filtered Findings (125)

clause/clause.go|43 col 21| Error return value of builder.WriteByte is not checked (errcheck)
clause/clause.go|47 col 23| Error return value of builder.WriteString is not checked (errcheck)
clause/clause.go|48 col 21| Error return value of builder.WriteByte is not checked (errcheck)
clause/clause.go|53 col 21| Error return value of builder.WriteByte is not checked (errcheck)
clause/delete.go|12 col 21| Error return value of builder.WriteString is not checked (errcheck)
clause/delete.go|16 col 22| Error return value of builder.WriteString is not checked (errcheck)
schema/field.go|837 col 16| Error return value is not checked (errcheck)
callbacks.go|107 col 16| Error return value of db.AddError is not checked (errcheck)
callbacks.go|109 col 16| Error return value of db.AddError is not checked (errcheck)
callbacks.go|125 col 15| Error return value of db.AddError is not checked (errcheck)
chainable_api.go|126 col 16| Error return value of tx.AddError is not checked (errcheck)
chainable_api.go|170 col 14| Error return value of tx.AddError is not checked (errcheck)
finisher_api.go|58 col 15| Error return value of tx.AddError is not checked (errcheck)
finisher_api.go|535 col 15| Error return value of tx.ScanRows is not checked (errcheck)
statement.go|85 col 22| Error return value of writer.WriteString is not checked (errcheck)
statement.go|104 col 20| Error return value of writer.WriteByte is not checked (errcheck)
statement.go|114 col 20| Error return value of writer.WriteByte is not checked (errcheck)
statement.go|119 col 21| Error return value of stmt.DB.AddError is not checked (errcheck)
statement.go|132 col 22| Error return value of writer.WriteString is not checked (errcheck)
statement.go|136 col 19| Error return value of writer.WriteByte is not checked (errcheck)
statement.go|206 col 23| Error return value of writer.WriteString is not checked (errcheck)
statement.go|437 col 18| Error return value of stmt.AddError is not checked (errcheck)
statement.go|475 col 19| Error return value of stmt.WriteByte is not checked (errcheck)
statement.go|586 col 19| Error return value of stmt.AddError is not checked (errcheck)
statement.go|588 col 19| Error return value of stmt.AddError is not checked (errcheck)
migrator/migrator.go|336 col 16| Error return value of m.RunWithValue is not checked (errcheck)
migrator/migrator.go|430 col 16| Error return value of m.RunWithValue is not checked (errcheck)
migrator/migrator.go|772 col 16| Error return value of m.RunWithValue is not checked (errcheck)
migrator/migrator.go|895 col 42| Error return value of (*database/sql.Row).Scan is not checked (errcheck)
callbacks/associations.go|164 col 23| Error return value is not checked (errcheck)
callbacks/associations.go|184 col 23| Error return value is not checked (errcheck)
callbacks/callbacks.go|41 col 50| Error return value of (*gorm.io/gorm.callback).Register is not checked (errcheck)
callbacks/callbacks.go|42 col 25| Error return value of createCallback.Register is not checked (errcheck)
callbacks/callbacks.go|43 col 25| Error return value of createCallback.Register is not checked (errcheck)
callbacks/callbacks.go|44 col 25| Error return value of createCallback.Register is not checked (errcheck)
callbacks/callbacks.go|47 col 50| Error return value of (*gorm.io/gorm.callback).Register is not checked (errcheck)
callbacks/callbacks.go|51 col 24| Error return value of queryCallback.Register is not checked (errcheck)
callbacks/callbacks.go|52 col 24| Error return value of queryCallback.Register is not checked (errcheck)
callbacks/callbacks.go|53 col 24| Error return value of queryCallback.Register is not checked (errcheck)
callbacks/callbacks.go|57 col 50| Error return value of (*gorm.io/gorm.callback).Register is not checked (errcheck)
callbacks/callbacks.go|58 col 25| Error return value of deleteCallback.Register is not checked (errcheck)
callbacks/callbacks.go|59 col 25| Error return value of deleteCallback.Register is not checked (errcheck)
callbacks/callbacks.go|60 col 25| Error return value of deleteCallback.Register is not checked (errcheck)
callbacks/callbacks.go|67 col 25| Error return value of updateCallback.Register is not checked (errcheck)
callbacks/callbacks.go|68 col 25| Error return value of updateCallback.Register is not checked (errcheck)
callbacks/callbacks.go|69 col 25| Error return value of updateCallback.Register is not checked (errcheck)
callbacks/callbacks.go|77 col 22| Error return value of rowCallback.Register is not checked (errcheck)
callbacks/callbacks.go|81 col 22| Error return value of rawCallback.Register is not checked (errcheck)
logger/sql.go|124 col 11| ifElseChain: rewrite if-else to switch statement (gocritic)
clause/expression.go|127 col 3| ifElseChain: rewrite if-else to switch statement (gocritic)
clause/expression.go|105 col 5| singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
schema/field.go|293 col 3| ifElseChain: rewrite if-else to switch statement (gocritic)
finisher_api.go|273 col 5| singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
logger/sql_test.go|11| File is not goimports-ed with -local gorm.io/gorm (goimports)
schema/field.go|14| File is not goimports-ed with -local gorm.io/gorm (goimports)
chainable_api.go|451| File is not goimports-ed with -local gorm.io/gorm (goimports)
schema/naming.go|4 col 2| G505: Blocklisted import crypto/sha1: weak cryptographic primitive (gosec)
schema/naming.go|108 col 8| G401: Use of weak cryptographic primitive (gosec)
schema/field.go|647 col 50| G115: integer overflow conversion uint -> int64 (gosec)
schema/field.go|649 col 50| G115: integer overflow conversion uint8 -> int64 (gosec)
schema/field.go|655 col 50| G115: integer overflow conversion uint64 -> int64 (gosec)
schema/schema_test.go|194 col 36| G601: Implicit memory aliasing in for loop. (gosec)
schema/schema_test.go|235 col 35| G601: Implicit memory aliasing in for loop. (gosec)
schema/schema_test.go|303 col 35| G601: Implicit memory aliasing in for loop. (gosec)
schema/relationship.go|269 col 2| Consider pre-allocating joinTableFields (prealloc)
callbacks.go|256 col 2| Consider pre-allocating names (prealloc)
logger/sql_test.go|33 col 23| format - escaper always receives " ("\"") (unparam)
migrator/migrator.go|129 col 70| unnecessary leading newline (whitespace)
migrator/migrator.go|218 col 75| unnecessary leading newline (whitespace)
migrator/migrator.go|421 col 4| unnecessary trailing newline (whitespace)
callbacks/associations.go|322 col 7| unnecessary trailing newline (whitespace)
callbacks/delete.go|110 col 2| unnecessary trailing newline (whitespace)
clause/expression.go|28 col 1| calculated cyclomatic complexity for function Build is 15, max is 10 (cyclop)
clause/expression.go|85 col 1| calculated cyclomatic complexity for function Build is 37, max is 10 (cyclop)
clause/where.go|43 col 1| calculated cyclomatic complexity for function buildExprs is 19, max is 10 (cyclop)
clause/where.go|168 col 1| calculated cyclomatic complexity for function Build is 23, max is 10 (cyclop)
logger/sql.go|51 col 1| calculated cyclomatic complexity for function ExplainSQL is 50, max is 10 (cyclop)
migrator/migrator.go|121 col 1| calculated cyclomatic complexity for function AutoMigrate is 27, max is 10 (cyclop)
migrator/migrator.go|215 col 1| calculated cyclomatic complexity for function CreateTable is 25, max is 10 (cyclop)
migrator/migrator.go|469 col 1| calculated cyclomatic complexity for function MigrateColumn is 41, max is 10 (cyclop)
migrator/migrator.go|900 col 1| calculated cyclomatic complexity for function ReorderModels is 22, max is 10 (cyclop)
utils/tests/dummy_dialecter.go|42 col 1| calculated cyclomatic complexity for function QuoteTo is 14, max is 10 (cyclop)
utils/tests/utils.go|30 col 1| calculated cyclomatic complexity for function AssertEqual is 25, max is 10 (cyclop)
association.go|75 col 1| calculated cyclomatic complexity for function Replace is 30, max is 10 (cyclop)
association.go|197 col 1| calculated cyclomatic complexity for function Delete is 35, max is 10 (cyclop)
association.go|380 col 1| calculated cyclomatic complexity for function saveAssociation is 55, max is 10 (cyclop)
callbacks.go|75 col 1| calculated cyclomatic complexity for function Execute is 25, max is 10 (cyclop)
callbacks.go|255 col 1| calculated cyclomatic complexity for function sortCallbacks is 34, max is 10 (cyclop)
chainable_api.go|112 col 1| calculated cyclomatic complexity for function Select is 18, max is 10 (cyclop)
finisher_api.go|73 col 1| calculated cyclomatic complexity for function Save is 16, max is 10 (cyclop)
finisher_api.go|174 col 1| calculated cyclomatic complexity for function FindInBatches is 17, max is 10 (cyclop)
finisher_api.go|246 col 1| calculated cyclomatic complexity for function assignInterfacesToValue is 21, max is 10 (cyclop)
finisher_api.go|346 col 1| calculated cyclomatic complexity for function FirstOrCreate is 13, max is 10 (cyclop)
finisher_api.go|442 col 1| calculated cyclomatic complexity for function Count is 18, max is 10 (cyclop)
finisher_api.go|620 col 1| calculated cyclomatic complexity for function Transaction is 11, max is 10 (cyclop)
gorm.go|124 col 1| calculated cyclomatic complexity for function Open is 23, max is 10 (cyclop)
gorm.go|221 col 1| calculated cyclomatic complexity for function Session is 22, max is 10 (cyclop)
gorm.go|383 col 1| calculated cyclomatic complexity for function DB is 11, max is 10 (cyclop)
scan.go|53 col 1| calculated cyclomatic complexity for function scanIntoStruct is 15, max is 10 (cyclop)
scan.go|125 col 1| calculated cyclomatic complexity for function Scan is 71, max is 10 (cyclop)
statement.go|82 col 1| calculated cyclomatic complexity for function QuoteTo is 23, max is 10 (cyclop)
statement.go|170 col 1| calculated cyclomatic complexity for function AddVar is 25, max is 10 (cyclop)
statement.go|285 col 1| calculated cyclomatic complexity for function BuildCondition is 70, max is 10 (cyclop)
statement.go|562 col 1| calculated cyclomatic complexity for function SetColumn is 16, max is 10 (cyclop)
statement.go|618 col 1| calculated cyclomatic complexity for function Changed is 18, max is 10 (cyclop)
statement.go|687 col 1| calculated cyclomatic complexity for function SelectAndOmitColumns is 23, max is 10 (cyclop)
callbacks/associations.go|13 col 1| calculated cyclomatic complexity for function SaveBeforeAssociations is 30, max is 10 (cyclop)
callbacks/associations.go|110 col 1| calculated cyclomatic complexity for function SaveAfterAssociations is 74, max is 10 (cyclop)
callbacks/associations.go|378 col 1| calculated cyclomatic complexity for function saveAssociations is 11, max is 10 (cyclop)
callbacks/create.go|37 col 1| calculated cyclomatic complexity for function Create is 45, max is 10 (cyclop)
callbacks/create.go|226 col 1| calculated cyclomatic complexity for function ConvertToCreateValues is 75, max is 10 (cyclop)
callbacks/delete.go|26 col 1| calculated cyclomatic complexity for function DeleteBeforeAssociations is 24, max is 10 (cyclop)
callbacks/delete.go|113 col 1| calculated cyclomatic complexity for function Delete is 16, max is 10 (cyclop)
callbacks/helper.go|43 col 1| calculated cyclomatic complexity for function ConvertSliceOfMapToValuesForCreate is 14, max is 10 (cyclop)
callbacks/preload.go|185 col 1| calculated cyclomatic complexity for function preload is 36, max is 10 (cyclop)
callbacks/query.go|32 col 1| calculated cyclomatic complexity for function BuildQuerySQL is 62, max is 10 (cyclop)
callbacks/update.go|33 col 1| calculated cyclomatic complexity for function BeforeUpdate is 15, max is 10 (cyclop)
callbacks/update.go|76 col 1| calculated cyclomatic complexity for function Update is 12, max is 10 (cyclop)
callbacks/update.go|151 col 1| calculated cyclomatic complexity for function ConvertToAssignments is 78, max is 10 (cyclop)
schema/field.go|106 col 1| calculated cyclomatic complexity for function ParseField is 122, max is 10 (cyclop)
schema/field.go|450 col 1| calculated cyclomatic complexity for function setupValuerAndSetter is 199, max is 10 (cyclop)
schema/index.go|30 col 1| calculated cyclomatic complexity for function ParseIndexes is 14, max is 10 (cyclop)
scan.go|18 col 31| SA1019: reflect.PtrTo has been deprecated since Go 1.22 and an alternative has been available since Go 1.18: Superseded by [PointerTo]. (staticcheck)
scan.go|26 col 31| SA1019: reflect.PtrTo has been deprecated since Go 1.22 and an alternative has been available since Go 1.18: Superseded by [PointerTo]. (staticcheck)
callbacks/associations.go|50 col 19| SA1019: reflect.PtrTo has been deprecated since Go 1.22 and an alternative has been available since Go 1.18: Superseded by [PointerTo]. (staticcheck)