mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Run gopls modernize
on codebase (#34751)
Recent modernize fixes: https://github.com/golang/tools/commits/master/gopls/internal/analysis/modernize
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"path"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -203,13 +204,7 @@ func ChangeRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use
|
||||
}
|
||||
|
||||
// Find the file we want to delete in the index
|
||||
inFilelist := false
|
||||
for _, indexFile := range filesInIndex {
|
||||
if indexFile == file.TreePath {
|
||||
inFilelist = true
|
||||
break
|
||||
}
|
||||
}
|
||||
inFilelist := slices.Contains(filesInIndex, file.TreePath)
|
||||
if !inFilelist {
|
||||
return nil, ErrRepoFileDoesNotExist{
|
||||
Path: file.TreePath,
|
||||
@@ -467,11 +462,9 @@ func CreateUpdateRenameFile(ctx context.Context, t *TemporaryUploadRepository, f
|
||||
}
|
||||
// If is a new file (not updating) then the given path shouldn't exist
|
||||
if file.Operation == "create" {
|
||||
for _, indexFile := range filesInIndex {
|
||||
if indexFile == file.TreePath {
|
||||
return ErrRepoFileAlreadyExists{
|
||||
Path: file.TreePath,
|
||||
}
|
||||
if slices.Contains(filesInIndex, file.TreePath) {
|
||||
return ErrRepoFileAlreadyExists{
|
||||
Path: file.TreePath,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user