Robert Griesemer
c5fc3b6972
fmt: rename internal interfaces
...
readRuner -> runeReader
unreadRuner -> runeUnreader
R=r, rsc
CC=golang-dev
https://golang.org/cl/4000054
2011-02-02 15:00:14 -08:00
Rob Pike
029bbe18e0
fmt.Scan: scan binary-exponent floating format, 2.4p-3
...
R=rsc, rog, r2
CC=golang-dev
https://golang.org/cl/4128049
2011-02-02 12:38:48 -08:00
Rob Pike
03a93158d2
fmt: document %b for floating point
...
R=rsc
CC=golang-dev
https://golang.org/cl/4073051
2011-02-01 21:10:16 -08:00
Russ Cox
f4e76d8309
replace non-blocking send, receive syntax with select
...
R=golang-dev, nigeltao, niemeyer, r
CC=golang-dev
https://golang.org/cl/4079053
2011-01-31 18:36:28 -05:00
Rob Pike
4e2218968c
fmt/doc: define width and precision for strings.
...
R=rsc
CC=golang-dev
https://golang.org/cl/4061045
2011-01-26 11:10:41 -08: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
Russ Cox
61a4e9812e
fmt: document %X of string, []byte
...
suggested by Mark Summerfield
R=r
CC=golang-dev
https://golang.org/cl/4018042
2011-01-19 13:35:45 -05:00
Kyle Consalus
754f0402c3
Made format string handling more efficient.
...
R=rsc, r, r2
CC=golang-dev
https://golang.org/cl/3421042
2011-01-05 11:42:35 -08:00
Rob Pike
c0332fc93f
fmt: normalize processing of format string
...
The old loop was a bit odd; change it to be more regular.
This also enables a diagnostic for Printf("%", 3): %!(NOVERB)
R=rsc, Kyle C
CC=golang-dev
https://golang.org/cl/3749044
2011-01-05 10:11:34 -08:00
Rob Pike
1ce6245d6c
throughout: fix broken calls to Printf etc.
...
I have written a tool to verify Printf calls, and although it's not
ready to be reviewed yet it's already uncovered a spate of problems
in the repository. I'm sending this CL to break the changes into
pieces; as the tool improves it will find more, I'm sure.
R=rsc
CC=golang-dev
https://golang.org/cl/3427043
2010-12-07 16:42:54 -05:00
Rob Pike
730e39cd13
fmt: add %U format for standard Unicode representation of integer values.
...
fmt.Printf("%U", 1) yields "U+0001"
It's essentially "U+%.4x" but lets you override the precision works in scan, too.
R=rsc
CC=golang-dev
https://golang.org/cl/3423043
2010-12-06 14:23:37 -05:00
Rob Pike
fdeda13f9e
fmt: fix documentation format glitch. no content to change.
...
Fixes #1313 .
R=gri
CC=golang-dev
https://golang.org/cl/3361041
2010-11-30 14:28:33 -08:00
Adam Langley
3cb4bdb9ce
utf8: make EncodeRune's destination the first argument.
...
R=r
CC=golang-dev
https://golang.org/cl/3364041
2010-11-30 16:59:43 -05:00
Rob Pike
6540c85c7f
fmt.Scan: accept Inf and NaN
...
Fixes #1308 .
R=rsc, r2
CC=golang-dev
https://golang.org/cl/3280045
2010-11-30 12:59:52 -08:00
Rob Pike
d90d0ede3f
fmt: allow "% X" as well as "% x"
...
R=rsc, cw, PeterGo
CC=golang-dev
https://golang.org/cl/3319042
2010-11-29 07:30:36 -08:00
Brad Fitzpatrick
e198a5086a
strings: Contains
...
Tiny helper to avoid strings.Index(s, sub) != -1
R=rsc, r2, r
CC=golang-dev
https://golang.org/cl/2265044
2010-11-01 14:32:48 -07:00
Rob Pike
4e9cc085d2
testing: eliminate testing/regexp
...
Rather than updating the stripped-down regexp implementation embedded
in testing, delete it by passing the one function we need from the package
main file created by gotest.
R=rsc
CC=golang-dev
https://golang.org/cl/2761043
2010-10-28 16:54:24 -07:00
Robert Griesemer
3478891d12
gofmt -s -w src misc
...
R=r, rsc
CC=golang-dev
https://golang.org/cl/2662041
2010-10-22 10:06:33 -07:00
Rob Pike
f73f9ad4ad
fmt: allow %d on []byte
...
Fixes #1159 .
R=rsc, adg
CC=golang-dev
https://golang.org/cl/2305043
2010-10-04 11:57:48 +02:00
Andrew Gerrand
558477eeb1
fmt: add Errorf helper function
...
This crops up in a lot of places.
It's just a one-liner, but doesn't add any dependancies.
Seems worth it.
R=r, r2
CC=golang-dev
https://golang.org/cl/2344041
2010-10-01 14:04:55 +10:00
Russ Cox
2ee420fa5e
... changes
...
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/2273042
2010-09-24 11:55:48 -04:00
Rob Pike
344600f689
fmt/Printf: document and tweak error messages produced for bad formats
...
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/2198044
2010-09-24 11:53:26 +10:00
Rob Pike
1959c3ac5b
tests: fix prints
...
- delete unnecessary newlines
- make sure formatted prints call the formatting routines
R=adg
CC=golang-dev
https://golang.org/cl/2225046
2010-09-23 13:48:56 +10:00
Anthony Martin
176364900e
fmt: support '*' for width or precision
...
R=r
CC=golang-dev
https://golang.org/cl/2237044
2010-09-22 16:10:38 +10:00
Rob Pike
6ee7997366
fmt.Fscan: use UnreadRune to preserve data across calls.
...
Fixes #1055 .
(About as well as it can be fixed without changing the API.)
R=rsc
CC=golang-dev
https://golang.org/cl/2156047
2010-09-14 11:06:17 +10:00
Anthony Martin
68cce4ab20
fmt.Scan: fix integer overflow on 32-bit machines
...
R=r, rsc
CC=golang-dev
https://golang.org/cl/2144043
2010-09-06 08:04:53 +10:00
Rob Pike
6405ab0fae
fmt: delete erroneous sentence about return value for Sprint*.
...
R=rsc
CC=golang-dev
https://golang.org/cl/2160041
2010-09-04 22:29:10 +10:00
Rob Pike
49b19e1b39
fmt: fix typo in package comment.
...
No semantic change.
R=rsc
CC=golang-dev
https://golang.org/cl/2121041
2010-09-01 22:59:20 +10:00
Rob Pike
6e76298744
fmt: add sentence about return values to docs for Printf etc.
...
R=rsc, gri
CC=golang-dev
https://golang.org/cl/1952045
2010-08-19 12:07:24 +10: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
Rob Pike
316961c172
fmt/print: remove a TODO regarding printing renamed byte slices.
...
the solution must work around a weakness in the reflection library:
there is no way to do type-safe conversions under reflection.
R=rsc
CC=golang-dev
https://golang.org/cl/2000041
2010-08-17 08:34:40 +10:00
Rob Pike
b21611b963
fmt/print: give %p priority, analogous to %T
...
Fixes #1024 .
R=rsc
CC=golang-dev
https://golang.org/cl/1961042
2010-08-14 07:37:03 +10:00
Rob Pike
be97fa4c79
fmt/print: honor Formatter in Print, Println.
...
Rearrange code to clarify handling of %T, Formatter, GoStringer, and Stringer.
R=rsc
CC=golang-dev
https://golang.org/cl/1973043
2010-08-13 17:26:32 +10:00
Rob Pike
18063d4686
fmt.Scan: empty strings are errors
...
Fixes #1002 .
R=rsc
CC=golang-dev
https://golang.org/cl/1882046
2010-08-07 10:02:04 +10:00
Rob Pike
2c0bbf99b9
fmt.Print: fix bug in placement of spaces introduced when ...T went in.
...
Fixes #976 .
R=rsc, chris tighe, r
CC=golang-dev
https://golang.org/cl/1697057
2010-07-29 10:50:09 -07:00
Rob Pike
518df525d8
fmt: move comment into doc.go.
...
Fix the documentation of newline handling in *f routines
to match the implementation.
R=rsc
CC=golang-dev
https://golang.org/cl/1899042
2010-07-28 13:11:22 -07:00
Rob Pike
a59e113fcb
fmt.Scanf: handle trailing spaces.
...
Fixes #954 .
R=rsc
CC=golang-dev
https://golang.org/cl/1864046
2010-07-26 16:38:35 -07:00
Rob Pike
18d78dd7b1
tweak comment for %#X
...
Fixes #904 .
R=rsc
CC=golang-dev
https://golang.org/cl/1803043
2010-07-12 16:57:11 -07:00
Rob Pike
5245ea771d
fmt.Printf: fix bug in handling of %#v.
...
nice side effect: slices now obey their format verb. example:
fmt.Printf("%q\n", []string{"a"})
R=rsc
CC=golang-dev
https://golang.org/cl/1729045
2010-06-28 14:11:38 -07:00
Rob Pike
56f3c70111
fmt.Scan: fix handling of EOFs.
...
Fixes #876 .
R=rsc
CC=golang-dev
https://golang.org/cl/1675048
2010-06-24 15:24:25 -07:00
Russ Cox
fc090a3a54
reflect: add Type.Bits method, add tags to prohibit conversions
...
gob: substitute slice for map
R=r
CC=golang-dev
https://golang.org/cl/1699045
2010-06-21 13:19:29 -07:00
Russ Cox
45bdf0367e
reflect: add Kind, remove Int8Type, Int8Value, etc.
...
update other code to match.
R=r
CC=golang-dev
https://golang.org/cl/1680044
2010-06-20 12:16:25 -07:00
Rob Pike
3748d22672
fmt.Scanf: improve error message when input does not match format
...
R=rsc
CC=golang-dev
https://golang.org/cl/1693043
2010-06-18 20:37:03 -07:00
Rob Pike
d60312c4c0
fmt.Scan: fix %c in the case where the input does not implement ReadRune itself.
...
While we're at it, clean up and test the code to guarantee we see every byte when
the text is erroneous UTF-8.
Fixes #866 .
R=rsc
CC=golang-dev
https://golang.org/cl/1712042
2010-06-15 17:41:11 -07:00
Rob Pike
177746ba31
fmt.Printf: write tests for %T.
...
Fix a bug that caused it to ignore field widths.
R=rsc
CC=golang-dev
https://golang.org/cl/1704041
2010-06-14 17:42:31 -07:00
Rob Pike
d482c163be
fmt.Print*: reimplement to switch on type first.
...
This shortens, simplifies and regularizes the code significantly.
(Improvements to reflect could make another step.)
Passes all.bash.
One semantic change occurs: The String() method changes
behavior. It used to run only for string formats such as %s and %q.
Instead, it now runs whenever the item has the method and the
result is then processed by the format as a string. Besides the
regularization, this has three effects:
1) width is honored for String() items
2) %x works for String() items
3) implementations of String that merely recur will recur forever
Regarding point 3, example from the updated documentation:
type X int
func (x X) String() string { return Sprintf("%d", x) }
should cast the value before recurring:
func (x X) String() string { return Sprintf("%d", int(x)) }
R=rsc
CC=golang-dev
https://golang.org/cl/1613045
2010-06-14 17:16:35 -07:00
Rob Pike
9a70762ac9
fmt.Scan: %c
...
R=rsc
CC=golang-dev
https://golang.org/cl/1518042
2010-06-03 17:03:22 -07:00
Rob Pike
962e8b8736
fmt.Scan: field widths
...
Also fix an interface bug: white-space-delimited doesn't work well for cases like "%d, %d" on "23, 23")
R=rsc
CC=golang-dev
https://golang.org/cl/1502041
2010-06-03 16:06:41 -07:00
Rob Pike
6106c63abc
fmt.Scan: scan []byte arguments
...
R=rsc
CC=golang-dev
https://golang.org/cl/1486041
2010-06-02 16:28:01 -07:00
Rob Pike
4fc97c4703
fmt.Scanf: implement formats, provide Sscanf (strings)
...
- provide convenience functions for scanning strings
- enable Scanf etc.
- update doc comments
R=rsc
CC=golang-dev
https://golang.org/cl/1451044
2010-06-02 14:58:31 -07:00