1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-22 04:08:49 +02:00

docs: tmpl godoc

This commit is contained in:
Carlos Alexandro Becker 2018-07-08 21:13:09 -07:00
parent 0311214cbe
commit 30feb1294f
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

View File

@ -12,6 +12,7 @@ import (
"github.com/pkg/errors"
)
// Template holds data that can be applied to a template string
type Template struct {
fields fields
}
@ -33,6 +34,7 @@ type fields struct {
Binary string
}
// New Template
func New(ctx *context.Context) *Template {
return &Template{
fields: fields{
@ -45,6 +47,7 @@ func New(ctx *context.Context) *Template {
}
}
// WithArtifacts populate fields from the artifact and replacements
func (t *Template) WithArtifact(a artifact.Artifact, replacements map[string]string) *Template {
var binary = a.Extra["Binary"]
if binary == "" {
@ -57,6 +60,7 @@ func (t *Template) WithArtifact(a artifact.Artifact, replacements map[string]str
return t
}
// Apply applies the given string against the fields stored in the template.
func (t *Template) Apply(s string) (string, error) {
var out bytes.Buffer
tmpl, err := template.New("tmpl").