mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Enable addtional linters (#34085)
enable mirror, usestdlibbars and perfsprint part of: https://github.com/go-gitea/gitea/issues/34083 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@ package files
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -100,7 +101,7 @@ func CherryPick(ctx context.Context, repo *repo_model.Repository, doer *user_mod
|
||||
}
|
||||
|
||||
if conflict {
|
||||
return nil, fmt.Errorf("failed to merge due to conflicts")
|
||||
return nil, errors.New("failed to merge due to conflicts")
|
||||
}
|
||||
|
||||
treeHash, err := t.WriteTree(ctx)
|
||||
|
@@ -5,6 +5,7 @@ package files
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
@@ -62,10 +63,10 @@ func GetFileResponseFromFilesResponse(filesResponse *api.FilesResponse, index in
|
||||
// GetFileCommitResponse Constructs a FileCommitResponse from a Commit object
|
||||
func GetFileCommitResponse(repo *repo_model.Repository, commit *git.Commit) (*api.FileCommitResponse, error) {
|
||||
if repo == nil {
|
||||
return nil, fmt.Errorf("repo cannot be nil")
|
||||
return nil, errors.New("repo cannot be nil")
|
||||
}
|
||||
if commit == nil {
|
||||
return nil, fmt.Errorf("commit cannot be nil")
|
||||
return nil, errors.New("commit cannot be nil")
|
||||
}
|
||||
commitURL, _ := url.Parse(repo.APIURL() + "/git/commits/" + url.PathEscape(commit.ID.String()))
|
||||
commitTreeURL, _ := url.Parse(repo.APIURL() + "/git/trees/" + url.PathEscape(commit.Tree.ID.String()))
|
||||
|
@@ -6,6 +6,7 @@ package files
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -414,7 +415,7 @@ func (t *TemporaryUploadRepository) DiffIndex(ctx context.Context) (*gitdiff.Dif
|
||||
// GetBranchCommit Gets the commit object of the given branch
|
||||
func (t *TemporaryUploadRepository) GetBranchCommit(branch string) (*git.Commit, error) {
|
||||
if t.gitRepo == nil {
|
||||
return nil, fmt.Errorf("repository has not been cloned")
|
||||
return nil, errors.New("repository has not been cloned")
|
||||
}
|
||||
return t.gitRepo.GetBranchCommit(branch)
|
||||
}
|
||||
@@ -422,7 +423,7 @@ func (t *TemporaryUploadRepository) GetBranchCommit(branch string) (*git.Commit,
|
||||
// GetCommit Gets the commit object of the given commit ID
|
||||
func (t *TemporaryUploadRepository) GetCommit(commitID string) (*git.Commit, error) {
|
||||
if t.gitRepo == nil {
|
||||
return nil, fmt.Errorf("repository has not been cloned")
|
||||
return nil, errors.New("repository has not been cloned")
|
||||
}
|
||||
return t.gitRepo.GetCommit(commitID)
|
||||
}
|
||||
|
Reference in New Issue
Block a user