You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +02:00 
			
		
		
		
	fix: many linting issues
refs #3874 Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
		| @@ -68,12 +68,12 @@ func NewGitea(ctx *context.Context, token string) (Client, error) { | ||||
| 	return &giteaClient{client: client}, nil | ||||
| } | ||||
|  | ||||
| func (c *giteaClient) Changelog(ctx *context.Context, repo Repo, prev, current string) (string, error) { | ||||
| func (c *giteaClient) Changelog(_ *context.Context, _ Repo, _, _ string) (string, error) { | ||||
| 	return "", ErrNotImplemented | ||||
| } | ||||
|  | ||||
| // CloseMilestone closes a given milestone. | ||||
| func (c *giteaClient) CloseMilestone(ctx *context.Context, repo Repo, title string) error { | ||||
| func (c *giteaClient) CloseMilestone(_ *context.Context, repo Repo, title string) error { | ||||
| 	closedState := gitea.StateClosed | ||||
| 	opts := gitea.EditMilestoneOption{ | ||||
| 		State: &closedState, | ||||
| @@ -87,7 +87,7 @@ func (c *giteaClient) CloseMilestone(ctx *context.Context, repo Repo, title stri | ||||
| 	return err | ||||
| } | ||||
|  | ||||
| func (c *giteaClient) GetDefaultBranch(ctx *context.Context, repo Repo) (string, error) { | ||||
| func (c *giteaClient) GetDefaultBranch(_ *context.Context, repo Repo) (string, error) { | ||||
| 	projectID := repo.String() | ||||
| 	p, res, err := c.client.GetRepo(repo.Owner, repo.Name) | ||||
| 	if err != nil { | ||||
|   | ||||
| @@ -58,7 +58,7 @@ func NewGitLab(ctx *context.Context, token string) (Client, error) { | ||||
| 	return &gitlabClient{client: client}, nil | ||||
| } | ||||
|  | ||||
| func (c *gitlabClient) Changelog(ctx *context.Context, repo Repo, prev, current string) (string, error) { | ||||
| func (c *gitlabClient) Changelog(_ *context.Context, repo Repo, prev, current string) (string, error) { | ||||
| 	cmpOpts := &gitlab.CompareOptions{ | ||||
| 		From: &prev, | ||||
| 		To:   ¤t, | ||||
| @@ -82,7 +82,7 @@ func (c *gitlabClient) Changelog(ctx *context.Context, repo Repo, prev, current | ||||
| } | ||||
|  | ||||
| // GetDefaultBranch get the default branch | ||||
| func (c *gitlabClient) GetDefaultBranch(ctx *context.Context, repo Repo) (string, error) { | ||||
| func (c *gitlabClient) GetDefaultBranch(_ *context.Context, repo Repo) (string, error) { | ||||
| 	projectID := repo.String() | ||||
| 	p, res, err := c.client.Projects.GetProject(projectID, nil) | ||||
| 	if err != nil { | ||||
| @@ -97,7 +97,7 @@ func (c *gitlabClient) GetDefaultBranch(ctx *context.Context, repo Repo) (string | ||||
| } | ||||
|  | ||||
| // CloseMilestone closes a given milestone. | ||||
| func (c *gitlabClient) CloseMilestone(ctx *context.Context, repo Repo, title string) error { | ||||
| func (c *gitlabClient) CloseMilestone(_ *context.Context, repo Repo, title string) error { | ||||
| 	milestone, err := c.getMilestoneByTitle(repo, title) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
|   | ||||
| @@ -40,14 +40,14 @@ type Mock struct { | ||||
| 	ReleaseNotesParams   []string | ||||
| } | ||||
|  | ||||
| func (c *Mock) Changelog(ctx *context.Context, repo Repo, prev, current string) (string, error) { | ||||
| func (c *Mock) Changelog(_ *context.Context, _ Repo, _, _ string) (string, error) { | ||||
| 	if c.Changes != "" { | ||||
| 		return c.Changes, nil | ||||
| 	} | ||||
| 	return "", ErrNotImplemented | ||||
| } | ||||
|  | ||||
| func (c *Mock) GenerateReleaseNotes(ctx *context.Context, repo Repo, prev, current string) (string, error) { | ||||
| func (c *Mock) GenerateReleaseNotes(_ *context.Context, _ Repo, prev, current string) (string, error) { | ||||
| 	if c.ReleaseNotes != "" { | ||||
| 		c.ReleaseNotesParams = []string{prev, current} | ||||
| 		return c.ReleaseNotes, nil | ||||
| @@ -55,7 +55,7 @@ func (c *Mock) GenerateReleaseNotes(ctx *context.Context, repo Repo, prev, curre | ||||
| 	return "", ErrNotImplemented | ||||
| } | ||||
|  | ||||
| func (c *Mock) CloseMilestone(ctx *context.Context, repo Repo, title string) error { | ||||
| func (c *Mock) CloseMilestone(_ *context.Context, _ Repo, title string) error { | ||||
| 	if c.FailToCloseMilestone { | ||||
| 		return errors.New("milestone failed") | ||||
| 	} | ||||
| @@ -65,11 +65,11 @@ func (c *Mock) CloseMilestone(ctx *context.Context, repo Repo, title string) err | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (c *Mock) GetDefaultBranch(ctx *context.Context, repo Repo) (string, error) { | ||||
| func (c *Mock) GetDefaultBranch(_ *context.Context, _ Repo) (string, error) { | ||||
| 	return "", ErrNotImplemented | ||||
| } | ||||
|  | ||||
| func (c *Mock) CreateRelease(ctx *context.Context, body string) (string, error) { | ||||
| func (c *Mock) CreateRelease(_ *context.Context, _ string) (string, error) { | ||||
| 	if c.FailToCreateRelease { | ||||
| 		return "", errors.New("release failed") | ||||
| 	} | ||||
| @@ -77,18 +77,18 @@ func (c *Mock) CreateRelease(ctx *context.Context, body string) (string, error) | ||||
| 	return "", nil | ||||
| } | ||||
|  | ||||
| func (c *Mock) ReleaseURLTemplate(ctx *context.Context) (string, error) { | ||||
| func (c *Mock) ReleaseURLTemplate(_ *context.Context) (string, error) { | ||||
| 	return "https://dummyhost/download/{{ .Tag }}/{{ .ArtifactName }}", nil | ||||
| } | ||||
|  | ||||
| func (c *Mock) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo Repo, content []byte, path, msg string) error { | ||||
| func (c *Mock) CreateFile(_ *context.Context, _ config.CommitAuthor, _ Repo, content []byte, path, _ string) error { | ||||
| 	c.CreatedFile = true | ||||
| 	c.Content = string(content) | ||||
| 	c.Path = path | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (c *Mock) Upload(ctx *context.Context, releaseID string, artifact *artifact.Artifact, file *os.File) error { | ||||
| func (c *Mock) Upload(_ *context.Context, _ string, artifact *artifact.Artifact, file *os.File) error { | ||||
| 	c.Lock.Lock() | ||||
| 	defer c.Lock.Unlock() | ||||
| 	if c.UploadedFilePaths == nil { | ||||
|   | ||||
| @@ -63,13 +63,13 @@ func copyFile(src, dst string, mode os.FileMode) error { | ||||
| 	} | ||||
| 	defer original.Close() | ||||
|  | ||||
| 	new, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode) | ||||
| 	f, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("failed to open '%s': %w", dst, err) | ||||
| 	} | ||||
| 	defer new.Close() | ||||
| 	defer f.Close() | ||||
|  | ||||
| 	if _, err := io.Copy(new, original); err != nil { | ||||
| 	if _, err := io.Copy(f, original); err != nil { | ||||
| 		return fmt.Errorf("failed to copy: %w", err) | ||||
| 	} | ||||
| 	return nil | ||||
|   | ||||
| @@ -122,10 +122,7 @@ func (Pipe) Run(ctx *context.Context) error { | ||||
| 				continue | ||||
| 			} | ||||
| 			g.Go(func() error { | ||||
| 				if err := create(ctx, archive, artifacts); err != nil { | ||||
| 					return err | ||||
| 				} | ||||
| 				return nil | ||||
| 				return create(ctx, archive, artifacts) | ||||
| 			}) | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
| @@ -34,7 +34,7 @@ func (f *fakeBuilder) WithDefaults(build config.Build) (config.Build, error) { | ||||
| 	return build, nil | ||||
| } | ||||
|  | ||||
| func (f *fakeBuilder) Build(ctx *context.Context, build config.Build, options api.Options) error { | ||||
| func (f *fakeBuilder) Build(ctx *context.Context, _ config.Build, options api.Options) error { | ||||
| 	if f.fail { | ||||
| 		return errFailedBuild | ||||
| 	} | ||||
| @@ -90,8 +90,7 @@ func TestBuild(t *testing.T) { | ||||
| 	) | ||||
| 	opts, err := buildOptionsForTarget(ctx, ctx.Config.Builds[0], "darwin_amd64") | ||||
| 	require.NoError(t, err) | ||||
| 	error := doBuild(ctx, ctx.Config.Builds[0], *opts) | ||||
| 	require.NoError(t, error) | ||||
| 	require.NoError(t, doBuild(ctx, ctx.Config.Builds[0], *opts)) | ||||
| } | ||||
|  | ||||
| func TestRunPipe(t *testing.T) { | ||||
|   | ||||
| @@ -30,9 +30,9 @@ var cmd cmder = stdCmd{} | ||||
| // Pipe for chocolatey packaging. | ||||
| type Pipe struct{} | ||||
|  | ||||
| func (Pipe) String() string                             { return "chocolatey packages" } | ||||
| func (Pipe) Skip(ctx *context.Context) bool             { return len(ctx.Config.Chocolateys) == 0 } | ||||
| func (Pipe) Dependencies(ctx *context.Context) []string { return []string{"choco"} } | ||||
| func (Pipe) String() string                           { return "chocolatey packages" } | ||||
| func (Pipe) Skip(ctx *context.Context) bool           { return len(ctx.Config.Chocolateys) == 0 } | ||||
| func (Pipe) Dependencies(_ *context.Context) []string { return []string{"choco"} } | ||||
|  | ||||
| // Default sets the pipe defaults. | ||||
| func (Pipe) Default(ctx *context.Context) error { | ||||
|   | ||||
| @@ -311,6 +311,6 @@ type fakeCmd struct { | ||||
|  | ||||
| var _ cmder = fakeCmd{} | ||||
|  | ||||
| func (f fakeCmd) Exec(ctx *context.Context, name string, args ...string) ([]byte, error) { | ||||
| func (f fakeCmd) Exec(_ *context.Context, _ string, _ ...string) ([]byte, error) { | ||||
| 	return f.execFn() | ||||
| } | ||||
|   | ||||
| @@ -51,7 +51,7 @@ type dockerImager struct { | ||||
|  | ||||
| var dockerDigestPattern = regexp.MustCompile("sha256:[a-z0-9]{64}") | ||||
|  | ||||
| func (i dockerImager) Push(ctx *context.Context, image string, flags []string) (string, error) { | ||||
| func (i dockerImager) Push(ctx *context.Context, image string, _ []string) (string, error) { | ||||
| 	bts, err := runCommandWithOutput(ctx, ".", "docker", "push", image) | ||||
| 	if err != nil { | ||||
| 		return "", fmt.Errorf("failed to push %s: %w", image, err) | ||||
|   | ||||
| @@ -15,8 +15,8 @@ import ( | ||||
| // Pipe implementation. | ||||
| type Pipe struct{} | ||||
|  | ||||
| func (Pipe) String() string                 { return "storing release metadata" } | ||||
| func (Pipe) Skip(ctx *context.Context) bool { return false } | ||||
| func (Pipe) String() string               { return "storing release metadata" } | ||||
| func (Pipe) Skip(_ *context.Context) bool { return false } | ||||
|  | ||||
| // Run the pipe. | ||||
| func (Pipe) Run(ctx *context.Context) error { | ||||
|   | ||||
| @@ -99,9 +99,9 @@ const defaultNameTemplate = `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arc | ||||
| // Pipe for snapcraft packaging. | ||||
| type Pipe struct{} | ||||
|  | ||||
| func (Pipe) String() string                             { return "snapcraft packages" } | ||||
| func (Pipe) Skip(ctx *context.Context) bool             { return len(ctx.Config.Snapcrafts) == 0 } | ||||
| func (Pipe) Dependencies(ctx *context.Context) []string { return []string{"snapcraft"} } | ||||
| func (Pipe) String() string                           { return "snapcraft packages" } | ||||
| func (Pipe) Skip(ctx *context.Context) bool           { return len(ctx.Config.Snapcrafts) == 0 } | ||||
| func (Pipe) Dependencies(_ *context.Context) []string { return []string{"snapcraft"} } | ||||
|  | ||||
| // Default sets the pipe defaults. | ||||
| func (Pipe) Default(ctx *context.Context) error { | ||||
|   | ||||
| @@ -14,7 +14,7 @@ func (*dummy) WithDefaults(build config.Build) (config.Build, error) { | ||||
| 	return build, nil | ||||
| } | ||||
|  | ||||
| func (*dummy) Build(ctx *context.Context, build config.Build, options Options) error { | ||||
| func (*dummy) Build(_ *context.Context, _ config.Build, _ Options) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -36,7 +36,7 @@ nfpms: | ||||
|  | ||||
| type errorReader struct{} | ||||
|  | ||||
| func (errorReader) Read(p []byte) (n int, err error) { | ||||
| func (errorReader) Read(_ []byte) (n int, err error) { | ||||
| 	return 1, fmt.Errorf("error") | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -36,5 +36,5 @@ var Healthcheckers = []Healthchecker{ | ||||
|  | ||||
| type system struct{} | ||||
|  | ||||
| func (system) String() string                             { return "system" } | ||||
| func (system) Dependencies(ctx *context.Context) []string { return []string{"git", "go"} } | ||||
| func (system) String() string                           { return "system" } | ||||
| func (system) Dependencies(_ *context.Context) []string { return []string{"git", "go"} } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user