diff options
author | deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> | 2022-03-06 17:55:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 17:55:17 +0800 |
commit | e452d94fc842da6623c8fde67b9d71a1ee739f0a (patch) | |
tree | e8e0c1c5206bed01f4634dc81ebcbf5af77f8d65 /internal/db | |
parent | 2466da4e82c3658cb9e05498961ad130e0467f0d (diff) |
autofix: format code with gofumpt and gofmt (#6803)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/db')
-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 |
3 files changed, 7 insertions, 6 deletions
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 + ")" } |