mirror of
https://github.com/go-gitea/gitea.git
synced 2025-02-02 15:09:33 -05:00
chore: golang lint
This commit is contained in:
parent
bfe0fc1533
commit
ef4b3673dd
@ -16,14 +16,14 @@ import (
|
||||
type RunJobList []*RunJob
|
||||
|
||||
func (jobs RunJobList) GetRunIDs() []int64 {
|
||||
var runIDsMap = make(map[int64]struct{})
|
||||
runIDsMap := make(map[int64]struct{})
|
||||
for _, j := range jobs {
|
||||
if j.RunID == 0 {
|
||||
continue
|
||||
}
|
||||
runIDsMap[j.RunID] = struct{}{}
|
||||
}
|
||||
var runIDs = make([]int64, 0, len(runIDsMap))
|
||||
runIDs := make([]int64, 0, len(runIDsMap))
|
||||
for runID := range runIDsMap {
|
||||
runIDs = append(runIDs, runID)
|
||||
}
|
||||
|
@ -16,14 +16,14 @@ import (
|
||||
type TaskList []*Task
|
||||
|
||||
func (tasks TaskList) GetJobIDs() []int64 {
|
||||
var jobIDsMap = make(map[int64]struct{})
|
||||
jobIDsMap := make(map[int64]struct{})
|
||||
for _, t := range tasks {
|
||||
if t.JobID == 0 {
|
||||
continue
|
||||
}
|
||||
jobIDsMap[t.JobID] = struct{}{}
|
||||
}
|
||||
var jobIDs = make([]int64, 0, len(jobIDsMap))
|
||||
jobIDs := make([]int64, 0, len(jobIDsMap))
|
||||
for jobID := range jobIDsMap {
|
||||
jobIDs = append(jobIDs, jobID)
|
||||
}
|
||||
|
@ -13,8 +13,9 @@ import (
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
func changeDefaultFileBlockSize(n int64) (restore func()) {
|
||||
|
@ -444,7 +444,6 @@ var migrations = []Migration{
|
||||
// v235 -> v236
|
||||
NewMigration("Add index for access_token", v1_19.AddIndexForAccessToken),
|
||||
|
||||
|
||||
// in dev
|
||||
NewMigration("Add bots tables", addBotTables),
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ func WriteLogs(ctx context.Context, filename string, offset int64, rows []*runne
|
||||
return ns, nil
|
||||
}
|
||||
|
||||
func ReadLogs(ctx context.Context, inStorage bool, filename string, offset int64, limit int64) ([]*runnerv1.LogRow, error) {
|
||||
func ReadLogs(ctx context.Context, inStorage bool, filename string, offset, limit int64) ([]*runnerv1.LogRow, error) {
|
||||
f, err := openLogs(ctx, inStorage, filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -180,7 +180,7 @@ func (a *botsNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_m
|
||||
}
|
||||
|
||||
func (a *botsNotifier) NotifyIssueChangeLabels(ctx context.Context, doer *user_model.User, issue *issues_model.Issue,
|
||||
addedLabels []*issues_model.Label, removedLabels []*issues_model.Label,
|
||||
_, _ []*issues_model.Label,
|
||||
) {
|
||||
var err error
|
||||
if err = issue.LoadRepo(ctx); err != nil {
|
||||
@ -288,7 +288,7 @@ func (a *botsNotifier) NotifyRenameRepository(ctx context.Context, doer *user_mo
|
||||
func (a *botsNotifier) NotifyTransferRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldOwnerName string) {
|
||||
}
|
||||
|
||||
func (a *botsNotifier) NotifyCreateRepository(ctx context.Context, doer *user_model.User, u *user_model.User, repo *repo_model.Repository) {
|
||||
func (a *botsNotifier) NotifyCreateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) {
|
||||
if err := notify(repo, doer, repo.DefaultBranch,
|
||||
webhook.HookEventRepository,
|
||||
&api.RepositoryPayload{
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
|
||||
// RunnersList render common runners list page
|
||||
func RunnersList(ctx *context.Context, tplName base.TplName, opts bots_model.FindRunnerOptions) {
|
||||
|
||||
count, err := bots_model.CountRunners(opts)
|
||||
if err != nil {
|
||||
ctx.ServerError("AdminRunners", err)
|
||||
@ -65,7 +64,7 @@ func RunnersList(ctx *context.Context, tplName base.TplName, opts bots_model.Fin
|
||||
}
|
||||
|
||||
// RunnerDetails render runner details page
|
||||
func RunnerDetails(ctx *context.Context, tplName base.TplName, page int, runnerID int64, ownerID int64, repoID int64) {
|
||||
func RunnerDetails(ctx *context.Context, tplName base.TplName, page int, runnerID, ownerID, repoID int64) {
|
||||
runner, err := bots_model.GetRunnerByID(runnerID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetRunnerByID", err)
|
||||
@ -117,7 +116,7 @@ func RunnerDetails(ctx *context.Context, tplName base.TplName, page int, runnerI
|
||||
}
|
||||
|
||||
// RunnerDetailsEditPost response for edit runner details
|
||||
func RunnerDetailsEditPost(ctx *context.Context, runnerID int64, ownerID int64, repoID int64, redirectTo string) {
|
||||
func RunnerDetailsEditPost(ctx *context.Context, runnerID, ownerID, repoID int64, redirectTo string) {
|
||||
runner, err := bots_model.GetRunnerByID(runnerID)
|
||||
if err != nil {
|
||||
log.Warn("RunnerDetailsEditPost.GetRunnerByID failed: %v, url: %s", err, ctx.Req.URL)
|
||||
@ -162,7 +161,8 @@ func RunnerResetRegistrationToken(ctx *context.Context, ownerID, repoID int64, r
|
||||
|
||||
// RunnerDeletePost response for deleting a runner
|
||||
func RunnerDeletePost(ctx *context.Context, runnerID int64,
|
||||
successRedirectTo, failedRedirectTo string) {
|
||||
successRedirectTo, failedRedirectTo string,
|
||||
) {
|
||||
runner, err := bots_model.GetRunnerByID(runnerID)
|
||||
if err != nil {
|
||||
log.Warn("DeleteRunnerPost.GetRunnerByID failed: %v, url: %s", err, ctx.Req.URL)
|
||||
|
@ -967,7 +967,6 @@ func RegisterRoutes(m *web.Route) {
|
||||
m.Post("/{runnerid}/delete", repo.RunnerDeletePost)
|
||||
m.Get("/reset_registration_token", repo.ResetRunnerRegistrationToken)
|
||||
})
|
||||
|
||||
}, func(ctx *context.Context) {
|
||||
ctx.Data["PageIsSettings"] = true
|
||||
ctx.Data["LFSStartServer"] = setting.LFS.StartServer
|
||||
|
@ -16,7 +16,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="issue-item-right">
|
||||
<div>{{ TimeSinceUnix .Updated $.locale }}</div>
|
||||
<div>{{TimeSinceUnix .Updated $.locale}}</div>
|
||||
<div>{{.TakeTime}}</div>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -183,7 +183,7 @@
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
{{ if and (not .UnitBotsGlobalDisabled) (.Permission.CanRead $.UnitTypeBots)}}
|
||||
{{if and (not .UnitBotsGlobalDisabled) (.Permission.CanRead $.UnitTypeBots)}}
|
||||
<a class="{{if .PageIsBots}}active{{end}} item" href="{{.RepoLink}}/bots">
|
||||
{{svg "octicon-play"}} {{.locale.Tr "repo.bots"}}
|
||||
{{if .Repository.NumOpenRuns}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user