summaryrefslogtreecommitdiffstats
path: root/models/migrations
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-01-20 18:46:10 +0100
committerGitHub <noreply@github.com>2022-01-20 18:46:10 +0100
commit54e9ee37a7a301dbe74d46fd3c87712e6120e9bf (patch)
tree1be12fb072625c1b896b9d72f7912b018aad502b /models/migrations
parent1d98d205f5825f40110e6628b61a97c91ac7f72d (diff)
downloadgitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.tar.gz
gitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.zip
format with gofumpt (#18184)
* gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
Diffstat (limited to 'models/migrations')
-rw-r--r--models/migrations/migrations_test.go8
-rw-r--r--models/migrations/testlogger_test.go2
-rw-r--r--models/migrations/v176_test.go1
-rw-r--r--models/migrations/v177_test.go1
-rw-r--r--models/migrations/v181_test.go2
-rw-r--r--models/migrations/v182_test.go4
-rw-r--r--models/migrations/v189_test.go2
-rw-r--r--models/migrations/v191.go1
-rw-r--r--models/migrations/v195_test.go4
-rw-r--r--models/migrations/v207.go1
-rw-r--r--models/migrations/v208.go1
11 files changed, 10 insertions, 17 deletions
diff --git a/models/migrations/migrations_test.go b/models/migrations/migrations_test.go
index 33d589ddb2..f798d50117 100644
--- a/models/migrations/migrations_test.go
+++ b/models/migrations/migrations_test.go
@@ -219,10 +219,10 @@ func prepareTestEnv(t *testing.T, skip int, syncModels ...interface{}) (*xorm.En
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
}
for _, repoDir := range repoDirs {
- _ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "pack"), 0755)
- _ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "info"), 0755)
- _ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "heads"), 0755)
- _ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0755)
+ _ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "pack"), 0o755)
+ _ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "info"), 0o755)
+ _ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "heads"), 0o755)
+ _ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0o755)
}
}
diff --git a/models/migrations/testlogger_test.go b/models/migrations/testlogger_test.go
index 5e3d880b54..01d6b7a0f7 100644
--- a/models/migrations/testlogger_test.go
+++ b/models/migrations/testlogger_test.go
@@ -170,7 +170,7 @@ func (log *TestLogger) Init(config string) error {
func (log *TestLogger) Flush() {
}
-//ReleaseReopen does nothing
+// ReleaseReopen does nothing
func (log *TestLogger) ReleaseReopen() error {
return nil
}
diff --git a/models/migrations/v176_test.go b/models/migrations/v176_test.go
index 2763e4f120..bc066c3b32 100644
--- a/models/migrations/v176_test.go
+++ b/models/migrations/v176_test.go
@@ -124,5 +124,4 @@ func Test_removeInvalidLabels(t *testing.T) {
t.Errorf("IssueLabel[%d] was deleted but should have remained", id)
}
}
-
}
diff --git a/models/migrations/v177_test.go b/models/migrations/v177_test.go
index f5fc793aa4..5a58e2c614 100644
--- a/models/migrations/v177_test.go
+++ b/models/migrations/v177_test.go
@@ -85,5 +85,4 @@ func Test_deleteOrphanedIssueLabels(t *testing.T) {
pre := preMigration[id]
assert.Equal(t, pre, post, "migration changed issueLabel %d", id)
}
-
}
diff --git a/models/migrations/v181_test.go b/models/migrations/v181_test.go
index b392a9b71d..b9a6c6619b 100644
--- a/models/migrations/v181_test.go
+++ b/models/migrations/v181_test.go
@@ -38,7 +38,7 @@ func Test_addPrimaryEmail2EmailAddress(t *testing.T) {
IsPrimary bool `xorm:"DEFAULT(false) NOT NULL"`
}
- var users = make([]User, 0, 20)
+ users := make([]User, 0, 20)
err = x.Find(&users)
assert.NoError(t, err)
diff --git a/models/migrations/v182_test.go b/models/migrations/v182_test.go
index 9fb371e078..0d3eda9c51 100644
--- a/models/migrations/v182_test.go
+++ b/models/migrations/v182_test.go
@@ -37,10 +37,10 @@ func Test_addIssueResourceIndexTable(t *testing.T) {
MaxIndex int64 `xorm:"index"`
}
- var start = 0
+ start := 0
const batchSize = 1000
for {
- var indexes = make([]ResourceIndex, 0, batchSize)
+ indexes := make([]ResourceIndex, 0, batchSize)
err := x.Table("issue_index").Limit(batchSize, start).Find(&indexes)
assert.NoError(t, err)
diff --git a/models/migrations/v189_test.go b/models/migrations/v189_test.go
index fcae5dcc73..4ec3fe8c60 100644
--- a/models/migrations/v189_test.go
+++ b/models/migrations/v189_test.go
@@ -26,7 +26,6 @@ func (ls *LoginSourceOriginalV189) TableName() string {
}
func Test_unwrapLDAPSourceCfg(t *testing.T) {
-
// Prepare and load the testing database
x, deferable := prepareTestEnv(t, 0, new(LoginSourceOriginalV189))
if x == nil || t.Failed() {
@@ -80,5 +79,4 @@ func Test_unwrapLDAPSourceCfg(t *testing.T) {
assert.EqualValues(t, source.ID%2 == 0, source.IsActive, "unwrapLDAPSourceCfg failed for %d", source.ID)
}
}
-
}
diff --git a/models/migrations/v191.go b/models/migrations/v191.go
index c91990e0f3..9a688243e1 100644
--- a/models/migrations/v191.go
+++ b/models/migrations/v191.go
@@ -11,7 +11,6 @@ import (
)
func alterIssueAndCommentTextFieldsToLongText(x *xorm.Engine) error {
-
sess := x.NewSession()
defer sess.Close()
if err := sess.Begin(); err != nil {
diff --git a/models/migrations/v195_test.go b/models/migrations/v195_test.go
index baf9cb61c2..05f8469daa 100644
--- a/models/migrations/v195_test.go
+++ b/models/migrations/v195_test.go
@@ -40,10 +40,10 @@ func Test_addTableCommitStatusIndex(t *testing.T) {
MaxIndex int64 `xorm:"index"`
}
- var start = 0
+ start := 0
const batchSize = 1000
for {
- var indexes = make([]CommitStatusIndex, 0, batchSize)
+ indexes := make([]CommitStatusIndex, 0, batchSize)
err := x.Table("commit_status_index").Limit(batchSize, start).Find(&indexes)
assert.NoError(t, err)
diff --git a/models/migrations/v207.go b/models/migrations/v207.go
index 82e2e3aa31..4964a8435c 100644
--- a/models/migrations/v207.go
+++ b/models/migrations/v207.go
@@ -16,7 +16,6 @@ import (
)
func addWebAuthnCred(x *xorm.Engine) error {
-
// Create webauthnCredential table
type webauthnCredential struct {
ID int64 `xorm:"pk autoincr"`
diff --git a/models/migrations/v208.go b/models/migrations/v208.go
index 04bb981a4e..c1e656b98d 100644
--- a/models/migrations/v208.go
+++ b/models/migrations/v208.go
@@ -12,7 +12,6 @@ import (
)
func useBase32HexForCredIDInWebAuthnCredential(x *xorm.Engine) error {
-
// Create webauthnCredential table
type webauthnCredential struct {
ID int64 `xorm:"pk autoincr"`