Skip to content

Commit e452d94

Browse files
autofix: format code with gofumpt and gofmt (#6803)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
1 parent 2466da4 commit e452d94

File tree

12 files changed

+21
-18
lines changed

12 files changed

+21
-18
lines changed

internal/auth/pam/pam.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build pam
12
// +build pam
23

34
// Copyright 2014 The Gogs Authors. All rights reserved.

internal/cmd/backup.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ portable among all supported database engines.`,
4242
},
4343
}
4444

45-
const currentBackupFormatVersion = 1
46-
const archiveRootDir = "gogs-backup"
45+
const (
46+
currentBackupFormatVersion = 1
47+
archiveRootDir = "gogs-backup"
48+
)
4749

4850
func runBackup(c *cli.Context) error {
4951
zip.Verbose = c.Bool("verbose")

internal/cmd/cert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build cert
12
// +build cert
23

34
// Copyright 2009 The Go Authors. All rights reserved.

internal/cmd/web.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ func runWeb(c *cli.Context) error {
456456
Post(bindIgnErr(form.AddSSHKey{}), repo.SettingsDeployKeysPost)
457457
m.Post("/delete", repo.DeleteDeployKey)
458458
})
459-
460459
}, func(c *context.Context) {
461460
c.Data["PageIsSettings"] = true
462461
})
@@ -734,7 +733,8 @@ func runWeb(c *cli.Context) error {
734733
tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
735734
tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
736735
},
737-
}, Handler: m}
736+
}, Handler: m,
737+
}
738738
err = server.ListenAndServeTLS(conf.Server.CertFile, conf.Server.KeyFile)
739739

740740
case "fcgi":

internal/conf/static_minwinsvc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build minwinsvc
12
// +build minwinsvc
23

34
// Copyright 2015 The Gogs Authors. All rights reserved.

internal/db/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func getEngine() (*xorm.Engine, error) {
8383
connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s%scharset=utf8mb4&parseTime=true",
8484
conf.Database.User, conf.Database.Password, conf.Database.Host, conf.Database.Name, Param)
8585
}
86-
var engineParams = map[string]string{"rowFormat": "DYNAMIC"}
86+
engineParams := map[string]string{"rowFormat": "DYNAMIC"}
8787
return xorm.NewEngineWithParams(conf.Database.Type, connStr, engineParams)
8888

8989
case "postgres":

internal/db/perms_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func Test_perms(t *testing.T) {
4141
})
4242
}
4343
}
44+
4445
func test_perms_AccessMode(t *testing.T, db *perms) {
4546
// Set up permissions
4647
err := db.SetRepoPerms(1, map[int64]AccessMode{

internal/db/webhook_dingtalk.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const (
1818
DingtalkNotificationTitle = "Gogs Notification"
1919
)
2020

21-
//Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1
21+
// Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1
2222
type DingtalkActionCard struct {
2323
Title string `json:"title"`
2424
Text string `json:"text"`
@@ -28,13 +28,13 @@ type DingtalkActionCard struct {
2828
SingleURL string `json:"singleURL"`
2929
}
3030

31-
//Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1
31+
// Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1
3232
type DingtalkAtObject struct {
3333
AtMobiles []string `json:"atMobiles"`
3434
IsAtAll bool `json:"isAtAll"`
3535
}
3636

37-
//Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1
37+
// Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1
3838
type DingtalkPayload struct {
3939
MsgType string `json:"msgtype"`
4040
At DingtalkAtObject `json:"at"`
@@ -57,7 +57,7 @@ func NewDingtalkActionCard(singleTitle, singleURL string) DingtalkActionCard {
5757
}
5858
}
5959

60-
//TODO: add content
60+
// TODO: add content
6161
func GetDingtalkPayload(p api.Payloader, event HookEventType) (payload *DingtalkPayload, err error) {
6262
switch event {
6363
case HOOK_EVENT_CREATE:
@@ -255,7 +255,7 @@ func getDingtalkReleasePayload(p *api.ReleasePayload) (*DingtalkPayload, error)
255255
return &DingtalkPayload{MsgType: "actionCard", ActionCard: actionCard}, nil
256256
}
257257

258-
//Format link addr and title into markdown style
258+
// Format link addr and title into markdown style
259259
func MarkdownLinkFormatter(link, text string) string {
260260
return "[" + text + "](" + link + ")"
261261
}

internal/gitutil/error.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ type Error struct {
2020
func (e Error) NotFound() bool {
2121
return IsErrSubmoduleNotExist(e.error) ||
2222
IsErrRevisionNotExist(e.error)
23-
2423
}
2524

2625
// NewError wraps given error.

internal/process/manager.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ import (
1515
log "unknwon.dev/clog/v2"
1616
)
1717

18-
var (
19-
ErrExecTimeout = errors.New("process execution timeout")
20-
)
18+
var ErrExecTimeout = errors.New("process execution timeout")
2119

2220
const DEFAULT_TIMEOUT = 60 * time.Second
2321

@@ -41,8 +39,10 @@ func (c *pidCounter) PID() int64 {
4139
return c.pid
4240
}
4341

44-
var counter = new(pidCounter)
45-
var Processes []*Process
42+
var (
43+
counter = new(pidCounter)
44+
Processes []*Process
45+
)
4646

4747
// Add adds a process to global list and returns its PID.
4848
func Add(desc string, cmd *exec.Cmd) int64 {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy