1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +02:00
goreleaser/internal/pipe/prebuild/prebuild.go
Carlos Alexandro Becker ec2db4a727
feat!: rename module to /v2 (#4894)
<!--

Hi, thanks for contributing!

Please make sure you read our CONTRIBUTING guide.

Also, add tests and the respective documentation changes as well.

-->


<!-- If applied, this commit will... -->

...

<!-- Why is this change being made? -->

...

<!-- # Provide links to any relevant tickets, URLs or other resources
-->

...

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-05-26 15:02:57 -03:00

31 lines
637 B
Go

// Package prebuild provides a pipe that runs before the build and gomod pipes, mainly to resolve common templates.
package prebuild
import (
"github.com/goreleaser/goreleaser/v2/internal/tmpl"
"github.com/goreleaser/goreleaser/v2/pkg/context"
)
// Pipe for build.
type Pipe struct{}
func (Pipe) String() string {
return "build prerequisites"
}
// Run the pipe.
func (Pipe) Run(ctx *context.Context) error {
tpl := tmpl.New(ctx)
for i := range ctx.Config.Builds {
m, err := tpl.Apply(ctx.Config.Builds[i].Main)
if err != nil {
return err
}
if m == "" {
m = "."
}
ctx.Config.Builds[i].Main = m
}
return nil
}