diff options
Diffstat (limited to 'internal/db')
-rw-r--r-- | internal/db/issue.go | 6 | ||||
-rw-r--r-- | internal/db/milestone.go | 2 | ||||
-rw-r--r-- | internal/db/webhook_discord.go | 4 | ||||
-rw-r--r-- | internal/db/webhook_slack.go | 2 |
4 files changed, 6 insertions, 8 deletions
diff --git a/internal/db/issue.go b/internal/db/issue.go index d7726beb..fdcabf9b 100644 --- a/internal/db/issue.go +++ b/internal/db/issue.go @@ -21,9 +21,7 @@ import ( "gogs.io/gogs/internal/tool" ) -var ( - ErrMissingIssueNumber = errors.New("No issue number specified") -) +var ErrMissingIssueNumber = errors.New("No issue number specified") // Issue represents an issue or pull request of repository. type Issue struct { @@ -1346,7 +1344,7 @@ func GetUserIssueStats(repoID, userID int64, repoIDs []int64, filterMode FilterM } // GetRepoIssueStats returns number of open and closed repository issues by given filter mode. -func GetRepoIssueStats(repoID, userID int64, filterMode FilterMode, isPull bool) (numOpen int64, numClosed int64) { +func GetRepoIssueStats(repoID, userID int64, filterMode FilterMode, isPull bool) (numOpen, numClosed int64) { countSession := func(isClosed, isPull bool, repoID int64) *xorm.Session { sess := x.Where("issue.repo_id = ?", isClosed). And("is_pull = ?", isPull). diff --git a/internal/db/milestone.go b/internal/db/milestone.go index df059b30..035be6bf 100644 --- a/internal/db/milestone.go +++ b/internal/db/milestone.go @@ -216,7 +216,7 @@ func CountRepoClosedMilestones(repoID int64) int64 { } // MilestoneStats returns number of open and closed milestones of given repository. -func MilestoneStats(repoID int64) (open int64, closed int64) { +func MilestoneStats(repoID int64) (open, closed int64) { open, _ = x.Where("repo_id=? AND is_closed=?", repoID, false).Count(new(Milestone)) return open, CountRepoClosedMilestones(repoID) } diff --git a/internal/db/webhook_discord.go b/internal/db/webhook_discord.go index f149b11e..cde19707 100644 --- a/internal/db/webhook_discord.go +++ b/internal/db/webhook_discord.go @@ -61,11 +61,11 @@ func DiscordTextFormatter(s string) string { return strings.Split(s, "\n")[0] } -func DiscordLinkFormatter(url string, text string) string { +func DiscordLinkFormatter(url, text string) string { return fmt.Sprintf("[%s](%s)", text, url) } -func DiscordSHALinkFormatter(url string, text string) string { +func DiscordSHALinkFormatter(url, text string) string { return fmt.Sprintf("[`%s`](%s)", text, url) } diff --git a/internal/db/webhook_slack.go b/internal/db/webhook_slack.go index a42fb8d8..289bcb28 100644 --- a/internal/db/webhook_slack.go +++ b/internal/db/webhook_slack.go @@ -66,7 +66,7 @@ func SlackShortTextFormatter(s string) string { return s } -func SlackLinkFormatter(url string, text string) string { +func SlackLinkFormatter(url, text string) string { return fmt.Sprintf("<%s|%s>", url, SlackTextFormatter(text)) } |