diff --git a/internal/middleware/error.go b/internal/middleware/error.go index 6cdf2cf32..f4d063cd4 100644 --- a/internal/middleware/error.go +++ b/internal/middleware/error.go @@ -10,10 +10,14 @@ import ( // errors. func ErrHandler(action Action) Action { return func(ctx *context.Context) error { - var err = action(ctx) + err := action(ctx) if err == nil { return nil } + if pipe.IsExpectedSkip(err) { + log.WithError(err).Debug("pipe skipped") + return nil + } if pipe.IsSkip(err) { log.WithError(err).Warn("pipe skipped") return nil diff --git a/internal/middleware/error_test.go b/internal/middleware/error_test.go index a92582d9e..dbbc7d4cb 100644 --- a/internal/middleware/error_test.go +++ b/internal/middleware/error_test.go @@ -17,6 +17,10 @@ func TestError(t *testing.T) { require.NoError(t, ErrHandler(mockAction(pipe.ErrSkipValidateEnabled))(ctx)) }) + t.Run("pipe expected skipped", func(t *testing.T) { + require.NoError(t, ErrHandler(mockAction(pipe.ErrSkipDisabledPipe))(ctx)) + }) + t.Run("some err", func(t *testing.T) { require.Error(t, ErrHandler(mockAction(fmt.Errorf("pipe errored")))(ctx)) }) diff --git a/internal/middleware/logging.go b/internal/middleware/logging.go index d4a945011..8cf3d4e5c 100644 --- a/internal/middleware/logging.go +++ b/internal/middleware/logging.go @@ -14,7 +14,7 @@ type Padding int const DefaultInitialPadding Padding = 3 // ExtraPadding is the double of the DefaultInitialPadding. -const ExtraPadding Padding = DefaultInitialPadding * 2 +const ExtraPadding = DefaultInitialPadding * 2 // Logging pretty prints the given action and its title. // You can have different padding levels by providing different initial diff --git a/internal/pipe/artifactory/artifactory.go b/internal/pipe/artifactory/artifactory.go index bf337ff6c..6fabecae8 100644 --- a/internal/pipe/artifactory/artifactory.go +++ b/internal/pipe/artifactory/artifactory.go @@ -36,7 +36,7 @@ func (Pipe) Default(ctx *context.Context) error { // Docs: https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-Example-DeployinganArtifact func (Pipe) Publish(ctx *context.Context) error { if len(ctx.Config.Artifactories) == 0 { - return pipe.Skip("artifactory section is not configured") + return pipe.ErrSkipDisabledPipe } // Check requirements for every instance we have configured. diff --git a/internal/pipe/blob/blob.go b/internal/pipe/blob/blob.go index 4276f6517..ef46cdb5a 100644 --- a/internal/pipe/blob/blob.go +++ b/internal/pipe/blob/blob.go @@ -36,10 +36,10 @@ func (Pipe) Default(ctx *context.Context) error { // Publish to specified blob bucket url. func (Pipe) Publish(ctx *context.Context) error { if len(ctx.Config.Blobs) == 0 { - return pipe.Skip("blobs section is not configured") + return pipe.ErrSkipDisabledPipe } - var g = semerrgroup.New(ctx.Parallelism) + g := semerrgroup.New(ctx.Parallelism) for _, conf := range ctx.Config.Blobs { conf := conf g.Go(func() error { diff --git a/internal/pipe/brew/brew.go b/internal/pipe/brew/brew.go index c62e0f103..1cdad59c1 100644 --- a/internal/pipe/brew/brew.go +++ b/internal/pipe/brew/brew.go @@ -63,9 +63,9 @@ func (Pipe) Publish(ctx *context.Context) error { func publishAll(ctx *context.Context, cli client.Client) error { // even if one of them skips, we run them all, and then show return the skips all at once. // this is needed so we actually create the `dist/foo.rb` file, which is useful for debugging. - var skips = pipe.SkipMemento{} + skips := pipe.SkipMemento{} for _, brew := range ctx.Config.Brews { - var err = doRun(ctx, brew, cli) + err := doRun(ctx, brew, cli) if err != nil && pipe.IsSkip(err) { skips.Remember(err) continue @@ -80,7 +80,7 @@ func publishAll(ctx *context.Context, cli client.Client) error { // Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { for i := range ctx.Config.Brews { - var brew = &ctx.Config.Brews[i] + brew := &ctx.Config.Brews[i] if brew.Install == "" { brew.Install = fmt.Sprintf(`bin.install "%s"`, ctx.Config.ProjectName) @@ -105,7 +105,7 @@ func (Pipe) Default(ctx *context.Context) error { func doRun(ctx *context.Context, brew config.Homebrew, cl client.Client) error { if brew.Tap.Name == "" { - return pipe.Skip("brew section is not configured") + return pipe.ErrSkipDisabledPipe } if brew.Tap.Token != "" { @@ -122,7 +122,7 @@ func doRun(ctx *context.Context, brew config.Homebrew, cl client.Client) error { } // TODO: properly cover this with tests - var filters = []artifact.Filter{ + filters := []artifact.Filter{ artifact.Or( artifact.ByGoos("darwin"), artifact.ByGoos("linux"), @@ -142,7 +142,7 @@ func doRun(ctx *context.Context, brew config.Homebrew, cl client.Client) error { filters = append(filters, artifact.ByIDs(brew.IDs...)) } - var archives = ctx.Artifacts.Filter(artifact.And(filters...)).List() + archives := ctx.Artifacts.Filter(artifact.And(filters...)).List() if len(archives) == 0 { return ErrNoArchivesFound } @@ -158,10 +158,10 @@ func doRun(ctx *context.Context, brew config.Homebrew, cl client.Client) error { return err } - var filename = brew.Name + ".rb" - var path = filepath.Join(ctx.Config.Dist, filename) + filename := brew.Name + ".rb" + path := filepath.Join(ctx.Config.Dist, filename) log.WithField("formula", path).Info("writing") - if err := ioutil.WriteFile(path, []byte(content), 0644); err != nil { //nolint: gosec + if err := ioutil.WriteFile(path, []byte(content), 0o644); err != nil { //nolint: gosec return fmt.Errorf("failed to write brew formula: %w", err) } @@ -177,12 +177,12 @@ func doRun(ctx *context.Context, brew config.Homebrew, cl client.Client) error { repo := client.RepoFromRef(brew.Tap) - var gpath = buildFormulaPath(brew.Folder, filename) + gpath := buildFormulaPath(brew.Folder, filename) log.WithField("formula", gpath). WithField("repo", repo.String()). Info("pushing") - var msg = fmt.Sprintf("Brew formula update for %s version %s", ctx.Config.ProjectName, ctx.Git.CurrentTag) + msg := fmt.Sprintf("Brew formula update for %s version %s", ctx.Config.ProjectName, ctx.Git.CurrentTag) return cl.CreateFile(ctx, brew.CommitAuthor, repo, []byte(content), gpath, msg) } @@ -232,7 +232,7 @@ func doBuildFormula(ctx *context.Context, data templateData) (string, error) { } func dataFor(ctx *context.Context, cfg config.Homebrew, cl client.Client, artifacts []*artifact.Artifact) (templateData, error) { - var result = templateData{ + result := templateData{ Name: formulaNameFor(cfg.Name), Desc: cfg.Description, Homepage: cfg.Homepage, @@ -270,7 +270,7 @@ func dataFor(ctx *context.Context, cfg config.Homebrew, cl client.Client, artifa if err != nil { return result, err } - var down = downloadable{ + down := downloadable{ DownloadURL: url, SHA256: sum, } diff --git a/internal/pipe/changelog/changelog.go b/internal/pipe/changelog/changelog.go index f9d72d8df..25779ce07 100644 --- a/internal/pipe/changelog/changelog.go +++ b/internal/pipe/changelog/changelog.go @@ -46,7 +46,7 @@ func (Pipe) Run(ctx *context.Context) error { ctx.ReleaseNotes = notes } if ctx.Config.Changelog.Skip { - return pipe.Skip("changelog should not be built") + return pipe.ErrSkipDisabledPipe } if ctx.Snapshot { return pipe.Skip("not available for snapshots") @@ -110,9 +110,9 @@ func (Pipe) Run(ctx *context.Context) error { ctx.ReleaseNotes += "\n" } - var path = filepath.Join(ctx.Config.Dist, "CHANGELOG.md") + path := filepath.Join(ctx.Config.Dist, "CHANGELOG.md") log.WithField("changelog", path).Info("writing") - return ioutil.WriteFile(path, []byte(ctx.ReleaseNotes), 0644) //nolint: gosec + return ioutil.WriteFile(path, []byte(ctx.ReleaseNotes), 0o644) //nolint: gosec } func loadFromFile(file string) (string, error) { @@ -140,7 +140,7 @@ func buildChangelog(ctx *context.Context) ([]string, error) { if err != nil { return nil, err } - var entries = strings.Split(log, "\n") + entries := strings.Split(log, "\n") entries = entries[0 : len(entries)-1] entries, err = filterEntries(ctx, entries) if err != nil { @@ -161,15 +161,15 @@ func filterEntries(ctx *context.Context, entries []string) ([]string, error) { } func sortEntries(ctx *context.Context, entries []string) []string { - var direction = ctx.Config.Changelog.Sort + direction := ctx.Config.Changelog.Sort if direction == "" { return entries } - var result = make([]string, len(entries)) + result := make([]string, len(entries)) copy(result, entries) sort.Slice(result, func(i, j int) bool { - var imsg = extractCommitInfo(result[i]) - var jmsg = extractCommitInfo(result[j]) + imsg := extractCommitInfo(result[i]) + jmsg := extractCommitInfo(result[j]) if direction == "asc" { return strings.Compare(imsg, jmsg) < 0 } @@ -203,7 +203,7 @@ func getChangelog(tag string) (string, error) { } func gitLog(refs ...string) (string, error) { - var args = []string{"log", "--pretty=oneline", "--abbrev-commit", "--no-decorate", "--no-color"} + args := []string{"log", "--pretty=oneline", "--abbrev-commit", "--no-decorate", "--no-color"} args = append(args, refs...) return git.Run(args...) } diff --git a/internal/pipe/checksums/checksums.go b/internal/pipe/checksums/checksums.go index a28eb47a9..03d1281c1 100644 --- a/internal/pipe/checksums/checksums.go +++ b/internal/pipe/checksums/checksums.go @@ -38,7 +38,7 @@ func (Pipe) Default(ctx *context.Context) error { // Run the pipe. func (Pipe) Run(ctx *context.Context) (err error) { if ctx.Config.Checksum.Disable { - return pipe.Skip("checksum.disable is set") + return pipe.ErrSkipDisabledPipe } filter := artifact.Or( artifact.ByType(artifact.UploadableArchive), @@ -55,7 +55,7 @@ func (Pipe) Run(ctx *context.Context) (err error) { return nil } - var g = semerrgroup.New(ctx.Parallelism) + g := semerrgroup.New(ctx.Parallelism) sumLines := make([]string, len(artifactList)) for i, artifact := range artifactList { i := i @@ -82,7 +82,7 @@ func (Pipe) Run(ctx *context.Context) (err error) { file, err := os.OpenFile( filepath.Join(ctx.Config.Dist, filename), os.O_APPEND|os.O_WRONLY|os.O_CREATE|os.O_TRUNC, - 0644, + 0o644, ) if err != nil { return err diff --git a/internal/pipe/checksums/checksums_test.go b/internal/pipe/checksums/checksums_test.go index fb0057ba7..82dd184ab 100644 --- a/internal/pipe/checksums/checksums_test.go +++ b/internal/pipe/checksums/checksums_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/goreleaser/goreleaser/internal/artifact" + "github.com/goreleaser/goreleaser/internal/pipe" "github.com/goreleaser/goreleaser/internal/testlib" "github.com/goreleaser/goreleaser/pkg/config" "github.com/goreleaser/goreleaser/pkg/context" @@ -114,7 +115,7 @@ func TestPipeSkipTrue(t *testing.T) { ) var err = Pipe{}.Run(ctx) testlib.AssertSkipped(t, err) - require.EqualError(t, err, `checksum.disable is set`) + require.EqualError(t, err, pipe.ErrSkipDisabledPipe.Error()) } func TestPipeFileNotExist(t *testing.T) { diff --git a/internal/pipe/custompublishers/custompublishers.go b/internal/pipe/custompublishers/custompublishers.go index b0b88dd29..f962f2741 100644 --- a/internal/pipe/custompublishers/custompublishers.go +++ b/internal/pipe/custompublishers/custompublishers.go @@ -18,7 +18,7 @@ func (Pipe) String() string { // Publish artifacts. func (Pipe) Publish(ctx *context.Context) error { if len(ctx.Config.Publishers) == 0 { - return pipe.Skip("publishers section is not configured") + return pipe.ErrSkipDisabledPipe } return exec.Execute(ctx, ctx.Config.Publishers) diff --git a/internal/pipe/docker/docker.go b/internal/pipe/docker/docker.go index 15dcd98e9..df2cf3a11 100644 --- a/internal/pipe/docker/docker.go +++ b/internal/pipe/docker/docker.go @@ -32,7 +32,7 @@ func (Pipe) String() string { // Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { for i := range ctx.Config.Dockers { - var docker = &ctx.Config.Dockers[i] + docker := &ctx.Config.Dockers[i] if docker.Goos == "" { docker.Goos = "linux" @@ -62,7 +62,7 @@ func (Pipe) Default(ctx *context.Context) error { // Run the pipe. func (Pipe) Run(ctx *context.Context) error { if len(ctx.Config.Dockers) == 0 || len(ctx.Config.Dockers[0].ImageTemplates) == 0 { - return pipe.Skip("docker section is not configured") + return pipe.ErrSkipDisabledPipe } _, err := exec.LookPath("docker") if err != nil { @@ -76,7 +76,7 @@ func (Pipe) Publish(ctx *context.Context) error { if ctx.SkipPublish { return pipe.ErrSkipPublishEnabled } - var images = ctx.Artifacts.Filter(artifact.ByType(artifact.PublishableDockerImage)).List() + images := ctx.Artifacts.Filter(artifact.ByType(artifact.PublishableDockerImage)).List() for _, image := range images { if err := dockerPush(ctx, image); err != nil { return err @@ -86,12 +86,12 @@ func (Pipe) Publish(ctx *context.Context) error { } func doRun(ctx *context.Context) error { - var g = semerrgroup.NewSkipAware(semerrgroup.New(ctx.Parallelism)) + g := semerrgroup.NewSkipAware(semerrgroup.New(ctx.Parallelism)) for _, docker := range ctx.Config.Dockers { docker := docker g.Go(func() error { log.WithField("docker", docker).Debug("looking for artifacts matching") - var filters = []artifact.Filter{ + filters := []artifact.Filter{ artifact.ByGoos(docker.Goos), artifact.ByGoarch(docker.Goarch), artifact.ByGoarm(docker.Goarm), @@ -103,7 +103,7 @@ func doRun(ctx *context.Context) error { if len(docker.IDs) > 0 { filters = append(filters, artifact.ByIDs(docker.IDs...)) } - var artifacts = ctx.Artifacts.Filter(artifact.And(filters...)) + artifacts := ctx.Artifacts.Filter(artifact.And(filters...)) log.WithField("artifacts", artifacts.Paths()).Debug("found artifacts") return process(ctx, docker, artifacts.List()) }) @@ -127,7 +127,7 @@ func process(ctx *context.Context, docker config.Docker, artifacts []*artifact.A return fmt.Errorf("failed to link dockerfile: %w", err) } for _, file := range docker.Files { - if err := os.MkdirAll(filepath.Join(tmp, filepath.Dir(file)), 0755); err != nil { + if err := os.MkdirAll(filepath.Join(tmp, filepath.Dir(file)), 0o755); err != nil { return fmt.Errorf("failed to link extra file '%s': %w", file, err) } if err := link(file, filepath.Join(tmp, file)); err != nil { @@ -217,7 +217,7 @@ func link(src, dest string) error { // - dest = "dist/linuxamd64/b" // - path = "a/b/c.txt" // So we join "a/b" with "c.txt" and use it as the destination. - var dst = filepath.Join(dest, strings.Replace(path, src, "", 1)) + dst := filepath.Join(dest, strings.Replace(path, src, "", 1)) log.WithFields(log.Fields{ "src": path, "dst": dst, @@ -232,7 +232,7 @@ func link(src, dest string) error { func dockerBuild(ctx *context.Context, root string, images, flags []string, buildx bool) error { log.WithField("image", images[0]).WithField("buildx", buildx).Info("building docker image") /* #nosec */ - var cmd = exec.CommandContext(ctx, "docker", buildCommand(buildx, images, flags)...) + cmd := exec.CommandContext(ctx, "docker", buildCommand(buildx, images, flags)...) cmd.Dir = root log.WithField("cmd", cmd.Args).WithField("cwd", cmd.Dir).Debug("running") out, err := cmd.CombinedOutput() @@ -258,7 +258,7 @@ func buildCommand(buildx bool, images, flags []string) []string { func dockerPush(ctx *context.Context, image *artifact.Artifact) error { log.WithField("image", image.Name).Info("pushing docker image") /* #nosec */ - var cmd = exec.CommandContext(ctx, "docker", "push", image.Name) + cmd := exec.CommandContext(ctx, "docker", "push", image.Name) log.WithField("cmd", cmd.Args).Debug("running") out, err := cmd.CombinedOutput() if err != nil { diff --git a/internal/pipe/gomod/gomod.go b/internal/pipe/gomod/gomod.go index 5562afa3d..36997622f 100644 --- a/internal/pipe/gomod/gomod.go +++ b/internal/pipe/gomod/gomod.go @@ -53,7 +53,7 @@ func (Pipe) Run(ctx *context.Context) error { ctx.ModulePath = result if !ctx.Config.GoMod.Proxy { - return pipe.Skip("gomod.proxy is disabled") + return pipe.ErrSkipDisabledPipe } if ctx.Snapshot { diff --git a/internal/pipe/milestone/milestone.go b/internal/pipe/milestone/milestone.go index 2b3fcb8a3..6acf17bb1 100644 --- a/internal/pipe/milestone/milestone.go +++ b/internal/pipe/milestone/milestone.go @@ -63,11 +63,10 @@ func doPublish(ctx *context.Context, vcsClient client.Client) error { milestone := &ctx.Config.Milestones[i] if !milestone.Close { - return pipe.Skip("milestone pipe is disabled") + return pipe.ErrSkipDisabledPipe } name, err := tmpl.New(ctx).Apply(milestone.NameTemplate) - if err != nil { return err } diff --git a/internal/pipe/pipe.go b/internal/pipe/pipe.go index f5e68243f..d33636a86 100644 --- a/internal/pipe/pipe.go +++ b/internal/pipe/pipe.go @@ -22,14 +22,31 @@ var ErrSkipSignEnabled = Skip("artifact signing is disabled") // It means that the part of a Piper that validates some things was not run. var ErrSkipValidateEnabled = Skip("validation is disabled") +// ErrSkipDisabledPipe happens when a pipe is skipped because it is not configured. +var ErrSkipDisabledPipe = ErrSkip{ + reason: "pipe not configured/disabled", + expected: true, +} + // IsSkip returns true if the error is an ErrSkip. func IsSkip(err error) bool { return errors.As(err, &ErrSkip{}) } +// IsExpectedSkip returns true if the given error is ErrSkip and if it is an +// expected skip. +func IsExpectedSkip(err error) bool { + skipErr := ErrSkip{} + if !errors.As(err, &skipErr) { + return false + } + return skipErr.expected +} + // ErrSkip occurs when a pipe is skipped for some reason. type ErrSkip struct { - reason string + reason string + expected bool } // Error implements the error interface. returns the reason the pipe was skipped. diff --git a/internal/pipe/pipe_test.go b/internal/pipe/pipe_test.go index 32d2bdbe9..c70cc214e 100644 --- a/internal/pipe/pipe_test.go +++ b/internal/pipe/pipe_test.go @@ -8,19 +8,25 @@ import ( ) func TestSkipPipe(t *testing.T) { - var reason = "this is a test" - var err = Skip(reason) + reason := "this is a test" + err := Skip(reason) require.Error(t, err) require.Equal(t, reason, err.Error()) } func TestIsSkip(t *testing.T) { require.True(t, IsSkip(Skip("whatever"))) + require.True(t, IsSkip(ErrSkipDisabledPipe)) require.False(t, IsSkip(errors.New("nope"))) } +func TestIsExpectedSkip(t *testing.T) { + require.True(t, IsSkip(ErrSkipDisabledPipe)) + require.True(t, IsSkip(Skip("nope"))) +} + func TestSkipMemento(t *testing.T) { - var m = SkipMemento{} + m := SkipMemento{} m.Remember(Skip("foo")) m.Remember(Skip("bar")) // test duplicated errors diff --git a/internal/pipe/release/release.go b/internal/pipe/release/release.go index 75a1d7f00..63eab65bd 100644 --- a/internal/pipe/release/release.go +++ b/internal/pipe/release/release.go @@ -113,7 +113,7 @@ func (Pipe) Publish(ctx *context.Context) error { func doPublish(ctx *context.Context, client client.Client) error { if ctx.Config.Release.Disable { - return pipe.Skip("release pipe is disabled") + return pipe.ErrSkipDisabledPipe } log.WithField("tag", ctx.Git.CurrentTag). WithField("repo", ctx.Config.Release.GitHub.String()). @@ -143,7 +143,7 @@ func doPublish(ctx *context.Context, client client.Client) error { }) } - var filters = artifact.Or( + filters := artifact.Or( artifact.ByType(artifact.UploadableArchive), artifact.ByType(artifact.UploadableBinary), artifact.ByType(artifact.UploadableSourceArchive), @@ -158,7 +158,7 @@ func doPublish(ctx *context.Context, client client.Client) error { filters = artifact.Or(filters, artifact.ByType(artifact.UploadableFile)) - var g = semerrgroup.New(ctx.Parallelism) + g := semerrgroup.New(ctx.Parallelism) for _, artifact := range ctx.Artifacts.Filter(filters).List() { artifact := artifact g.Go(func() error { diff --git a/internal/pipe/scoop/scoop.go b/internal/pipe/scoop/scoop.go index 611280cd3..689bf383f 100644 --- a/internal/pipe/scoop/scoop.go +++ b/internal/pipe/scoop/scoop.go @@ -64,7 +64,7 @@ func (Pipe) Default(ctx *context.Context) error { func doRun(ctx *context.Context, cl client.Client) error { scoop := ctx.Config.Scoop if scoop.Bucket.Name == "" { - return pipe.Skip("scoop section is not configured") + return pipe.ErrSkipDisabledPipe } if scoop.Bucket.Token != "" { @@ -85,7 +85,7 @@ func doRun(ctx *context.Context, cl client.Client) error { return pipe.Skip("archive format is binary") } - var archives = ctx.Artifacts.Filter( + archives := ctx.Artifacts.Filter( artifact.And( artifact.ByGoos("windows"), artifact.ByType(artifact.UploadableArchive), @@ -95,7 +95,7 @@ func doRun(ctx *context.Context, cl client.Client) error { return ErrNoWindows } - var path = scoop.Name + ".json" + path := scoop.Name + ".json" data, err := dataFor(ctx, cl, archives) if err != nil { @@ -170,7 +170,7 @@ func doBuildManifest(manifest Manifest) (bytes.Buffer, error) { } func dataFor(ctx *context.Context, cl client.Client, artifacts []*artifact.Artifact) (Manifest, error) { - var manifest = Manifest{ + manifest := Manifest{ Version: ctx.Version, Architecture: map[string]Resource{}, Homepage: ctx.Config.Scoop.Homepage, @@ -239,7 +239,7 @@ func dataFor(ctx *context.Context, cl client.Client, artifacts []*artifact.Artif func binaries(a *artifact.Artifact) []string { // nolint: prealloc var bins []string - var wrap = a.ExtraOr("WrappedIn", "").(string) + wrap := a.ExtraOr("WrappedIn", "").(string) for _, b := range a.ExtraOr("Builds", []*artifact.Artifact{}).([]*artifact.Artifact) { bins = append(bins, filepath.Join(wrap, b.Name)) } diff --git a/internal/pipe/scoop/scoop_test.go b/internal/pipe/scoop/scoop_test.go index 4d2b858f8..f2d241a9e 100644 --- a/internal/pipe/scoop/scoop_test.go +++ b/internal/pipe/scoop/scoop_test.go @@ -469,7 +469,7 @@ func Test_doRun(t *testing.T) { {Name: "foo_1.0.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64"}, {Name: "foo_1.0.1_windows_386.tar.gz", Goos: "windows", Goarch: "386"}, }, - shouldErr("scoop section is not configured"), + shouldErr(pipe.ErrSkipDisabledPipe.Error()), }, { "no publish", diff --git a/internal/pipe/snapshot/snapshot.go b/internal/pipe/snapshot/snapshot.go index 7f5abc3db..5e9f7929e 100644 --- a/internal/pipe/snapshot/snapshot.go +++ b/internal/pipe/snapshot/snapshot.go @@ -26,7 +26,7 @@ func (Pipe) Default(ctx *context.Context) error { func (Pipe) Run(ctx *context.Context) error { if !ctx.Snapshot { - return pipe.Skip("not a snapshot") + return pipe.ErrSkipDisabledPipe } name, err := tmpl.New(ctx).Apply(ctx.Config.Snapshot.NameTemplate) if err != nil { diff --git a/internal/pipe/sourcearchive/source.go b/internal/pipe/sourcearchive/source.go index 2e3d7a537..99fca210e 100644 --- a/internal/pipe/sourcearchive/source.go +++ b/internal/pipe/sourcearchive/source.go @@ -22,15 +22,15 @@ func (Pipe) String() string { // Run the pipe. func (Pipe) Run(ctx *context.Context) (err error) { if !ctx.Config.Source.Enabled { - return pipe.Skip("source pipe is disabled") + return pipe.ErrSkipDisabledPipe } name, err := tmpl.New(ctx).Apply(ctx.Config.Source.NameTemplate) if err != nil { return err } - var filename = name + "." + ctx.Config.Source.Format - var path = filepath.Join(ctx.Config.Dist, filename) + filename := name + "." + ctx.Config.Source.Format + path := filepath.Join(ctx.Config.Dist, filename) log.WithField("file", filename).Info("creating source archive") out, err := git.Clean(git.Run("archive", "-o", path, ctx.Git.FullCommit)) log.Debug(out) @@ -47,7 +47,7 @@ func (Pipe) Run(ctx *context.Context) (err error) { // Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { - var archive = &ctx.Config.Source + archive := &ctx.Config.Source if archive.Format == "" { archive.Format = "tar.gz" } diff --git a/internal/pipe/upload/upload.go b/internal/pipe/upload/upload.go index 476625f16..fe4572244 100644 --- a/internal/pipe/upload/upload.go +++ b/internal/pipe/upload/upload.go @@ -26,7 +26,7 @@ func (Pipe) Default(ctx *context.Context) error { // Publish artifacts. func (Pipe) Publish(ctx *context.Context) error { if len(ctx.Config.Uploads) == 0 { - return pipe.Skip("uploads section is not configured") + return pipe.ErrSkipDisabledPipe } // Check requirements for every instance we have configured. diff --git a/www/docs/customization/gomod.md b/www/docs/customization/gomod.md index e2dcb58a4..dd7701263 100644 --- a/www/docs/customization/gomod.md +++ b/www/docs/customization/gomod.md @@ -15,7 +15,7 @@ Configuration options available are described bellow. gomod: # Proxy a module from proxy.golang.org, making the builds verifiable. # This will only be effective if running against a tag. Snapshots will ignore this setting. - # PS: for this to work you `build.main` must be a package, not a `.go` file. + # Notice: for this to work you `build.main` must be a package, not a `.go` file. # # Default is false. proxy: true