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

Issue 156390043: code review 156390043: flag: disallow setting flags multiple times (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 6 months ago by r
Modified:
9 years, 6 months ago
Reviewers:
gobot, rsc, bradfitz
CC:
golang-codereviews, bradfitz
Visibility:
Public.

Description

flag: disallow setting flags multiple times This is a day 1 error in the flag package: It did not check that a flag was set at most once on the command line. Because user-defined flags may have more general properties, the check applies only to the standard flag types in this package: bool, string, etc. Fixes issue 8960.

Patch Set 1 #

Total comments: 2

Patch Set 2 : diff -r f8143b226ad458a1fb82245657d09b39f298527c https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+90 lines, -0 lines) Patch
M src/flag/flag.go View 1 5 chunks +30 lines, -0 lines 0 comments Download
M src/flag/flag_test.go View 1 chunk +60 lines, -0 lines 0 comments Download

Messages

Total messages: 6
r
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go/
9 years, 6 months ago (2014-10-19 15:57:19 UTC) #1
bradfitz
LGTM https://codereview.appspot.com/156390043/diff/1/src/flag/flag.go File src/flag/flag.go (right): https://codereview.appspot.com/156390043/diff/1/src/flag/flag.go#newcode733 src/flag/flag.go:733: case *intValue: don't like the comma-separated cases? seems ...
9 years, 6 months ago (2014-10-19 16:08:46 UTC) #2
r
https://codereview.appspot.com/156390043/diff/1/src/flag/flag.go File src/flag/flag.go (right): https://codereview.appspot.com/156390043/diff/1/src/flag/flag.go#newcode733 src/flag/flag.go:733: case *intValue: On 2014/10/19 16:08:46, bradfitz wrote: > don't ...
9 years, 6 months ago (2014-10-19 17:17:56 UTC) #3
r
*** Submitted as https://code.google.com/p/go/source/detail?r=973cf6fc03b8 *** flag: disallow setting flags multiple times This is a day ...
9 years, 6 months ago (2014-10-19 17:33:25 UTC) #4
gobot
This CL appears to have broken the plan9-amd64-aram builder. See http://build.golang.org/log/488be71979aeed73dd255bd67169d794fbb7669b
9 years, 6 months ago (2014-10-19 17:40:43 UTC) #5
rsc
9 years, 6 months ago (2014-10-20 19:09:20 UTC) #6
Message was sent while issue was closed.
In typical Unix command line environments if you specify a flag multiple times,
the last one wins, which is exactly what was going on here. This was true even
on Plan 9, but also in the BSD and GNU flag parsers. So this was working as I
expected, and as I believe many others would expect.

If we'd decided to do something different on day 1 I would probably have gone
along with trying it, but I don't think we can break that behavior today.
Sign in to reply to this message.

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