fix errname linting issues

Rename error variables and types to follow errname linter conventions:
- Exported sentinels: ErrXxx
- Unexported sentinels: errXxx
- Exported error types: XxxError
- Unexported error types: xxxError

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-24 11:21:02 +00:00
parent dca59d52b6
commit fb2162c027
105 changed files with 285 additions and 280 deletions

View file

@ -45,7 +45,7 @@ var remoteRE = regexp.MustCompile(`(.+)\s+(.+)\s+\((push|fetch)\)`)
// rather than the last null byte in the entire string.
var commitLogRE = regexp.MustCompile(`(?m)^[0-9a-fA-F]{7,40}\x00.*?\x00[\S\s]*?\x00$`)
type errWithExitCode interface {
type withExitCodeError interface {
ExitCode() int
}
@ -704,7 +704,7 @@ func (c *Client) revParse(ctx context.Context, args ...string) ([]byte, error) {
func (c *Client) IsLocalGitRepo(ctx context.Context) (bool, error) {
_, err := c.GitDir(ctx)
if err != nil {
var execError errWithExitCode
var execError withExitCodeError
if errors.As(err, &execError) && execError.ExitCode() == 128 {
return false, nil
}
@ -860,7 +860,7 @@ func resolveGitPath() (string, error) {
if runtime.GOOS == "windows" {
programName = "Git for Windows"
}
return "", &NotInstalled{
return "", &NotInstalledError{
message: fmt.Sprintf("unable to find git executable in PATH; please install %s before retrying", programName),
err: err,
}

View file

@ -50,7 +50,7 @@ func (gc *Command) Output() ([]byte, error) {
// is not a method and so tests can't access it.
// THIS MEANS THAT TESTS WILL NOT CORRECTLY HAVE STDERR SET,
// but at least tests can get the exit code.
var exitErrorWithExitCode errWithExitCode
var exitErrorWithExitCode withExitCodeError
if errors.As(err, &exitErrorWithExitCode) {
ge.ExitCode = exitErrorWithExitCode.ExitCode()
}

View file

@ -8,16 +8,16 @@ import (
// ErrNotOnAnyBranch indicates that the user is in detached HEAD state.
var ErrNotOnAnyBranch = errors.New("git: not on any branch")
type NotInstalled struct {
type NotInstalledError struct {
message string
err error
}
func (e *NotInstalled) Error() string {
func (e *NotInstalledError) Error() string {
return e.message
}
func (e *NotInstalled) Unwrap() error {
func (e *NotInstalledError) Unwrap() error {
return e.err
}