1
0
mirror of https://github.com/golang/go synced 2024-10-04 16:21:22 -06:00
Commit Graph

290 Commits

Author SHA1 Message Date
Russ Cox
434a6c85cb gc: use gofmt spacing when printing map type
R=ken2
CC=golang-dev
https://golang.org/cl/5450071
2011-12-02 14:45:07 -05:00
Russ Cox
dcf1d7bc0e gofmt -s misc src
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5451079
2011-12-02 14:14:25 -05:00
Robert Hencke
6f0ef845e6 asn1: fix incorrect prints found by govet
R=golang-dev
CC=golang-dev
https://golang.org/cl/5449063
2011-12-02 10:13:02 -05:00
Rob Pike
30775f67e7 encoding/gob: don't send type info for unexported fields
Fixes #2517.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5440079
2011-12-02 00:02:24 -08:00
Russ Cox
e812db3558 encoding/asn1: fix test on OpenBSD
time.Parse uses time.Local if it has the right zone offset,
otherwise it calls time.FixedZone.  The test's use of reflect.DeepEqual
meant that the test expected time.FixedZone always, failing
when the local time zone really would have used -0700 for
that time.  The fix is to format the time to display only the
pieces we intend to test.

R=golang-dev, agl, iant
CC=golang-dev
https://golang.org/cl/5437088
2011-11-30 13:36:25 -05:00
Russ Cox
03823b881c use new time API
R=bradfitz, gri, r, dsymonds
CC=golang-dev
https://golang.org/cl/5390042
2011-11-30 12:01:46 -05:00
Russ Cox
fe838c2ddb encoding/xml: fix copy bug
Fixes #2484.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5417059
2011-11-22 12:31:33 -05:00
Russ Cox
6e3e380923 allow direct conversion between string and named []byte, []rune
The allowed conversions before and after are:
        type Tstring string
        type Tbyte []byte
        type Trune []rune

        string <-> string  // ok
        string <-> []byte  // ok
        string <-> []rune // ok
        string <-> Tstring // ok
        string <-> Tbyte // was illegal, now ok
        string <-> Trune // was illegal, now ok

        Tstring <-> string  // ok
        Tstring <-> []byte  // ok
        Tstring <-> []rune // ok
        Tstring <-> Tstring // ok
        Tstring <-> Tbyte // was illegal, now ok
        Tstring <-> Trune // was illegal, now ok

Update spec, compiler, tests.  Use in a few packages.

We agreed on this a few months ago but never implemented it.

Fixes #1707.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5421057
2011-11-22 12:30:02 -05:00
Brad Fitzpatrick
6c9f466273 json: speed up encoding, caching reflect calls
Before
json.BenchmarkCodeEncoder  10  181232100 ns/op  10.71 MB/s
json.BenchmarkCodeMarshal  10  184578000 ns/op  10.51 MB/s

After:
json.BenchmarkCodeEncoder  10  146444000 ns/op  13.25 MB/s
json.BenchmarkCodeMarshal  10  151428500 ns/op  12.81 MB/s

R=rsc, r
CC=golang-dev
https://golang.org/cl/5416046
2011-11-21 07:49:14 -08:00
Russ Cox
a6106eef37 encoding/json: make BenchmarkSkipValue more consistent
Move scanner allocation out of loop.
It's the only allocation in the test so it dominates
when it triggers a garbage collection.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5369117
2011-11-15 13:59:59 -05:00
Russ Cox
552a556a40 encoding/json: add marshal/unmarshal benchmark
R=bradfitz
CC=golang-dev
https://golang.org/cl/5387041
2011-11-15 10:58:19 -05:00
Mikio Hara
a619da9f4a xml: fix build
empty is already not a nil.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5376098
2011-11-15 10:28:01 +09:00
Russ Cox
53523f6a7d encoding/json: decode [] as empty slice, not nil slice
Test was already present, but bug in reflect.DeepEqual hid this bug.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5375090
2011-11-14 16:03:23 -05:00
Russ Cox
558e7fc332 various: avoid func compare
R=gri, r, bradfitz
CC=golang-dev
https://golang.org/cl/5371074
2011-11-13 22:57:19 -05:00
Russ Cox
fd34e78b53 various: reduce overuse of os.EINVAL + others
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5372081
2011-11-13 22:42:42 -05:00
Rob Pike
30aa701fec renaming_2: gofix -r go1pkgrename src/pkg/[a-l]*
R=rsc
CC=golang-dev
https://golang.org/cl/5358041
2011-11-08 15:40:58 -08:00
Rob Pike
6ab6c49fce renaming_1: hand-edited files for go 1 renaming
This contains the files that required handiwork, mostly
Makefiles with updated TARGs, plus the two packages
with modified package names.
html/template/doc.go needs a separate edit pass.
test/fixedbugs/bug358.go is not legal go so gofix fails on it.

R=rsc
CC=golang-dev
https://golang.org/cl/5340050
2011-11-08 15:38:47 -08:00
David Crawshaw
1371ac2f0b xml: allow parsing of <_> </_>.
R=rsc, nigeltao
CC=golang-dev
https://golang.org/cl/5298061
2011-11-07 10:47:44 -05:00
Luuk van Dijk
aac144b120 gc: detect type switch variable not used cases.
Fixes #873
Fixes #2162

R=rsc
CC=golang-dev
https://golang.org/cl/5341043
2011-11-04 17:03:50 +01:00
Rob Pike
88cf76a9b3 gob: fix bug when registering the same type multiple times
Need to compare user type, not base type.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5340041
2011-11-03 18:05:14 -07:00
Vincent Vanackere
eb1717e035 all: rename os.EOF to io.EOF in various non-code contexts
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5334050
2011-11-03 14:01:30 -07:00
Rob Pike
f4cd80224a encoding: move asn1, csv, gob, json, xml into encoding
This is Go 1 package renaming CL #1.
This one merely moves the source; the import strings will be
changed after the next weekly release.

The only edits are in Makefiles.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5331060
2011-11-03 11:39:52 -07:00
Russ Cox
965845a86d all: sort imports
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5319072
2011-11-02 15:54:16 -04: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
7f91a39d3d encoding/binary: fix type in test
Was working only accidentally.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5303082
2011-10-27 19:38:57 -07:00
Robert Griesemer
f7467e85e1 encoding/binary: added benchmarks
binary.BenchmarkPutUvarint32 20000000	 85.6 ns/op
binary.BenchmarkPutUvarint64 10000000	299   ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/5148049
2011-10-05 13:04:43 -07:00
Robert Griesemer
61cc8728fb encoding/binary: PutX functions require buffer of sufficient size.
R=rsc
CC=golang-dev
https://golang.org/cl/5163041
2011-09-29 09:40:59 -07:00
Robert Griesemer
f30719dc89 encoding/binary: support for varint encoding
R=rsc, r, nigeltao, r, dsymonds
CC=golang-dev
https://golang.org/cl/5146048
2011-09-28 22:36:52 -07:00
Robert Griesemer
90564a9256 go/printer: changed max. number of newlines from 3 to 2
manual changes in src/pkg/go/printer, src/cmd/gofix/signal_test.go
(cd src/cmd/gofix/testdata; gofmt -w *.in *.out)
(cd src/pkg/go/printer; gotest -update)
gofmt -w misc src

runs all tests

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4715041
2011-07-14 14:39:40 -07:00
Brad Fitzpatrick
dcdaeebdfb docs: fix wrong it's -> its
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4702046
2011-07-13 10:54:51 -07:00
Russ Cox
21e75da486 respect goto restrictions
R=gri
CC=golang-dev
https://golang.org/cl/4625044
2011-06-17 06:07:13 -04:00
Adam Langley
c72dbaf312 encoding/hex: don't try to print DEL.
R=agl
CC=golang-dev
https://golang.org/cl/4551081
2011-05-31 15:40:33 -04:00
Adam Langley
de15f6165e encoding/hex: add hex dumping.
I found this useful, esp with an io.MultiWriter. But I fear that
it may be bloat in such a low-level package so please feel free to
decline if you feel likewise.

R=rsc, ality
CC=golang-dev
https://golang.org/cl/4530088
2011-05-31 12:58:09 -04:00
Brad Fitzpatrick
f7a266a5aa encoding/binary: add a non-reflect fast path for Write
before/after:
binary.BenchmarkWrite	  100000	     18312 ns/op
binary.BenchmarkWrite	  500000	      4468 ns/op

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4515154
2011-05-27 16:29:33 -07:00
Brad Fitzpatrick
3648a03b3a encoding/binary: add a non-reflect fast path for Read
before/after:
binary.BenchmarkRead  200000     10860 ns/op
binary.BenchmarkRead  500000      2846 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/4547062
2011-05-26 09:01:05 -07:00
Brad Fitzpatrick
1b6bf88767 encoding/base64: add DecodeString and EncodeToString
... like encoding/hex. Same signatures.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4530070
2011-05-25 12:24:36 -07:00
Rob Pike
b3d3762b2e encoding/line: delete package.
Its functionality is now in bufio.
Fixes #1869.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4553061
2011-05-24 16:05:26 +10:00
Robert Hencke
c8727c81bb pkg: spelling tweaks, A-H
R=ality, bradfitz, rsc, dsymonds, adg, qyzhai, dchest
CC=golang-dev
https://golang.org/cl/4536063
2011-05-18 13:14:56 -04:00
Russ Cox
07abf1c732 fix tree for reflect rename
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4435067
2011-04-25 13:39:36 -04: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
Russ Cox
4c006182dc pkg: manual cleanup of some gofixed code
R=golang-dev, niemeyer, r
CC=golang-dev
https://golang.org/cl/4372052
2011-04-13 23:36:00 -04:00
Russ Cox
db5c5d6fa6 update go tree for reflect changes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4353043
2011-04-08 12:27:58 -04:00
Adam Langley
5311d915f4 encoding/line: fix line returned after EOF
Fixes #1509.

R=r
CC=golang-dev
https://golang.org/cl/4167045
2011-02-15 09:52:20 -05:00
Andrew Gerrand
4774a19530 encoding/binary: update package doc string to be more comprehensive
R=r
CC=golang-dev
https://golang.org/cl/4128060
2011-02-11 06:56:31 +11:00
Brad Fitzpatrick
3aee82b660 encoding/line: make it an io.Reader too
R=agl1, bradfitzwork, rsc
CC=golang-dev
https://golang.org/cl/4066043
2011-01-26 09:59:53 -05:00
Rob Pike
4871d0d19a encoding/line: fix up a few typos and infelicities in the doc comments
R=anschelsc, agl1
CC=golang-dev
https://golang.org/cl/3988045
2011-01-24 10:19:23 -08:00
Miek Gieben
40c7449044 encoding/base32: new package
R=rsc
CC=Miek Gieben, golang-dev
https://golang.org/cl/3926041
2011-01-20 12:51:15 -05: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
699864b696 encoding/line: fix error call (missing argument)
R=agl1, rsc
CC=golang-dev
https://golang.org/cl/3861044
2011-01-12 00:25:29 -08:00
Adam Langley
66a45b486b encoding/line: add
I needed a way to read lines without worrying about \n and \r\n.

R=r, rsc
CC=golang-dev
https://golang.org/cl/2859041
2011-01-08 10:29:37 -05:00
Patrick Gavlin
236f9638b4 encoding/binary: reject types with implementation-dependent sizes
Fixes #1201.

R=rsc
CC=golang-dev
https://golang.org/cl/3787044
2011-01-04 13:42:50 -05: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
Russ Cox
1451695f86 encoding/binary: give LittleEndian, BigEndian specific types
Giving them specific types has the benefit that
binary.BigEndian.Uint32(b) is now a direct call, not an
indirect via a mutable interface value, so it can potentially
be inlined.

Recent changes to the spec relaxed the rules for comparison,
so this code is still valid:

	func isLittle(o binary.ByteOrder) { return o == binary.LittleEndian }

The change does break this potential idiom:

	o := binary.BigEndian
	if foo {
		o = binary.LittleEndian
	}

That must rewrite to give o an explicit binary.ByteOrder type.
On balance I think the benefit from the direct call and inlining
outweigh the cost of breaking that idiom.

R=r, r2
CC=golang-dev
https://golang.org/cl/2427042
2010-10-21 11:25:14 -04:00
Russ Cox
10b53867e8 encoding/hex: fix typo
Thanks to avadh4all for spotting it.

Fixes #1214.

R=r, r2
CC=golang-dev
https://golang.org/cl/2616041
2010-10-20 16:38:57 -04: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
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
Roger Peppe
b92db49c26 encoding/binary: add complex
R=rsc
CC=golang-dev
https://golang.org/cl/1879043
2010-08-06 16:44:38 -07:00
Russ Cox
36560d2b4a pem: print \n after 1 header line too
rearrange to make reason for if clear.

Fixes #911.

R=agl1
CC=golang-dev
https://golang.org/cl/1774044
2010-07-12 16:48:49 -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
Russ Cox
bb84f4b5d2 changes &x -> x[0:] for array to slice conversion
R=gri
CC=golang-dev
https://golang.org/cl/1326042
2010-05-27 14:51:47 -07:00
Giles Lean
0ed8231e69 encoding/base64: fix typo in comment
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/258041
2010-03-08 18:12:25 -08:00
Rob Pike
90367756bb encoding/binary: fix error reporting bug
R=rsc
CC=golang-dev
https://golang.org/cl/224096
2010-03-03 12:35:16 -08:00
Robert Griesemer
f44fa9b4c7 gofmt: experiment: align values in map composites where possible
- gofmt -w src misc
- looking for feedback

R=rsc, r
CC=golang-dev
https://golang.org/cl/223076
2010-03-02 13:46:51 -08:00
Russ Cox
9750adbbad strings: delete Runes, Bytes
gofmt -w -r 'strings.Bytes(a) -> []byte(a)' src/cmd src/pkg test/bench
gofmt -w -r 'strings.Runes(a) -> []int(a)' src/cmd src/pkg test/bench
delete unused imports

R=r
CC=golang-dev
https://golang.org/cl/224062
2010-02-25 16:01:29 -08:00
Adam Langley
d5841cac45 encoding/pem: add marshalling support.
R=rsc
CC=golang-dev
https://golang.org/cl/203043
2010-02-07 15:22:36 -05:00
Russ Cox
8b8c103b2b fix build - misc ... vs ...T fixes
TBR=r
CC=golang-dev
https://golang.org/cl/198081
2010-02-02 18:19:27 -08: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
Maxim Ushakov
349095885e encoding/binary: Add support for slices of arrays of fixed-size values.
R=rsc
CC=krasin
https://golang.org/cl/167050
2009-12-11 13:04:03 -08:00
Robert Griesemer
295ceb4526 remove uses of string concatenation from src and misc directory
R=rsc
https://golang.org/cl/172041
2009-12-09 16:54:07 -08:00
Rob Pike
b0683bd77a move ReadFile, WriteFile, and ReadDir into a separate io/ioutil package.
this breaks the dependency of package io on package bytes.

R=rsc
CC=golang-dev
https://golang.org/cl/163085
2009-12-02 22:02:14 -08:00
Christopher Wedgwood
c78710f53e Add trivial whitespace to CorruptInputError strings.
R=r, rsc
https://golang.org/cl/161058
2009-11-30 12:03:10 -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
e70cedfaec remove bytes.Copy
replace all calls with calls to copy
use copy in regexp and bytes.Buffer

R=rsc
CC=golang-dev
https://golang.org/cl/157073
2009-11-18 15:24:24 -08:00
Môshe van der Sterre
a54684f8da encoding/binary: implemented the Write function
The ByteOrder.Put* methods are already available, this change uses
them to implement the Write function.

R=golang-dev, agl1, rsc, r
https://golang.org/cl/152141
2009-11-14 14:42:22 -08:00
Russ Cox
933d1850ce typos
Fixes #171.
Fixes #172.

R=agl1
https://golang.org/cl/154136
2009-11-14 10:28:53 -08:00
David Symonds
9e829c42d6 Fix capitalisation of "Git".
R=rsc
https://golang.org/cl/154071
2009-11-11 17:31:28 -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
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
d3d3accdb7 gofmt-ify io, json, runtime, encoding
R=rsc
http://go/go-review/1017056
2009-11-05 15:37:55 -08:00
Robert Griesemer
12dbd06f0a gofmt-ify encoding
R=rsc
http://go/go-review/1017048
2009-11-05 08:55:18 -08:00
Russ Cox
cc1a979272 package patch
R=r
http://go/go-review/1018043
2009-11-04 17:55:06 -08:00
Adam Langley
93253a870c encoding/*: reverse the order of src, dst so that dst is first.
R=rsc
CC=go-dev
http://go/go-review/1017021
2009-11-03 17:32:08 -08:00
Adam Langley
72ec930fa7 Fix cgo for GCC 4.4
Firstly, with -Werror, GCC switched to printing warnings starting
with "error:". Widening the string matches solves this as the messages
are otherwise unchanged.

Secondly, GCC 4.4 outputs DWARF sections with with NUL bytes in all
the offsets and requires the relocation section for .debug_info to be
processed in order to result in valid DWARF data. Thus we add minimal
handling for relocation sections, which is sufficient for our needs.

BUG=1
Fixes #1.

R=rsc, iant
CC=go-dev
http://go/go-review/1017003
2009-11-02 12:02:16 -08:00
Russ Cox
7732d80ceb misc cleanup
R=r
http://go/go-review/1016017
2009-11-01 09:25:55 -08:00
Adam Langley
569a1cd545 Add encoding/hex
R=rsc
http://go/go-review/1015012
2009-10-26 16:34:36 -07:00
Adam Langley
7d68093f93 Fix typo in documentation.
R=r
APPROVED=r
DELTA=2  (1 added, 0 deleted, 1 changed)
OCL=35977
CL=35977
2009-10-21 19:47:52 -07:00
Adam Langley
fd74a835bc Add initial x509 code.
R=rsc
APPROVED=rsc
DELTA=659  (659 added, 0 deleted, 0 changed)
OCL=35932
CL=35975
2009-10-21 17:53:50 -07:00
Russ Cox
357b770def base64 -> encoding/base64
base85 -> encoding/ascii85, encoding/git85
debug/binary -> encoding/binary

R=r
DELTA=3190  (1884 added, 1297 deleted, 9 changed)
OCL=35923
CL=35929
2009-10-20 13:00:16 -07:00