1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00

33 lines
634 B
Go
Raw Normal View History

2017-04-19 16:59:26 -03:00
package release
import (
"bytes"
"html/template"
"os/exec"
"github.com/goreleaser/goreleaser/context"
)
2017-04-19 17:05:10 -03:00
const bodyTemplate = `{{ .ReleaseNotes }}
2017-04-19 16:59:26 -03:00
---
Automated with @goreleaser
Built with {{ .GoVersion }}
`
func buildBody(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 {
2017-04-19 17:05:10 -03:00
ReleaseNotes, GoVersion string
2017-04-19 16:59:26 -03:00
}{
2017-04-19 17:05:10 -03:00
ReleaseNotes: ctx.ReleaseNotes,
GoVersion: string(bts),
2017-04-19 16:59:26 -03:00
})
return out, err
}