format with gofumpt (#18184)

* gofumpt -w -l .

* gofumpt -w -l -extra .

* Add linter

* manual fix

* change make fmt
This commit is contained in:
6543 2022-01-20 18:46:10 +01:00 committed by GitHub
parent 1d98d205f5
commit 54e9ee37a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
423 changed files with 1585 additions and 1758 deletions

View file

@ -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)
}
}

View file

@ -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
}

View file

@ -124,5 +124,4 @@ func Test_removeInvalidLabels(t *testing.T) {
t.Errorf("IssueLabel[%d] was deleted but should have remained", id)
}
}
}

View file

@ -85,5 +85,4 @@ func Test_deleteOrphanedIssueLabels(t *testing.T) {
pre := preMigration[id]
assert.Equal(t, pre, post, "migration changed issueLabel %d", id)
}
}

View file

@ -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)

View file

@ -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)

View file

@ -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)
}
}
}

View file

@ -11,7 +11,6 @@ import (
)
func alterIssueAndCommentTextFieldsToLongText(x *xorm.Engine) error {
sess := x.NewSession()
defer sess.Close()
if err := sess.Begin(); err != nil {

View file

@ -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)

View file

@ -16,7 +16,6 @@ import (
)
func addWebAuthnCred(x *xorm.Engine) error {
// Create webauthnCredential table
type webauthnCredential struct {
ID int64 `xorm:"pk autoincr"`

View file

@ -12,7 +12,6 @@ import (
)
func useBase32HexForCredIDInWebAuthnCredential(x *xorm.Engine) error {
// Create webauthnCredential table
type webauthnCredential struct {
ID int64 `xorm:"pk autoincr"`