diff options
author | Lars Lehtonen <lars.lehtonen@gmail.com> | 2020-07-13 01:58:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-13 09:58:55 +0100 |
commit | b49a195839ae388184c5111464d8ea3dbe03772b (patch) | |
tree | 499c109c6bca544180acf70f966b73be7d3af791 /models | |
parent | 48ad76c25e6ff103901f347c3b53f80b483498c4 (diff) | |
download | gitea-b49a195839ae388184c5111464d8ea3dbe03772b.tar.gz gitea-b49a195839ae388184c5111464d8ea3dbe03772b.zip |
models: fix xorm variable clobber (#12231)
NewTestEngine() takes a *xorm.Engine as its argument, and then immediately overwrites it.
This fixes the model package to not take an unneeded variable, and changes the routers package to not create a nil *xorm.Engine that is immediately discarded by model.
Diffstat (limited to 'models')
-rw-r--r-- | models/models.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/models/models.go b/models/models.go index 7f12d6260a..79a549b74b 100644 --- a/models/models.go +++ b/models/models.go @@ -151,7 +151,7 @@ func getEngine() (*xorm.Engine, error) { } // NewTestEngine sets a new test xorm.Engine -func NewTestEngine(x *xorm.Engine) (err error) { +func NewTestEngine() (err error) { x, err = getEngine() if err != nil { return fmt.Errorf("Connect to database: %v", err) |