github.com/client9/goreleaser@v0.17.4-0.20170511023544-27e4b028926d/pipeline/release/body.go (about)

     1  package release
     2  
     3  import (
     4  	"bytes"
     5  	"html/template"
     6  	"os/exec"
     7  
     8  	"github.com/goreleaser/goreleaser/context"
     9  )
    10  
    11  const bodyTemplate = `{{ .ReleaseNotes }}
    12  
    13  ---
    14  Automated with @goreleaser
    15  Built with {{ .GoVersion }}
    16  `
    17  
    18  func describeBody(ctx *context.Context) (bytes.Buffer, error) {
    19  	var out bytes.Buffer
    20  	bts, err := exec.Command("go", "version").CombinedOutput()
    21  	if err != nil {
    22  		return out, err
    23  	}
    24  	var template = template.Must(template.New("release").Parse(bodyTemplate))
    25  	err = template.Execute(&out, struct {
    26  		ReleaseNotes, GoVersion string
    27  	}{
    28  		ReleaseNotes: ctx.ReleaseNotes,
    29  		GoVersion:    string(bts),
    30  	})
    31  	return out, err
    32  }