diff options
-rw-r--r-- | internal/auth/pam/pam.go | 1 | ||||
-rw-r--r-- | internal/cmd/backup.go | 6 | ||||
-rw-r--r-- | internal/cmd/cert.go | 1 | ||||
-rw-r--r-- | internal/cmd/web.go | 4 | ||||
-rw-r--r-- | internal/conf/static_minwinsvc.go | 1 | ||||
-rw-r--r-- | internal/db/models.go | 2 | ||||
-rw-r--r-- | internal/db/perms_test.go | 1 | ||||
-rw-r--r-- | internal/db/webhook_dingtalk.go | 10 | ||||
-rw-r--r-- | internal/gitutil/error.go | 1 | ||||
-rw-r--r-- | internal/process/manager.go | 10 | ||||
-rw-r--r-- | internal/route/lfs/route.go | 1 | ||||
-rw-r--r-- | internal/route/repo/pull.go | 1 |
12 files changed, 21 insertions, 18 deletions
diff --git a/internal/auth/pam/pam.go b/internal/auth/pam/pam.go index 521cd4f0..0777bf7c 100644 --- a/internal/auth/pam/pam.go +++ b/internal/auth/pam/pam.go @@ -1,3 +1,4 @@ +//go:build pam // +build pam // Copyright 2014 The Gogs Authors. All rights reserved. diff --git a/internal/cmd/backup.go b/internal/cmd/backup.go index 874b1be0..c5e17e16 100644 --- a/internal/cmd/backup.go +++ b/internal/cmd/backup.go @@ -42,8 +42,10 @@ portable among all supported database engines.`, }, } -const currentBackupFormatVersion = 1 -const archiveRootDir = "gogs-backup" +const ( + currentBackupFormatVersion = 1 + archiveRootDir = "gogs-backup" +) func runBackup(c *cli.Context) error { zip.Verbose = c.Bool("verbose") diff --git a/internal/cmd/cert.go b/internal/cmd/cert.go index 7c91c2c6..c8280a12 100644 --- a/internal/cmd/cert.go +++ b/internal/cmd/cert.go @@ -1,3 +1,4 @@ +//go:build cert // +build cert // Copyright 2009 The Go Authors. All rights reserved. diff --git a/internal/cmd/web.go b/internal/cmd/web.go index c4ceda17..358ff832 100644 --- a/internal/cmd/web.go +++ b/internal/cmd/web.go @@ -456,7 +456,6 @@ func runWeb(c *cli.Context) error { Post(bindIgnErr(form.AddSSHKey{}), repo.SettingsDeployKeysPost) m.Post("/delete", repo.DeleteDeployKey) }) - }, func(c *context.Context) { c.Data["PageIsSettings"] = true }) @@ -734,7 +733,8 @@ func runWeb(c *cli.Context) error { tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, }, - }, Handler: m} + }, Handler: m, + } err = server.ListenAndServeTLS(conf.Server.CertFile, conf.Server.KeyFile) case "fcgi": diff --git a/internal/conf/static_minwinsvc.go b/internal/conf/static_minwinsvc.go index aebfaf6d..0b167714 100644 --- a/internal/conf/static_minwinsvc.go +++ b/internal/conf/static_minwinsvc.go @@ -1,3 +1,4 @@ +//go:build minwinsvc // +build minwinsvc // Copyright 2015 The Gogs Authors. All rights reserved. diff --git a/internal/db/models.go b/internal/db/models.go index 82968ae3..1be08c91 100644 --- a/internal/db/models.go +++ b/internal/db/models.go @@ -83,7 +83,7 @@ func getEngine() (*xorm.Engine, error) { connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s%scharset=utf8mb4&parseTime=true", conf.Database.User, conf.Database.Password, conf.Database.Host, conf.Database.Name, Param) } - var engineParams = map[string]string{"rowFormat": "DYNAMIC"} + engineParams := map[string]string{"rowFormat": "DYNAMIC"} return xorm.NewEngineWithParams(conf.Database.Type, connStr, engineParams) case "postgres": diff --git a/internal/db/perms_test.go b/internal/db/perms_test.go index c3b463ee..e242f843 100644 --- a/internal/db/perms_test.go +++ b/internal/db/perms_test.go @@ -41,6 +41,7 @@ func Test_perms(t *testing.T) { }) } } + func test_perms_AccessMode(t *testing.T, db *perms) { // Set up permissions err := db.SetRepoPerms(1, map[int64]AccessMode{ diff --git a/internal/db/webhook_dingtalk.go b/internal/db/webhook_dingtalk.go index 13287f5e..88246ca9 100644 --- a/internal/db/webhook_dingtalk.go +++ b/internal/db/webhook_dingtalk.go @@ -18,7 +18,7 @@ const ( DingtalkNotificationTitle = "Gogs Notification" ) -//Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1 +// Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1 type DingtalkActionCard struct { Title string `json:"title"` Text string `json:"text"` @@ -28,13 +28,13 @@ type DingtalkActionCard struct { SingleURL string `json:"singleURL"` } -//Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1 +// Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1 type DingtalkAtObject struct { AtMobiles []string `json:"atMobiles"` IsAtAll bool `json:"isAtAll"` } -//Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1 +// Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1 type DingtalkPayload struct { MsgType string `json:"msgtype"` At DingtalkAtObject `json:"at"` @@ -57,7 +57,7 @@ func NewDingtalkActionCard(singleTitle, singleURL string) DingtalkActionCard { } } -//TODO: add content +// TODO: add content func GetDingtalkPayload(p api.Payloader, event HookEventType) (payload *DingtalkPayload, err error) { switch event { case HOOK_EVENT_CREATE: @@ -255,7 +255,7 @@ func getDingtalkReleasePayload(p *api.ReleasePayload) (*DingtalkPayload, error) return &DingtalkPayload{MsgType: "actionCard", ActionCard: actionCard}, nil } -//Format link addr and title into markdown style +// Format link addr and title into markdown style func MarkdownLinkFormatter(link, text string) string { return "[" + text + "](" + link + ")" } diff --git a/internal/gitutil/error.go b/internal/gitutil/error.go index 20aa3b51..205546aa 100644 --- a/internal/gitutil/error.go +++ b/internal/gitutil/error.go @@ -20,7 +20,6 @@ type Error struct { func (e Error) NotFound() bool { return IsErrSubmoduleNotExist(e.error) || IsErrRevisionNotExist(e.error) - } // NewError wraps given error. diff --git a/internal/process/manager.go b/internal/process/manager.go index 274e63df..042486a5 100644 --- a/internal/process/manager.go +++ b/internal/process/manager.go @@ -15,9 +15,7 @@ import ( log "unknwon.dev/clog/v2" ) -var ( - ErrExecTimeout = errors.New("process execution timeout") -) +var ErrExecTimeout = errors.New("process execution timeout") const DEFAULT_TIMEOUT = 60 * time.Second @@ -41,8 +39,10 @@ func (c *pidCounter) PID() int64 { return c.pid } -var counter = new(pidCounter) -var Processes []*Process +var ( + counter = new(pidCounter) + Processes []*Process +) // Add adds a process to global list and returns its PID. func Add(desc string, cmd *exec.Cmd) int64 { diff --git a/internal/route/lfs/route.go b/internal/route/lfs/route.go index ff1bd591..0fd9617b 100644 --- a/internal/route/lfs/route.go +++ b/internal/route/lfs/route.go @@ -27,7 +27,6 @@ func RegisterRoutes(r *macaron.Router) { r.Group("", func() { r.Post("/objects/batch", authorize(db.AccessModeRead), verifyAccept, verifyContentTypeJSON, serveBatch) r.Group("/objects/basic", func() { - basic := &basicHandler{ defaultStorage: lfsutil.Storage(conf.LFS.Storage), storagers: map[lfsutil.Storage]lfsutil.Storager{ diff --git a/internal/route/repo/pull.go b/internal/route/repo/pull.go index 88c452ab..68389532 100644 --- a/internal/route/repo/pull.go +++ b/internal/route/repo/pull.go @@ -553,7 +553,6 @@ func PrepareCompareDiff( meta *gitutil.PullRequestMeta, headBranch string, ) bool { - var ( repo = c.Repo.Repository err error |