1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/internal/pipe/prebuild/prebuild.go
Carlos Alexandro Becker a6a6e11cc9
fix: template main with gomod.proxy (#2834)
* refactor: rename file

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: template main with gomod.proxy

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2022-01-14 10:33:11 -03:00

31 lines
631 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/internal/tmpl"
"github.com/goreleaser/goreleaser/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
}