Fix golangci-lint warnings (#17598 et al) (#17668)

Backport #17598 
Backport #17606 
Backport #17608 
Backport #17609

- Since https://gitea.com/gitea/test-env/pulls/10 the golangci-lint has been upgraded and is erroring about new warnings in the code, this PR fixes those warnings.
This commit is contained in:
Gusted 2021-11-16 20:38:49 +00:00 committed by GitHub
parent 1cec7f5ab5
commit ea0fe83888
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
96 changed files with 139 additions and 64 deletions

View file

@ -217,11 +217,9 @@ func newRefsFromRefNames(refNames []byte) []git.Reference {
continue
}
refName := string(refNameBytes)
if strings.HasPrefix(refName, "tag: ") {
refName = strings.TrimPrefix(refName, "tag: ")
} else if strings.HasPrefix(refName, "HEAD -> ") {
refName = strings.TrimPrefix(refName, "HEAD -> ")
}
refName = strings.TrimPrefix(refName, "tag: ")
refName = strings.TrimPrefix(refName, "HEAD -> ")
refs = append(refs, git.Reference{
Name: refName,
})