aboutsummaryrefslogtreecommitdiffstats
path: root/routers/install.go
diff options
context:
space:
mode:
authorLars Lehtonen <lars.lehtonen@gmail.com>2020-07-13 01:58:55 -0700
committerGitHub <noreply@github.com>2020-07-13 09:58:55 +0100
commitb49a195839ae388184c5111464d8ea3dbe03772b (patch)
tree499c109c6bca544180acf70f966b73be7d3af791 /routers/install.go
parent48ad76c25e6ff103901f347c3b53f80b483498c4 (diff)
downloadgitea-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 'routers/install.go')
-rw-r--r--routers/install.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/routers/install.go b/routers/install.go
index d4f270c9c3..9eda18f941 100644
--- a/routers/install.go
+++ b/routers/install.go
@@ -23,7 +23,6 @@ import (
"github.com/unknwon/com"
"gopkg.in/ini.v1"
- "xorm.io/xorm"
)
const (
@@ -161,8 +160,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
}
// Set test engine.
- var x *xorm.Engine
- if err = models.NewTestEngine(x); err != nil {
+ if err = models.NewTestEngine(); err != nil {
if strings.Contains(err.Error(), `Unknown database type: sqlite3`) {
ctx.Data["Err_DbType"] = true
ctx.RenderWithErr(ctx.Tr("install.sqlite3_not_available", "https://docs.gitea.io/en-us/install-from-binary/"), tplInstall, &form)