fix: lint

This commit is contained in:
kolaente 2023-10-10 20:35:43 +02:00
parent c9aec495d5
commit 56625b0b90
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
11 changed files with 31 additions and 31 deletions

View File

@ -141,7 +141,7 @@ steps:
commands:
- export "GOROOT=$(go env GOROOT)"
- apk --no-cache add build-base git
- wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.2
- wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2
- ./mage-static check:golangci
when:
event: [ push, tag, pull_request ]
@ -778,6 +778,6 @@ steps:
- failure
---
kind: signature
hmac: 3730982b2093ed0d6cc0ad7e98ef3234a0d8cf178d96c70d33690a0bf6d22444
hmac: a7c33fa559ad88a556ce903cd6df3d8ffe0d6fc2e3cdefe0da0d22049f9bb7f8
...

View File

@ -412,7 +412,7 @@ func checkGolangCiLintInstalled() {
mg.Deps(initVars)
if err := exec.Command("golangci-lint").Run(); err != nil && strings.Contains(err.Error(), "executable file not found") {
fmt.Println("Please manually install golangci-lint by running")
fmt.Println("curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.2")
fmt.Println("curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2")
os.Exit(1)
}
}

View File

@ -403,8 +403,8 @@ func (ltb *LabelTaskBulk) Create(s *xorm.Session, a web.Auth) (err error) {
if err != nil {
return err
}
for _, l := range labels {
task.Labels = append(task.Labels, &l.Label)
for i := range labels {
task.Labels = append(task.Labels, &labels[i].Label)
}
return task.UpdateTaskLabels(s, a, ltb.Labels)
}

View File

@ -210,8 +210,8 @@ func (tl *TeamProject) ReadAll(s *xorm.Session, a web.Auth, search string, page
}
teams := []*Team{}
for _, t := range all {
teams = append(teams, &t.Team)
for i := range all {
teams = append(teams, &all[i].Team)
}
err = addMoreInfoToTeams(s, teams)

View File

@ -217,7 +217,7 @@ func (lu *ProjectUser) ReadAll(s *xorm.Session, a web.Auth, search string, page
// Obfuscate all user emails
for _, u := range all {
u.Email = ""
u.User.Email = ""
}
numberOfTotalItems, err = s.

View File

@ -72,8 +72,8 @@ func (t *Task) updateTaskAssignees(s *xorm.Session, assignees []*user.User, doer
}
t.Assignees = make([]*user.User, 0, len(currentAssignees))
for _, assignee := range currentAssignees {
t.Assignees = append(t.Assignees, &assignee.User)
for i := range currentAssignees {
t.Assignees = append(t.Assignees, &currentAssignees[i].User)
}
// If we don't have any new assignees, delete everything right away. Saves us some hassle.
@ -349,8 +349,8 @@ func (ba *BulkAssignees) Create(s *xorm.Session, a web.Auth) (err error) {
if err != nil {
return err
}
for _, a := range assignees {
task.Assignees = append(task.Assignees, &a.User)
for i := range assignees {
task.Assignees = append(task.Assignees, &assignees[i].User)
}
err = task.updateTaskAssignees(s, ba.Assignees, a)

View File

@ -117,10 +117,10 @@ func getTaskUsersForTasks(s *xorm.Session, taskIDs []int64, cond builder.Cond) (
return
}
for _, assignee := range assignees {
for i := range assignees {
taskUsers = append(taskUsers, &taskUser{
Task: taskMap[assignee.TaskID],
User: &assignee.User,
Task: taskMap[assignees[i].TaskID],
User: &assignees[i].User,
})
}

View File

@ -417,10 +417,10 @@ func addAssigneesToTasks(s *xorm.Session, taskIDs []int64, taskMap map[int64]*Ta
return
}
// Put the assignees in the task map
for _, a := range taskAssignees {
for i, a := range taskAssignees {
if a != nil {
a.Email = "" // Obfuscate the email
taskMap[a.TaskID].Assignees = append(taskMap[a.TaskID].Assignees, &a.User)
a.User.Email = "" // Obfuscate the email
taskMap[a.TaskID].Assignees = append(taskMap[a.TaskID].Assignees, &taskAssignees[i].User)
}
}
@ -436,9 +436,9 @@ func addLabelsToTasks(s *xorm.Session, taskIDs []int64, taskMap map[int64]*Task)
if err != nil {
return
}
for _, l := range labels {
for i, l := range labels {
if l != nil {
taskMap[l.TaskID].Labels = append(taskMap[l.TaskID].Labels, &l.Label)
taskMap[l.TaskID].Labels = append(taskMap[l.TaskID].Labels, &labels[i].Label)
}
}

View File

@ -159,7 +159,7 @@ func addMoreInfoToTeams(s *xorm.Session, teams []*Team) (err error) {
if _, exists := teamMap[u.TeamID]; !exists {
continue
}
u.Email = ""
u.User.Email = ""
teamMap[u.TeamID].Members = append(teamMap[u.TeamID].Members, u)
}

View File

@ -55,7 +55,7 @@ func insertFromStructure(s *xorm.Session, str []*models.ProjectWithTasksAndBucke
childRelations := make(map[int64][]int64) // old id is the key, slice of old children ids
projectsByOldID := make(map[int64]*models.Project) // old id is the key
// Create all projects
for _, p := range str {
for i, p := range str {
oldID := p.ID
if p.ParentProjectID != 0 {
@ -67,7 +67,7 @@ func insertFromStructure(s *xorm.Session, str []*models.ProjectWithTasksAndBucke
if err != nil {
return err
}
projectsByOldID[oldID] = &p.Project
projectsByOldID[oldID] = &str[i].Project
}
// parent / child relations
@ -198,8 +198,8 @@ func createProjectWithEverything(s *xorm.Session, project *models.ProjectWithTas
tasksByOldID := make(map[int64]*models.TaskWithComments, len(tasks))
// Create all tasks
for _, t := range tasks {
setBucketOrDefault(&t.Task)
for i, t := range tasks {
setBucketOrDefault(&tasks[i].Task)
oldid := t.ID
t.ProjectID = project.ID

View File

@ -171,14 +171,14 @@ func (vcls *VikunjaCaldavProjectStorage) GetResourcesByFilters(rpath string, _ *
// That project is coming from a previous "getProjectRessource" in L177
if vcls.project.Tasks != nil {
var resources []data.Resource
for _, t := range vcls.project.Tasks {
for i := range vcls.project.Tasks {
rr := VikunjaProjectResourceAdapter{
project: vcls.project,
task: &t.Task,
task: &vcls.project.Tasks[i].Task,
isCollection: false,
}
r := data.NewResource(getTaskURL(&t.Task), &rr)
r.Name = t.Title
r := data.NewResource(getTaskURL(&vcls.project.Tasks[i].Task), &rr)
r.Name = vcls.project.Tasks[i].Title
resources = append(resources, r)
}
return resources, nil
@ -410,8 +410,8 @@ func persistLabels(s *xorm.Session, a web.Auth, task *models.Task, labels []*mod
}
labelMap := make(map[string]*models.Label)
for _, l := range existingLabels {
labelMap[l.Title] = &l.Label
for i := range existingLabels {
labelMap[existingLabels[i].Title] = &existingLabels[i].Label
}
for _, label := range labels {