1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-26 04:22:05 +02:00
Carlos Alexandro Becker 5e0c55ac6b
fixed template
closes #276
2017-07-04 09:28:26 -03:00

33 lines
669 B
Go

package release
import (
"bytes"
"os/exec"
"text/template"
"github.com/goreleaser/goreleaser/context"
)
const bodyTemplate = `{{ .ReleaseNotes }}
---
Automated with [GoReleaser](https://github.com/goreleaser)
Built with {{ .GoVersion }}
`
func describeBody(ctx *context.Context) (bytes.Buffer, error) {
var out bytes.Buffer
bts, err := exec.Command("go", "version").CombinedOutput()
if err != nil {
return out, err
}
var template = template.Must(template.New("release").Parse(bodyTemplate))
err = template.Execute(&out, struct {
ReleaseNotes, GoVersion string
}{
ReleaseNotes: ctx.ReleaseNotes,
GoVersion: string(bts),
})
return out, err
}