Fix all 93 lint-go errors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
silverwind
2026-02-23 13:59:05 +01:00
parent 09d18916bf
commit 1670945af3
33 changed files with 158 additions and 128 deletions

View File

@@ -170,8 +170,8 @@ func FindGithubRepo(ctx context.Context, file, githubInstance, remoteName string
if err != nil {
return "", err
}
_, slug, err := findGitSlug(url, githubInstance)
return slug, err
_, slug := findGitSlug(url, githubInstance)
return slug, nil
}
func findGitRemoteURL(_ context.Context, file, remoteName string) (string, error) {
@@ -213,23 +213,23 @@ func matchesRegex(url string, matchers ...findStringSubmatcher) []string {
}
// TODO deprecate and remove githubInstance parameter
func findGitSlug(url string, _ /* githubInstance */ string) (string, string, error) {
func findGitSlug(url string, _ /* githubInstance */ string) (string, string) {
if matches := matchesRegex(url, codeCommitHTTPRegex, codeCommitSSHRegex); matches != nil {
return "CodeCommit", matches[2], nil
return "CodeCommit", matches[2]
}
if matches := matchesRegex(url, githubHTTPRegex, githubSSHRegex); matches != nil {
return "GitHub", fmt.Sprintf("%s/%s", matches[1], matches[2]), nil
return "GitHub", fmt.Sprintf("%s/%s", matches[1], matches[2])
}
if matches := matchesRegex(url,
regexp.MustCompile(`^https?://(?:[^/]+)/([^/]+)/([^/]+)(?:.git)?$`),
regexp.MustCompile(`([^/]+)[:/]([^/]+)/([^/]+)(?:.git)?$`),
); matches != nil {
return "GitHubEnterprise", fmt.Sprintf("%s/%s", matches[1], matches[2]), nil
return "GitHubEnterprise", fmt.Sprintf("%s/%s", matches[1], matches[2])
}
return "", url, nil
return "", url
}
// NewGitCloneExecutorInput the input for the NewGitCloneExecutor

View File

@@ -38,19 +38,15 @@ func TestFindGitSlug(t *testing.T) {
}
for _, tt := range slugTests {
provider, slug, err := findGitSlug(tt.url, "github.com")
provider, slug := findGitSlug(tt.url, "github.com")
require.NoError(t, err)
assert.Equal(tt.provider, provider)
assert.Equal(tt.slug, slug)
}
}
func testDir(t *testing.T) string {
basedir, err := os.MkdirTemp("", "act-test")
require.NoError(t, err)
t.Cleanup(func() { _ = os.RemoveAll(basedir) })
return basedir
return t.TempDir()
}
func cleanGitHooks(dir string) error {