1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00
Carlos Alexandro Becker 2cc10c3cc8 chore: fixed/ignore lint issues
GAS started to break on file/folder permissions
and executing things with variables.

closes #422
2017-11-26 20:40:07 -02:00

47 lines
1002 B
Go

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