You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
here tx, err := db.Begin() will make a temporary variable tx, so out of the if statement, tx also will be a nil value. Thus, when you call the interface which need parameter *sql.Tx and you give a nil to it, it will cause a panic. For example:
gid, err:=flow.Groups.New(nil, "nike", "G")
I give nil to Groups.New because I have called RegisterDB to make db is not null.
@js-ojus
Hi, I have found that the following code is a bug:
here
tx, err := db.Begin()
will make a temporary variabletx
, so out of the if statement, tx also will be a nil value. Thus, when you call the interface which need parameter*sql.Tx
and you give a nil to it, it will cause a panic. For example:I give
nil
toGroups.New
because I have called RegisterDB to make db is not null.We can use this code to fix it:
The text was updated successfully, but these errors were encountered: