Skip to content

Commit 18dc4f1

Browse files
authored
golint fixed for routers/repo/view.go (#205)
1 parent 1d9576d commit 18dc4f1

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

routers/repo/view.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import (
2525
)
2626

2727
const (
28-
HOME base.TplName = "repo/home"
29-
WATCHERS base.TplName = "repo/watchers"
30-
FORKS base.TplName = "repo/forks"
28+
tplRepoHome base.TplName = "repo/home"
29+
tplWatchers base.TplName = "repo/watchers"
30+
tplForks base.TplName = "repo/forks"
3131
)
3232

3333
func renderDirectory(ctx *context.Context, treeLink string) {
@@ -212,6 +212,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
212212
}
213213
}
214214

215+
// Home render repository home page
215216
func Home(ctx *context.Context) {
216217
title := ctx.Repo.Repository.Owner.Name + "/" + ctx.Repo.Repository.Name
217218
if len(ctx.Repo.Repository.Description) > 0 {
@@ -263,9 +264,10 @@ func Home(ctx *context.Context) {
263264
ctx.Data["TreeLink"] = treeLink
264265
ctx.Data["TreeNames"] = treeNames
265266
ctx.Data["BranchLink"] = branchLink
266-
ctx.HTML(200, HOME)
267+
ctx.HTML(200, tplRepoHome)
267268
}
268269

270+
// RenderUserCards render a page show users accroding the input templaet
269271
func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*models.User, error), tpl base.TplName) {
270272
page := ctx.QueryInt("page")
271273
if page <= 0 {
@@ -284,20 +286,23 @@ func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*
284286
ctx.HTML(200, tpl)
285287
}
286288

289+
// Watchers render repository's watch users
287290
func Watchers(ctx *context.Context) {
288291
ctx.Data["Title"] = ctx.Tr("repo.watchers")
289292
ctx.Data["CardsTitle"] = ctx.Tr("repo.watchers")
290293
ctx.Data["PageIsWatchers"] = true
291-
RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, WATCHERS)
294+
RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, tplWatchers)
292295
}
293296

297+
// Stars render repository's starred users
294298
func Stars(ctx *context.Context) {
295299
ctx.Data["Title"] = ctx.Tr("repo.stargazers")
296300
ctx.Data["CardsTitle"] = ctx.Tr("repo.stargazers")
297301
ctx.Data["PageIsStargazers"] = true
298-
RenderUserCards(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers, WATCHERS)
302+
RenderUserCards(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers, tplWatchers)
299303
}
300304

305+
// Forks render repository's forked users
301306
func Forks(ctx *context.Context) {
302307
ctx.Data["Title"] = ctx.Tr("repos.forks")
303308

@@ -315,5 +320,5 @@ func Forks(ctx *context.Context) {
315320
}
316321
ctx.Data["Forks"] = forks
317322

318-
ctx.HTML(200, FORKS)
323+
ctx.HTML(200, tplForks)
319324
}

0 commit comments

Comments
 (0)