]> Cypherpunks repositories - gostls13.git/commit
cmd/go: add join template function.
authorRoger Peppe <rogpeppe@gmail.com>
Mon, 22 Oct 2012 07:58:27 +0000 (08:58 +0100)
committerRoger Peppe <rogpeppe@gmail.com>
Mon, 22 Oct 2012 07:58:27 +0000 (08:58 +0100)
commit9714691a3f1862f09cd8d8536131c01c15ab32c3
treed43d8a4c6871c7b807244039084cd34fb8dbec1d
parent319131f295fecb687787d89b1441a6ea9222d5e4
cmd/go: add join template function.

It's common to use the go list command in shell scripts, but
currently it's awkward to print a string slice from the Package
type in a way that's easily parseable by the shell.  For example:

        go list -f '{{range .Deps}}{{.}}
        {{end}}'

(and even that prints an unwanted new line at the end|).

To make this easier, this CL adds a "join" function to the
format template.

        go list -f '{{join .Deps "\n"}}'

R=rsc, dsymonds, minux.ma, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6680044
src/cmd/go/list.go