diff options
author | 6543 <6543@obermui.de> | 2022-01-20 18:46:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-20 18:46:10 +0100 |
commit | 54e9ee37a7a301dbe74d46fd3c87712e6120e9bf (patch) | |
tree | 1be12fb072625c1b896b9d72f7912b018aad502b /modules/convert | |
parent | 1d98d205f5825f40110e6628b61a97c91ac7f72d (diff) | |
download | gitea-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 'modules/convert')
-rw-r--r-- | modules/convert/notification.go | 6 | ||||
-rw-r--r-- | modules/convert/pull_test.go | 4 | ||||
-rw-r--r-- | modules/convert/repository.go | 2 | ||||
-rw-r--r-- | modules/convert/status.go | 1 |
4 files changed, 6 insertions, 7 deletions
diff --git a/modules/convert/notification.go b/modules/convert/notification.go index a0bd4cdc27..f304eadf69 100644 --- a/modules/convert/notification.go +++ b/modules/convert/notification.go @@ -22,12 +22,12 @@ func ToNotificationThread(n *models.Notification) *api.NotificationThread { URL: n.APIURL(), } - //since user only get notifications when he has access to use minimal access mode + // since user only get notifications when he has access to use minimal access mode if n.Repository != nil { result.Repository = ToRepo(n.Repository, perm.AccessModeRead) } - //handle Subject + // handle Subject switch n.Source { case models.NotificationSourceIssue: result.Subject = &api.NotificationSubject{Type: api.NotifySubjectIssue} @@ -83,7 +83,7 @@ func ToNotificationThread(n *models.Notification) *api.NotificationThread { // ToNotifications convert list of Notification to api.NotificationThread list func ToNotifications(nl models.NotificationList) []*api.NotificationThread { - var result = make([]*api.NotificationThread, 0, len(nl)) + result := make([]*api.NotificationThread, 0, len(nl)) for _, n := range nl { result = append(result, ToNotificationThread(n)) } diff --git a/modules/convert/pull_test.go b/modules/convert/pull_test.go index 5351b5e172..8574ccfd26 100644 --- a/modules/convert/pull_test.go +++ b/modules/convert/pull_test.go @@ -18,7 +18,7 @@ import ( ) func TestPullRequest_APIFormat(t *testing.T) { - //with HeadRepo + // with HeadRepo assert.NoError(t, unittest.PrepareTestDatabase()) headRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository) pr := unittest.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest) @@ -34,7 +34,7 @@ func TestPullRequest_APIFormat(t *testing.T) { Repository: ToRepo(headRepo, perm.AccessModeRead), }, apiPullRequest.Head) - //withOut HeadRepo + // withOut HeadRepo pr = unittest.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest) assert.NoError(t, pr.LoadIssue()) assert.NoError(t, pr.LoadAttributes()) diff --git a/modules/convert/repository.go b/modules/convert/repository.go index 459f98f396..a356925539 100644 --- a/modules/convert/repository.go +++ b/modules/convert/repository.go @@ -40,7 +40,7 @@ func innerToRepo(repo *repo_model.Repository, mode perm.AccessMode, isParent boo } } - //check enabled/disabled units + // check enabled/disabled units hasIssues := false var externalTracker *api.ExternalTracker var internalTracker *api.InternalTracker diff --git a/modules/convert/status.go b/modules/convert/status.go index eb77c14dab..1ac2a0f3e1 100644 --- a/modules/convert/status.go +++ b/modules/convert/status.go @@ -33,7 +33,6 @@ func ToCommitStatus(status *models.CommitStatus) *api.CommitStatus { // ToCombinedStatus converts List of CommitStatus to a CombinedStatus func ToCombinedStatus(statuses []*models.CommitStatus, repo *api.Repository) *api.CombinedStatus { - if len(statuses) == 0 { return nil } |