1
0
mirror of https://github.com/golang/go synced 2024-10-03 16:31:27 -06:00
Commit Graph

60 Commits

Author SHA1 Message Date
Rémy Oudompheng
75104237c8 all: make tests able to run multiple times.
It is now possible to run "go test -cpu=1,2,4 std"
successfully.

Fixes #3185.

R=golang-dev, dave, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7196052
2013-01-27 00:24:09 +01:00
Rick Arnold
a6d986bd8a flag: add implicit boolFlag interface
Any flag.Value that has an IsBoolFlag method that returns true
will be treated as a bool flag type during parsing.

Fixes #4262.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6944064
2012-12-22 13:34:48 -05:00
Rob Pike
48ca3f288c flag: fix bug in handling of booleans on error
Fixes #3869.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6448072
2012-07-27 16:13:29 -07:00
David Symonds
c123c6c3f6 flag: fix indexing doc.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6341046
2012-06-24 12:23:51 -07:00
David Symonds
04f3cf0faa flag: include flag name in redefinition panic.
R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/6250043
2012-05-24 13:42:02 +10:00
David Symonds
b20163e9e4 flag: update style.
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/6051044
2012-04-17 16:37:35 +10:00
Rob Pike
07e887f433 flag: add examples
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5867049
2012-03-22 11:15:43 +11:00
David Symonds
32ffc62348 flag: describe valid input for Duration flags.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5639046
2012-02-07 17:50:04 +11:00
Russ Cox
2050a9e478 build: remove Make.pkg, Make.tool
Consequently, remove many package Makefiles,
and shorten the few that remain.

gomake becomes 'go tool make'.

Turn off test phases of run.bash that do not work,
flagged with $BROKEN.  Future CLs will restore these,
but this seemed like a big enough CL already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05:00
Brad Fitzpatrick
b79ba6a609 flag: allow a FlagSet to not write to os.Stderr
Fixes #2747

R=golang-dev, gri, r, rogpeppe, r
CC=golang-dev
https://golang.org/cl/5564065
2012-01-27 09:23:06 -08:00
David Symonds
98b90475ac flag: change Set method Value interface to return error instead of bool.
This yields much better error messages when a bad flag value is given.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5498078
2011-12-25 16:12:26 +11:00
David Symonds
cf506f6eac flag: add Duration flag type.
This works in the expected way: flag.Duration returns a *time.Duration,
and uses time.ParseDuration for parsing the input.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5489113
2011-12-23 16:29:38 +11:00
Russ Cox
2666b815a3 use new strconv API
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.

No attempt is made to use the new Append functions
even though there are definitely opportunities.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069
2011-12-05 15:48:46 -05:00
Russ Cox
c2049d2dfe src/pkg/[a-m]*: gofix -r error -force=error
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5322051
2011-11-01 22:04:37 -04:00
Russ Cox
1505cae05d flag: make zero FlagSet useful
This makes it possible to use a FlagSet as a
field in a larger struct.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5036041
2011-09-15 17:04:51 -04:00
Russ Cox
2cc4a54dec flag: add Parsed, restore Usage
R=r
CC=golang-dev
https://golang.org/cl/4973050
2011-08-31 17:38:41 -04:00
Rob Pike
e44853c969 flag: make -help nicer.
- suppress the print that -help is not defined.
- return a special error code if -help is set
- do not change behavior if an explict "help" flag is defined.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4641099
2011-07-11 09:35:50 +10:00
Rob Pike
4b1170d2b1 sort: change IntArray etc. to IntSlice for better name hygiene.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4602054
2011-06-11 09:25:18 +10:00
Andrew Gerrand
3975b9910c flag: fix build
R=r
CC=golang-dev
https://golang.org/cl/4543064
2011-05-22 11:55:02 +10:00
Rob Pike
f4fe688b09 flags: allow distinct sets of flags.
A FlagSet is an independent set of flags that may be used,
for example, to provide flag processing for subcommands
in a CLI.  The standard, os.Args-derived set of flags is a
global but non-exported FlagSet and the standard functions
are wrappers for methods of that FlagSet.

Allow the programmer to control whether the program
exits if there is a parse error.  For the default set, the behavior
remains to exit on error.

The handling of Usage is odd due to backward compatibility.

R=golang-dev, bradfitz, r, bradfitz
CC=golang-dev
https://golang.org/cl/4517092
2011-05-22 09:22:00 +10:00
David Symonds
bddd092dc3 flag: fix docs on flag.Var.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4539067
2011-05-19 14:53:26 +10:00
Nigel Tao
6a186d38d1 src/pkg: make package doc comments consistently start with "Package foo".
R=rsc
CC=golang-dev
https://golang.org/cl/4442064
2011-04-20 09:57:05 +10:00
Rob Pike
9db2bc741e flag: fix error in documentation example.
Fixes #1615.
This time for sure.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4275079
2011-03-25 11:28:31 -07:00
Fazlul Shahriar
19aecba1d5 flag: document Nflag function
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4279065
2011-03-20 11:45:43 -07:00
Rob Pike
52b95970ca flag: fix example in doc comment.
Fixes #1615.

R=dsymonds
CC=golang-dev
https://golang.org/cl/4277058
2011-03-17 15:29:52 -07:00
Rob Pike
034ca39e56 flag: visit the flags in sorted order, for better messages.
Fixes #1601.

R=rsc
CC=golang-dev
https://golang.org/cl/4249070
2011-03-10 12:42:31 -08:00
Robert Hencke
c55fb521cc flag: failf documentation nit
"standard output" should have been "standard error".  Sorry about that..

R=adg
CC=golang-dev
https://golang.org/cl/4240088
2011-03-08 18:02:07 +11:00
Robert Hencke
2a36f9df1c flag: replace fail with failf
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4254061
2011-03-08 15:41:36 +11:00
Luuk van Dijk
37b1787392 flag: allow hexadecimal and octal input for integer flags.
R=r
CC=golang-dev
https://golang.org/cl/4182043
2011-02-11 12:23:54 +01:00
Russ Cox
f2b5a07453 delete float, complex - code changes
also:
	cmplx -> complex
	float64(1.0) -> 1.0
	float64(1) -> 1.0

R=gri, r, gri1, r2
CC=golang-dev
https://golang.org/cl/3991043
2011-01-19 23:09:00 -05:00
Rob Pike
70113b436e a few more errors caught by the print checker
R=rsc
CC=golang-dev
https://golang.org/cl/3431046
2010-12-08 16:25:14 -05:00
Russ Cox
ed7c3f3127 flag: handle multiple calls to flag.Parse
R=r
CC=golang-dev
https://golang.org/cl/3071041
2010-12-07 13:19:01 -05:00
Rob Pike
e26f9b3420 flag: fix format error in boolean error report. just use %q; the values are strings.
R=rsc
CC=golang-dev
https://golang.org/cl/3418043
2010-12-06 14:23:52 -05:00
Russ Cox
69c4e9380b use append
R=gri, r, r2
CC=golang-dev
https://golang.org/cl/2743042
2010-10-27 19:47:23 -07:00
Russ Cox
da392d9136 build: no required environment variables
R=adg, r, PeterGo
CC=golang-dev
https://golang.org/cl/1942044
2010-08-18 10:08:49 -04:00
Russ Cox
a318f9d3a4 flag: eliminate unnecessary structs
R=r
CC=golang-dev
https://golang.org/cl/872045
2010-04-15 15:25:46 -07:00
Rob Pike
6431b984db flags: better tests.
R=rsc
CC=golang-dev
https://golang.org/cl/864044
2010-04-06 16:46:52 -07:00
Russ Cox
c7122a3c58 simplify various code using new map index rule
R=r
CC=golang-dev
https://golang.org/cl/833044
2010-03-30 10:51:11 -07:00
Rob Pike
570af81e19 Flags: add user-defined flag types. The change is really no code; it's just publishing
the set() method and add() functions.  But we rename add() to Var() for consistency.
Also rename FlagValue to Value for simplicity.

Also, delete the check for multiple settings for a flag.  This makes it possible to
define a flag that collects values, such as into a slice of strings.

type flagVar []string

func (f *flagVar) String() string {
	return fmt.Sprint(v)
}

func (f *flagVar) Set(value string) bool {
	if v == nil {
		v = make(flagVar, 1)
	} else {
		nv := make(flagVar, len(v)+1)
		copy(nv, v)
		v = nv
	}
	v[len(v)-1] = value
	return true
}

var v flagVar

func main() {
	flag.Var(&v, "testV", "multiple values build []string")
	flag.Parse()
	fmt.Printf("v = %v\n", v)
}

R=rsc
CC=golang-dev
https://golang.org/cl/842041
2010-03-29 17:37:22 -07:00
Rob Pike
4b40426a90 Add strconv.Atob, Btoa.
Fixes #639

R=rsc
CC=golang-dev
https://golang.org/cl/755041
2010-03-25 11:50:07 -07:00
Robert Griesemer
1c72959999 1) Change default gofmt default settings for
parsing and printing to new syntax.

                  Use -oldparser to parse the old syntax,
                  use -oldprinter to print the old syntax.

               2) Change default gofmt formatting settings
                  to use tabs for indentation only and to use
                  spaces for alignment. This will make the code
                  alignment insensitive to an editor's tabwidth.

                  Use -spaces=false to use tabs for alignment.

               3) Manually changed src/exp/parser/parser_test.go
                  so that it doesn't try to parse the parser's
                  source files using the old syntax (they have
                  new syntax now).

               4) gofmt -w src misc test/bench

	       2nd set of files.

R=rsc
CC=golang-dev
https://golang.org/cl/179067
2009-12-15 15:27:16 -08:00
Sergio Luis O. B. Correia
6fc820729e go: makes it build for the case $GOROOT has whitespaces
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.

this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.

Fixes #115.

R=rsc, dsymonds1
https://golang.org/cl/157067
2009-11-23 17:32:51 -08:00
Russ Cox
9ac4449cb2 gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg
R=r, gri
CC=golang-dev
https://golang.org/cl/156115
2009-11-20 11:45:05 -08:00
Rob Pike
f9919ba323 Explain why
-flag true
does not work although
	-flag=true
does.

Fixes #139.

R=iant
CC=golang-dev
https://golang.org/cl/154118
2009-11-13 13:15:18 -08:00
Robert Griesemer
baba292998 - replaced gofmt expression formatting algorithm with
rsc's algorithm
	- applied gofmt -w misc src
	- partial CL (remaining files in other CLs)

R=rsc, r
http://go/go-review/1026036
2009-11-09 21:13:17 -08:00
Robert Griesemer
40621d5c0d remove semis after statements in one-statement statement lists
R=rsc, r
http://go/go-review/1025029
2009-11-09 12:07:39 -08:00
Vish Subramanian
379150c210 Add flags of type float to the flag package.
R=r, rsc
http://go/go-review/1026011
2009-11-07 15:52:27 -08:00
Robert Griesemer
368f8cbc75 - fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals)
- applied gofmt -w $GOROOT/src
(look for instance at src/pkg/debug/elf/elf.go)

R=r, rsc
CC=go-dev
http://go/go-review/1026006
2009-11-06 14:24:38 -08:00
Robert Griesemer
30c7088c95 gofmt-ify template, time, unsafe, flag, fmt
(replacement for CLs 1017039, 1017041, 1017040, 1018054)

R=r
http://go/go-review/1018060
2009-11-05 09:40:28 -08:00
Russ Cox
094f1d5990 more lgtm files from gofmt
R=gri
OCL=35485
CL=35488
2009-10-08 15:14:54 -07:00