1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/internal/pipe/effectiveconfig/config.go
Carlos Alexandro Becker 860b4a8f81
chore: gofumpt & lint (#2190)
Signed-off-by: Carlos Becker <caarlos0@gmail.com>
2021-04-25 14:20:49 -03:00

29 lines
604 B
Go

package effectiveconfig
import (
"os"
"path/filepath"
"github.com/apex/log"
"github.com/goreleaser/goreleaser/pkg/context"
yaml "gopkg.in/yaml.v2"
)
// Pipe that writes the effective config file to dist.
type Pipe struct{}
func (Pipe) String() string {
return "writing effective config file"
}
// Run the pipe.
func (Pipe) Run(ctx *context.Context) (err error) {
path := filepath.Join(ctx.Config.Dist, "config.yaml")
bts, err := yaml.Marshal(ctx.Config)
if err != nil {
return err
}
log.WithField("config", path).Info("writing")
return os.WriteFile(path, bts, 0o644) //nolint: gosec
}