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

116 Commits

Author SHA1 Message Date
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
Rob Pike
8a90fd3c72 os: New Open API.
We replace the current Open with:
OpenFile(name, flag, perm) // same as old Open
Open(name) // same as old Open(name, O_RDONLY, 0)
Create(name) // same as old Open(name, O_RDWR|O_TRUNC|O_CREAT, 0666)

This CL includes a gofix module and full code updates: all.bash passes.
(There may be a few comments I missed.)

The interesting packages are:
        gofix
        os
Everything else is automatically generated except for hand tweaks to:
        src/pkg/io/ioutil/ioutil.go
        src/pkg/io/ioutil/tempfile.go
        src/pkg/crypto/tls/generate_cert.go
        src/cmd/goyacc/goyacc.go
        src/cmd/goyacc/units.y

R=golang-dev, bradfitzwork, rsc, r2
CC=golang-dev
https://golang.org/cl/4357052
2011-04-04 23:42:14 -07:00
Ian Lance Taylor
554082d6b1 testing: add -test.timeout option.
Since Go code can deadlock, this lets a testsuite driver set a
time limit for the test to run.  This is simple but imperfect,
in that it only catches deadlocks in Go code, not in the
runtime scheduler.

R=r, rsc, iant2
CC=golang-dev
https://golang.org/cl/4326048
2011-03-31 15:27:51 -07:00
Rob Pike
f0cf7d296c testing: shorten some tests.
These are the top runners.  More to come.
Also print two digits of timing info under -test.v.

R=rsc
CC=golang-dev
https://golang.org/cl/4317044
2011-03-25 16:31:10 -07:00
Rob Pike
d406f8f650 testing: set up structure for faster testing using the new -test.short flag.
New make target "testshort" runs "gotest -test.short" and is invoked
by run.bash, which is invoked by all.bash.

Use -test.short to make one package (crypto ecdsa) run much faster.
More changes to come.

Once this is in, I will update the long-running tests to use the new flag.

R=rsc
CC=golang-dev
https://golang.org/cl/4317043
2011-03-25 14:50:44 -07:00
Russ Cox
543acc97f9 testing: add -test.cpuprofile flag
R=r
CC=golang-dev
https://golang.org/cl/4272066
2011-03-23 18:17:14 -04:00
Rob Pike
afaa30694c testing: add -test.memprofile and -test.memprofilerate flags.
These allow a test to generate memory profiles automatically.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4273064
2011-03-16 09:53:58 -07:00
Russ Cox
3f915f51a8 go code: replace closed(c) with x, ok := <-c
R=golang-dev, rog, bradfitzwork, r
CC=golang-dev
https://golang.org/cl/4243072
2011-03-11 14:47:44 -05:00
Roger Peppe
da833474f5 testing: run GC before each benchmark run.
R=r, rh, gri, rsc
CC=golang-dev
https://golang.org/cl/4237055
2011-03-03 11:26:53 -08:00
Kyle Consalus
07cc8b9ad2 Make.pkg, doc: Replace references to "-benchmarks" and "-match" with "-test.bench" and "-test.run".
R=r
CC=golang-dev
https://golang.org/cl/4197041
2011-02-22 20:23:21 -08:00
David Symonds
1634390fb1 testing: Fix typo on Logf doc comment.
R=rsc, r2
CC=golang-dev
https://golang.org/cl/4167064
2011-02-22 10:12:18 +11:00
Gustavo Niemeyer
6d9db54be5 testing: rename cmdline flags to avoid conflicts
Flags defined in the testing package may conflict
with real flags defined in the main package, or in
any other imported package.

This change makes them less likely to be used for
other purposes.

R=r, rsc, r2
CC=golang-dev
https://golang.org/cl/4167055
2011-02-17 16:17:33 -08:00
Russ Cox
a93c994bcf testing: include elapsed time in output
R=r
CC=golang-dev
https://golang.org/cl/4180045
2011-02-11 18:00:58 -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
Eoghan Sherry
04a231d406 testing: fix error message on invalid regexp
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/3831041
2010-12-23 11:40:10 +11:00
Roger Peppe
089c21ea52 testing: delete redundant name argument to Benchmark().
[it was a carry over from the previous iteration]

R=r
CC=golang-dev
https://golang.org/cl/3016041
2010-11-10 09:39:26 -08:00
Peter Mundy
3b44fbe869 testing: rename type Test to InternalTest
type Benchmark has been renamed to InternalBenchmark

R=rsc
CC=golang-dev
https://golang.org/cl/2942042
2010-11-05 23:05:53 -04:00
Roger Peppe
270bad3939 testing: add Benchmark to allow benchmarks to be run without gotest.
R=rsc
CC=golang-dev
https://golang.org/cl/2506042
2010-11-01 16:15:17 -04: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
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
d86ab015f7 use copy
R=gri
CC=golang-dev
https://golang.org/cl/2763041
2010-10-26 21:52:54 -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
12da5a90e0 log: new interface
New logging interface simplifies and generalizes.

1) Loggers now have only one output.
2) log.Stdout, Stderr, Crash and friends are gone.
	Logging is now always to standard error by default.
3) log.Panic* replaces log.Crash*.
4) Exiting and panicking are not part of the logger's state; instead
	the functions Exit* and Panic* simply call Exit or panic after
	printing.
5) There is now one 'standard logger'.  Instead of calling Stderr,
	use Print etc.  There are now triples, by analogy with fmt:
		Print, Println, Printf
	What was log.Stderr is now best represented by log.Println,
	since there are now separate Print and Println functions
	(and methods).
6) New functions SetOutput, SetFlags, and SetPrefix allow global
	editing of the standard logger's properties.   This is new
	functionality. For instance, one can call
		log.SetFlags(log.Lshortfile|log.Ltime|log.Lmicroseconds)
	to get all logging output to show file name, line number, and
	time stamp.

In short, for most purposes
	log.Stderr -> log.Println or log.Print
	log.Stderrf -> log.Printf
	log.Crash -> log.Panicln or log.Panic
	log.Crashf -> log.Panicf
	log.Exit -> log.Exitln or log.Exit
	log.Exitf -> log.Exitf (no change)

This has a slight breakage: since loggers now write only to one
output, existing calls to log.New() need to delete the second argument.
Also, custom loggers with exit or panic properties will need to be
reworked.

All package code updated to new interface.

The test has been reworked somewhat.

The old interface will be removed after the new release.
For now, its elements are marked 'deprecated' in their comments.

Fixes #1184.

R=rsc
CC=golang-dev
https://golang.org/cl/2419042
2010-10-12 12:59:18 -07: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
Rob Pike
4fb5883253 testing: delete the less useful methods in the testing regexp package
We can add them back using the new naming scheme should it become important.

R=rsc
CC=golang-dev
https://golang.org/cl/1968042
2010-08-12 16:47:52 +10: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
6672b40c09 remove uses of ... from tree, add one test
R=r
CC=golang-dev
https://golang.org/cl/1662041
2010-06-14 11:23:11 -07:00
Christopher Wedgwood
3fbe7f4f41 testing: update documentation to match current coding style
R=rsc, r
CC=golang-dev
https://golang.org/cl/823045
2010-04-11 10:18:49 -07:00
Rob Pike
b12007c4ed testing/regexp: use recover.
R=rsc
CC=golang-dev
https://golang.org/cl/816042
2010-03-31 17:57:50 -07:00
Robert Griesemer
5a716206a4 fix build
R=r
CC=golang-dev
https://golang.org/cl/790041
2010-03-26 16:33:59 -07:00
Rob Pike
7ffe938f08 regexp: don't return non-nil *Regexp if there is an error.
R=gri
CC=golang-dev
https://golang.org/cl/787041
2010-03-26 16:18:20 -07:00
Rob Pike
325cf8ef21 delete all uses of panicln by rewriting them using panic or,
in the tests, println+panic.
gofmt some tests too.

R=rsc
CC=golang-dev
https://golang.org/cl/741041
2010-03-24 16:46:53 -07:00
Robert Griesemer
53f3d0733c gofmt: more consistent formatting of const/var decls
- gofmt -w src misc
- only manually modified file: src/pkg/go/printer/nodes.go

R=rsc
CC=golang-dev, r
https://golang.org/cl/606041
2010-03-16 16:45:54 -07:00
Russ Cox
fe746055a2 testing/benchmark: paranoia - make sure n always grows
R=wcn
CC=golang-dev
https://golang.org/cl/223075
2010-02-26 17:18:43 -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
Evan Shaw
abe6a5b0f7 testing: Fix comment typo
R=iant, rsc
CC=golang-dev
https://golang.org/cl/204068
2010-02-07 23:11:54 -08:00
Rob Pike
d2fc5d68da Change type of Printf's args to ... interface{}
R=rsc
CC=golang-dev
https://golang.org/cl/197043
2010-02-02 10:53:37 +11:00
Robert Griesemer
45ca9f7a9e 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

5th and last set of files.

R=rsc
CC=golang-dev
https://golang.org/cl/180050
2009-12-15 15:41:46 -08:00
Robert Griesemer
222462ed4f Various cleanups:
- no need to replace comments for stand-alone blocks
- always print string concatenations with interspersed "+"
  (remove option)
- minor cleanups

R=rsc
https://golang.org/cl/174076
2009-12-11 16:42:14 -08:00
Russ Cox
11384eecf8 testing: compute MB/s in benchmarks
R=r
https://golang.org/cl/166060
2009-12-04 09:56:31 -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
Rob Pike
b050a1b223 Fix doc striing for NewReadLogger.
Fixes #315.

R=rsc
https://golang.org/cl/157140
2009-11-23 13:51:10 -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
Trevor Strohman
61660adc63 Adds benchmark support to gotest.
No benchmarks are run unless the --benchmarks=<regexp> flag
is specified on the gotest command line.  This change includes
sample benchmarks for regexp.

% gotest --benchmarks=.*
(standard test output redacted)
testing.BenchmarkSimpleMatch	200000	      7799 ns/op
testing.BenchmarkUngroupedMatch	20000	     76898 ns/op
testing.BenchmarkGroupedMatch	50000	     38148 ns/op

R=r, rsc
https://golang.org/cl/154173
2009-11-19 16:35:34 -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
Russ Cox
b351113b50 make regexp comment not a package comment
R=r
http://go/go-review/1025036
2009-11-10 09:36:48 -08:00
Robert Griesemer
3bb0032cd6 - replaced gofmt expression formatting algorithm with
rsc's algorithm
- applied gofmt -w misc src
- partial CL (last chunk)

R=rsc, r
http://go/go-review/1024041
2009-11-09 21:23:52 -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
45cba57e89 gofmt'ed more stragglers
R=rsc
http://go/go-review/1019004
2009-11-05 18:26:16 -08:00
Adam Langley
4f2ec03416 Add testing/script.
R=rsc, r
CC=go-dev
http://go/go-review/1016001
2009-11-03 12:47:06 -08:00
Rob Pike
cd82d490fc eliminate goroutine from testing/regexp too.
R=rsc
CC=go-dev
http://go/go-review/1018021
2009-11-02 11:24:47 -08:00
Adam Langley
878d0e1efd Add a quickcheck package which is a little like the Haskell one of the same
name.

R=rsc
APPROVED=rsc
DELTA=566  (566 added, 0 deleted, 0 changed)
OCL=35974
CL=36111
2009-10-28 15:16:20 -07:00
Russ Cox
094f1d5990 more lgtm files from gofmt
R=gri
OCL=35485
CL=35488
2009-10-08 15:14:54 -07:00
Russ Cox
91549438d8 apply gofmt to rand reflect regexp rpc runtime sort strconv strings sync syscall testing time unicode unsafe utf8
R=gri
DELTA=1409  (79 added, 24 deleted, 1306 changed)
OCL=35415
CL=35437
2009-10-07 11:55:06 -07:00
David Symonds
c17dde2730 Add write support for the GNU tar binary numeric field extension.
R=rsc
APPROVED=rsc
DELTA=102  (89 added, 1 deleted, 12 changed)
OCL=35321
CL=35327
2009-10-05 04:08:24 -07:00
Russ Cox
28eba4877b fix "declared and not used" errors in non-test code.
R=r
DELTA=112  (6 added, 57 deleted, 49 changed)
OCL=34610
CL=34610
2009-09-14 17:20:29 -07:00
Austin Clements
2364f8c30c Don't crash for regexps > 19 characters.
R=r
APPROVED=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=34216
CL=34220
2009-09-01 16:46:16 -07:00
Ian Lance Taylor
221d0567e3 Run the tests for the testing package. Fix them so that they
work.

R=rsc
DELTA=16  (1 added, 1 deleted, 14 changed)
OCL=34012
CL=34038
2009-08-28 11:44:46 -07:00
Russ Cox
29415d0557 fix bufio bugs involving readers that return os.EOF with
the last bit of data.

add a new iotest.DataErrReader for tests

R=r
DELTA=93  (41 added, 31 deleted, 21 changed)
OCL=33897
CL=33915
2009-08-26 16:23:34 -07:00
Russ Cox
b04ac108fd convert non-low-level non-google pkg code
to whole-package compilation.

R=r
OCL=33070
CL=33101
2009-08-12 13:19:17 -07:00
Rob Pike
68e250516c make a simpler regexp implementation with fewer dependencies and put it inside testing.
remove "regexp." from regexp tests.

R=rsc
DELTA=1173  (1152 added, 1 deleted, 20 changed)
OCL=33028
CL=33037
2009-08-11 13:54:47 -07:00
Rob Pike
3355cadf3f support []byte (more efficient) as well as string in the interfaces.
change the names; Match is for []byte and MatchString is for string, etc.

R=rsc
DELTA=195  (155 added, 0 deleted, 40 changed)
OCL=32800
CL=32800
2009-08-05 15:44:45 -07:00
Rob Pike
d90e7cbac6 mv src/lib to src/pkg
tests: all.bash passes, gobuild still works, godoc still works.

R=rsc
OCL=30096
CL=30102
2009-06-09 09:53:44 -07:00