Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(363)

Issue 6680044: code review 6680044: cmd/go: add join template function. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 10 months ago by rog
Modified:
12 years, 9 months ago
Reviewers:
CC:
rsc, dsymonds, minux1, remyoudompheng, r, golang-dev
Visibility:
Public.

Description

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"}}'

Patch Set 1 #

Patch Set 2 : diff -r fc8137c00f9c https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r fc8137c00f9c https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 4 : diff -r fc8137c00f9c https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r fc8137c00f9c https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r fc8137c00f9c https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r fc8137c00f9c https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r fc8137c00f9c https://go.googlecode.com/hg/ #

Total comments: 3

Patch Set 9 : diff -r fc8137c00f9c https://go.googlecode.com/hg/ #

Patch Set 10 : diff -r 7639aa719ae8 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -5 lines) Patch
M src/cmd/go/list.go View 1 2 3 4 5 6 7 8 3 chunks +6 lines, -5 lines 0 comments Download

Messages

Total messages: 14
rog
Hello rsc@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 10 months ago (2012-10-13 12:11:50 UTC) #1
dsymonds
A join function would be better.
12 years, 10 months ago (2012-10-13 12:23:38 UTC) #2
minux1
https://codereview.appspot.com/6680044/diff/5001/src/cmd/go/list.go File src/cmd/go/list.go (right): https://codereview.appspot.com/6680044/diff/5001/src/cmd/go/list.go#newcode130 src/cmd/go/list.go:130: if out.Count() > 0 { i still prefer to ...
12 years, 10 months ago (2012-10-13 12:27:00 UTC) #3
remyoudompheng
I also prefer join. Especially if I can write {{ .Deps | join ", " ...
12 years, 10 months ago (2012-10-13 12:34:31 UTC) #4
minux1
On Sat, Oct 13, 2012 at 8:34 PM, Rémy Oudompheng <remyoudompheng@gmail.com>wrote: > I also prefer ...
12 years, 10 months ago (2012-10-13 12:38:48 UTC) #5
rog
Hello rsc@golang.org, dsymonds@golang.org, minux.ma@gmail.com, remyoudompheng@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 10 months ago (2012-10-15 09:48:57 UTC) #6
rsc
I like the idea. Not sure it makes sense to swap the arguments. Now you ...
12 years, 10 months ago (2012-10-16 17:36:14 UTC) #7
rog
Hello rsc@golang.org, dsymonds@golang.org, minux.ma@gmail.com, remyoudompheng@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 10 months ago (2012-10-17 15:05:00 UTC) #8
dsymonds
LGTM http://codereview.appspot.com/6680044/diff/20002/src/cmd/go/list.go File src/cmd/go/list.go (right): http://codereview.appspot.com/6680044/diff/20002/src/cmd/go/list.go#newcode31 src/cmd/go/list.go:31: which takes a slice of strings and a ...
12 years, 10 months ago (2012-10-17 22:41:29 UTC) #9
rog
http://codereview.appspot.com/6680044/diff/20002/src/cmd/go/list.go File src/cmd/go/list.go (right): http://codereview.appspot.com/6680044/diff/20002/src/cmd/go/list.go#newcode31 src/cmd/go/list.go:31: which takes a slice of strings and a separator ...
12 years, 10 months ago (2012-10-18 10:01:51 UTC) #10
r
This all feels too ad hoc to me. -rob
12 years, 10 months ago (2012-10-18 10:55:41 UTC) #11
rog
Yes, it is ad hoc. I'd really like to be able to conveniently use go ...
12 years, 10 months ago (2012-10-18 12:05:34 UTC) #12
r
After cogitation and discussion I'm OK with this. http://codereview.appspot.com/6680044/diff/20002/src/cmd/go/list.go File src/cmd/go/list.go (right): http://codereview.appspot.com/6680044/diff/20002/src/cmd/go/list.go#newcode31 src/cmd/go/list.go:31: which ...
12 years, 10 months ago (2012-10-19 21:24:18 UTC) #13
rog
12 years, 9 months ago (2012-10-22 07:59:07 UTC) #14
*** Submitted as http://code.google.com/p/go/source/detail?r=117f773ed6b0 ***

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
http://codereview.appspot.com/6680044
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b