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

3130 Commits

Author SHA1 Message Date
Jeff Hodges
eac86fd3f0 cmd/go: pass env CGO_CFLAGS to cgo
Passing the CGO_CFLAGS to cgo is required to make alternative include
directories work when building a cgo project.

R=rsc
CC=golang-dev
https://golang.org/cl/5635048
2012-02-06 11:26:15 -05:00
Luuk van Dijk
0b9f090861 cmd/gc: another special (%hhS) case for method names.
Fixes #2877

R=rsc
CC=golang-dev
https://golang.org/cl/5637047
2012-02-06 16:38:59 +01:00
Luuk van Dijk
5efd5624cc cmd/gc: fix codegen reordering for expressions involving && and ||
Fixes #2821.

R=rsc
CC=golang-dev
https://golang.org/cl/5606061
2012-02-06 15:41:01 +01:00
Luuk van Dijk
419c53af30 gc: don't print implicit type on struct literal in export
As pointed out in the discussion around 2678.

R=rsc
CC=golang-dev
https://golang.org/cl/5534077
2012-02-06 12:19:59 +01:00
Kyle Lemons
cb0de68a08 cmd/go: build: print import errors when invoked on files
This fix makes the goFilesPackage helper function print the errors from
      package imports and exit similar to how the packagesForBuild function does.

      Without this change, when invoking "go build *.go" with, for example,
      an old import path, the following stack trace is generated:

      panic: runtime error: invalid memory address or nil pointer dereference

      goroutine 1 [running]:
      go/build.(*Tree).PkgDir(...)
              /opt/go/src/pkg/go/build/path.go:52 +0xfb
      main.(*builder).action(...)
              /opt/go/src/cmd/go/build.go:327 +0xb8
      main.(*builder).action(...)
              /opt/go/src/cmd/go/build.go:335 +0x208
      main.runBuild(...)
              /opt/go/src/cmd/go/build.go:129 +0x386
      main.main()
              /opt/go/src/cmd/go/main.go:126 +0x2d8

Fixes #2865.

R=rsc, dvyukov, r
CC=golang-dev
https://golang.org/cl/5624052
2012-02-06 14:10:03 +11:00
Alex Brainman
c06bd52a2e cmd/dist: fix bug in bsubst
R=golang-dev, r, dsymonds, akumar
CC=golang-dev
https://golang.org/cl/5624054
2012-02-05 15:16:39 +11:00
Gustavo Niemeyer
1d69b12445 cmd/dist: add GOBIN to env's output
clean.bash depends on it being set.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5630056
2012-02-05 00:35:08 -02:00
Russ Cox
57b7bbe988 cmd/dist: fix memory bug (fix builders?)
Thanks, Valgrind!

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5630050
2012-02-04 02:15:53 -05:00
Russ Cox
a19ab9d1cc cmd/dist: fix arm build
5l does not use the whole set of ld files
like the other linkers do.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5629052
2012-02-04 02:01:58 -05:00
Russ Cox
650e8de0a5 cmd/dist: more build fixes
Flush stdout before writing to stderr, to avoid
reordering output.

Allow amd64 from uname -m (FreeBSD).

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5629051
2012-02-04 01:46:46 -05:00
Russ Cox
68576506d6 cmd/dist: add BSD gohostos cases
Should fix FreeBSD build.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5629050
2012-02-04 01:39:29 -05:00
Russ Cox
b8b2253ac7 cmd/dist: fix build
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5630049
2012-02-04 01:23:54 -05:00
Russ Cox
4c1abd6c64 build: dist-based build for windows
R=golang-dev, bradfitz, iant, alex.brainman, go.peter.90
CC=golang-dev
https://golang.org/cl/5630047
2012-02-04 00:48:31 -05:00
Mikio Hara
67b277c3b9 cmd/dist: fix build on openbsd
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5608060
2012-02-04 13:27:12 +09:00
Russ Cox
c6c00ed482 cmd/dist: generate files for package runtime
goc2c moves here.
parallel builds like old makefiles (-j4).
add clean command.
add banner command.
implement Go version check.
real argument parsing (same as 6g etc)

Windows changes will be a separate CL.

R=golang-dev, bradfitz, iant
CC=golang-dev
https://golang.org/cl/5622058
2012-02-03 18:16:42 -05:00
Rob Pike
2783691522 docs: replace references to gofix etc. with tool invocations
R=rsc
CC=golang-dev
https://golang.org/cl/5630045
2012-02-04 07:49:51 +11:00
Rob Pike
1f565e7d20 tools: update references to "x" to be "go tool x"
For instance, don't talk about gofix, talk about the
fix tool or "go tool fix".

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5608053
2012-02-04 07:03:20 +11:00
Robert Griesemer
f6f5ce87cd godoc: fix identifier search
Thanks to Andrey Mirtchovski for tracking this down.

This was broken by CL 5528077 which removed the InsertSemis
flag from go/scanner - as a result, semicolons are now always
inserted and the respective indexer code checked for the
wrong token.

Replaced the code by a direct identifier test.

R=rsc
CC=golang-dev
https://golang.org/cl/5606065
2012-02-03 09:20:53 -08:00
Robert Griesemer
bd41831f66 godoc: diagnostic for empty FS tree
R=adg
CC=golang-dev
https://golang.org/cl/5615055
2012-02-03 08:33:29 -08:00
Russ Cox
0f78ee574b 5a, 6a, 8a, cc: check in y.tab.[ch]
This enables builds on systems without Bison/yacc.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5622050
2012-02-03 10:53:51 -05:00
Russ Cox
d53cdd1775 gc: check in y.tab.[ch], yerr.h, builtin.c.
This enables builds on systems without Bison/yacc.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5622051
2012-02-03 10:53:31 -05:00
Gustavo Niemeyer
7207898fe4 cmd/go: add support for release tags via git branches
R=rsc, remyoudompheng, gustavo, dsymonds
CC=golang-dev
https://golang.org/cl/5617057
2012-02-03 03:03:13 -02:00
Russ Cox
b3750ff52d build: rename $GOROOT/bin/go-tool to $GOROOT/bin/tool.
The go- is redundant now that the directory is required
to be inside $GOROOT.  Rob LGTMed the idea.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5618044
2012-02-02 23:32:41 -05:00
Nigel Tao
9de9c95787 vet: add a check for untagged struct literals.
R=rsc, dsymonds
CC=golang-dev, gri
https://golang.org/cl/5622045
2012-02-03 14:33:41 +11:00
Gustavo Niemeyer
20f4385af0 os: turn FileStat.Sys into a method on FileInfo
This reduces the overhead necessary to work with OS-specific
file details, hides the implementation of FileStat, and
preserves the implementation-specific nature of Sys.

Expressions such as:

  stat.(*os.FileInfo).Sys.(*syscall.Stat_t).Uid
  fi1.(*os.FileStat).SameFile(fi2.(*os.FileStat))

Are now spelled as::

  stat.Sys().(*syscall.Stat_t).Uid
  os.SameFile(fi1, fi2)

R=cw, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5448079
2012-02-03 00:16:18 -02:00
Russ Cox
3dd1e5be54 cmd/dist: new command
dist is short for distribution.  This is the new Go distribution tool.

The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.

It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.

This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap).  I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.

This tool is not nearly as nice as the go tool.  There are many
special cases that turn into simple if statements or tables in
the code.  Please forgive that.  C does not enjoy the benefits
that we designed into Go.

I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments.  Make thinks it is invoking

        quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c

but bash (quietgcc is a bash script) thinks it is being invoked as

        quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c

which obviously does not have the desired effect.  Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.

It is big for a single CL, and for that I apologize.  I can cut it into
separate CLs along file boundaries if people would prefer that.

R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
Rémy Oudompheng
e489ab8ecc cmd/go: fix error message on non-existing tools.
R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5617053
2012-02-02 23:52:30 +01:00
Anthony Martin
4b6cd239c5 gc: describe debugging flags
The change to -m is the only one necessary
to close the issue.  The others are useful
to know about when debugging but shouldn't
be in the usage message since they may go
away or change at any time.

Fixes #2802.

R=lvd, rsc
CC=golang-dev
https://golang.org/cl/5606046
2012-02-02 14:02:54 -08:00
Nigel Tao
df7f34dd2b vet: fix comment typo.
R=rsc, gri
CC=golang-dev
https://golang.org/cl/5620049
2012-02-02 17:53:28 +11:00
Andrew Gerrand
40b7e814e5 godoc: update metadata in appinit.go
R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/5619050
2012-02-02 15:18:33 +11:00
Robert Griesemer
f3f5239d1e all packages: fix various typos
Detected semi-automatically. There are probably more.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5620046
2012-02-01 16:19:36 -08:00
Gustavo Niemeyer
9fb24b9448 cmd/go: fix including of _cgo_export.h
This will add the temporary object directory into the lookup
path so that cgo-exported function declarations may be
included from C files.

This was previously applied by CL 5600043, and apparently
removed by mistake on CL 5598045.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5610054
2012-02-01 16:07:32 -02:00
Sameer Ajmani
702151a200 godoc: fix redirect loop for URL "/".
R=golang-dev, bradfitz, rsc, adg
CC=golang-dev
https://golang.org/cl/5606045
2012-02-01 09:43:22 -05:00
Anthony Martin
e280035fc1 gc, cc: avoid using the wrong library when building the compilers
This can happen on Plan 9 if we we're building
with the 32-bit and 64-bit host compilers, one
after the other.

R=rsc
CC=golang-dev
https://golang.org/cl/5599053
2012-02-01 04:14:37 -08:00
Anthony Martin
6273d6e713 build: move the "-c" flag into HOST_CFLAGS
On Plan 9 this flag is used to discover
constant expressions in "if" statements.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5601060
2012-01-31 19:31:30 -08:00
Anthony Martin
8039683cef gc: use octal escapes in mkopnames
Plan 9's tr(1) doesn't accept the C-style escapes
for tab and newline characters.  I was going to use
the \xFF hexadecimal escapes but GNU tr(1) doesn't
accept those.  It seems octal is the least common
denominator.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5576079
2012-01-31 18:15:42 -08:00
Russ Cox
42526e2187 cmd/go: improvements
Print all the syntax errors.  Fixes issue 2811.

Change Windows binary removal strategy.
This should keep the temporary files closer to
the binaries they are for, which will make it
more likely that the rename is not cross-device
and also make it easier to clean them up.
Fixes #2604 (as much as we can).

The standard build does not use the go command
to install the go command anymore, so issue 2604
is less of a concern than it originally was.
(It uses the go_bootstrap command to install
the go command.)

Buffer 'go list' output.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5604048
2012-01-31 18:44:20 -05:00
Russ Cox
0f1056667f cmd/go: improvements
Do not treat $GOROOT/src/pkg, $GOROOT/src/cmd,
$GOPATH/src as package directories (only subdirectories
of those can be package directories).  Fixes issue 2602.

Accept additional compiler and linker arguments during
cgo from $CGO_CFLAGS and $CGO_LDFLAGS, as the
Makefiles used to do.

Show failed pkg-config output.  Fixes issue 2785.

Use different (perhaps better) git commands.  Fixes issue 2109.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5605045
2012-01-31 17:40:36 -05:00
Rémy Oudompheng
e818536500 go: record location of failed imports for error reporting.
Fixes #2664.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5593047
2012-01-31 23:37:01 +01:00
Russ Cox
33f3afa7af gc: diagnose \ in import path
R=ken2
CC=golang-dev
https://golang.org/cl/5609044
2012-01-31 17:29:59 -05:00
Russ Cox
64a73b0355 cmd/go: improvements
Print build errors to stderr during 'go run'.
Stream test output during 'go test' (no args).  Fixes issue 2731.
Add go test -i to install test dependencies.  Fixes issue 2685.
Fix data race in exitStatus.  Fixes issue 2709.
Fix tool paths.  Fixes issue 2817.

R=golang-dev, bradfitz, n13m3y3r, r
CC=golang-dev
https://golang.org/cl/5591045
2012-01-31 15:08:20 -05:00
Rémy Oudompheng
d7172084d0 cmd/go: fix handling of gccgo standard library.
The previous logic was mainly non-working. It only needs to
ensure that the go tool doesn't try to build the standard
library with gccgo.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5580051
2012-01-31 19:41:38 +01:00
Robert Griesemer
3c6bebf5a7 go/doc: enable AllMethods flag (and fix logic)
- enable AllMethods flag (default: not set)
- fix logic determining which methods to show
- added respective test case in testdata/e.go for AllMethods = false
- added test case set for AllMethods = true

The critical changes/files to look at are:
- testdata/e{0,1,2}.golden: T4.M should only show up as method of T5 in e2.golden
- reader.go: always include top-level methods, and negate former logic for embedded methods
  (rewrote as a switch for better comprehensability)

Fixes #2791.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5576057
2012-01-31 09:48:10 -08:00
Shenghou Ma
2d64bab1de 5l: optimize the common case in patch()
If p->to.sym->text is non-nil, then no need to search for sym->value.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5601046
2012-01-31 10:59:34 -05:00
Shenghou Ma
94b796133b 5l: make -v option output less nonessential clutter
5l -v is for benchmarking various parts of the loader, but this code in
        obj.c will clutter the output. I only comment them out, because this is
        on par with 8l/6l.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5600046
2012-01-31 10:59:29 -05:00
Russ Cox
9a15c2186c build: move goapi, quietgcc, cgo, gotype, ebnflint into go-tool
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5552054
2012-01-31 10:38:07 -05:00
Joel Sing
6f428f0979 cmd/go: clean test directories as they complete
A go build currently generates around 400MB of test output prior to
cleaning up. With this change we use a maximum of ~15MB.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5588044
2012-01-31 10:37:21 -05:00
Wei Guangjing
f8e9bbe475 cmd/ld: fix gdbscript
R=golang-dev, lvd
CC=golang-dev
https://golang.org/cl/5601058
2012-01-31 10:32:24 -05: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
Russ Cox
00e9a54dad go: improvements
Add 'go clean'.
Make 'go build' write to pkgname, not a.out.
Make 'go test -c' write to pkgname.test, not test.out.
Make 'go install' write alternate binaries to .../bin/goos_goarch/.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5600048
2012-01-30 23:42:41 -05:00
Nigel Tao
61ac24cecc fix: add image/{bmp,tiff} to go1pkgrename.
R=rsc, r
CC=golang-dev
https://golang.org/cl/5581053
2012-01-31 12:27:58 +11:00
Rob Pike
33b6d46afd cmd/pack: change gopack to pack in error messages
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5598051
2012-01-30 15:44:27 -08:00
Rob Pike
91cb3489ab go: move compilers into the go-tool directory
Also delete gotest, since it's messy to fix and slated for deletion anyway.
A couple of things outside src can't be tested any more. "go test" will be
fixed and these tests will be re-enabled. They're noisy for now.

Fixes #284.

R=rsc
CC=golang-dev
https://golang.org/cl/5598049
2012-01-30 14:46:31 -08:00
Robert Griesemer
590f948b64 godoc: sort list of "other packages"
Fixes #2786.

R=r, bradfitz
CC=golang-dev
https://golang.org/cl/5581050
2012-01-30 14:31:51 -08:00
Robert Griesemer
ff451e8670 godoc: add URL mode m=methods
If set, all methods are shown, not just those
of non-exported anonynous fields.

This change will only become functional once
CL 5576057 is submitted.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5599048
2012-01-30 14:07:50 -08:00
Anthony Martin
d2599b431e go: don't clobber command install paths
This fixes a regression that was made when adding
support for building with gccgo (in d6a14e6fac0c).

External commands (those not from the Go tree) were
being installed to the package directory instead of
the binary directory.

R=golang-dev, rsc, adg, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/5564072
2012-01-30 13:54:22 -05:00
Rob Pike
ff8133d42e gopack: rename pack, move to go-tool directory
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5598045
2012-01-30 10:30:46 -08:00
Russ Cox
f3492a7d40 8g: use uintptr for local pc
Fixes #2478.

R=ken2
CC=golang-dev
https://golang.org/cl/5593051
2012-01-30 13:20:10 -05:00
Gustavo Niemeyer
d59c88786d cmd/go: fix including of _cgo_export.h
This will add the temporary object directory into the lookup
path so that cgo-exported function declarations may be
included from C files.

R=golang-dev, rogpeppe, rsc
CC=golang-dev
https://golang.org/cl/5600043
2012-01-30 16:04:45 -02:00
Alex Brainman
2d13e1f16e build: use correct go-tool directory location
R=golang-dev, rsc, cw, rsc
CC=golang-dev
https://golang.org/cl/5576070
2012-01-30 16:43:28 +11:00
Brad Fitzpatrick
a94bd4d7c3 cmd/goapi: expand embedded interfaces
Fixes #2801

R=rsc
CC=golang-dev
https://golang.org/cl/5576068
2012-01-29 21:04:13 -08:00
Gustavo Niemeyer
1e5b7e706e cmd/goinstall: remove now that 'go get' works
The changes to builder were not tested.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5572083
2012-01-29 17:22:20 -02:00
Rob Pike
71d83b72ef cmd/go: add go tools to rearrangement
fix, vet
yacc is also fixed (it was wrong before)
All that's left is the commands used during compilation
This looks like a huge CL, but it's almost all file renames.
The action is in cmd/go/pkg.go, the Makefiles, and .../doc.go.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5595044
2012-01-29 11:07:25 -08:00
Rob Pike
108961b216 cmd/go: slightly less confusing error message
If the argument to go fix isn't a package directory, the message said nothing helpful.
Now it at least says a package couldn't be found.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5577072
2012-01-29 11:06:39 -08:00
Rob Pike
4a9138751a cmd/go: c tools not used during compilation
cov, nm, pprof, prof

R=rsc, r, rsc
CC=golang-dev
https://golang.org/cl/5576067
2012-01-29 10:14:36 -08:00
Shenghou Ma
916eea04f8 5l, 6l, 8l, ld: remove memory leaks
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5569085
2012-01-29 12:46:26 -05:00
Rob Pike
79dc34413e cmd/go: first piece of tool rearrangement
1) create go-tool dir in make.bash
2) clean up stale binaries in make.bash
3) add 'tool' command to go
4) convert goyacc->yacc as a first test tool
Since goyacc stands alone, it's a safe trial.

R=rsc
CC=golang-dev
https://golang.org/cl/5576061
2012-01-29 09:19:05 -08:00
Rémy Oudompheng
21f1769519 gc: use original constant expression in error messages.
Fixes #2768.

R=golang-dev, lvd, iant
CC=golang-dev, remy
https://golang.org/cl/5572081
2012-01-29 10:35:11 +01:00
Roger Peppe
a417e6f470 cmd/go: make vcs command actually gather output
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5577062
2012-01-28 12:02:22 +00:00
Rémy Oudompheng
45a8fae996 go: introduce support for "go build" with gccgo.
The use of gccgo is triggered by GC=gccgo in environment. It
still needs the standard distribution to behave properly, but
allows using the test, build, run, install subcommands with
gccgo.

R=rsc, iant, fullung
CC=golang-dev, remy
https://golang.org/cl/5562045
2012-01-27 17:05:51 -05:00
Rémy Oudompheng
21c65e8f33 cgo: accept null pointers in gccgo flavour of C.GoString.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5569074
2012-01-27 09:36:53 +01:00
David Symonds
1b19134c4f gc: remove extra paranoia from inlining unsafe.Pointer fix.
R=rsc
CC=golang-dev
https://golang.org/cl/5569075
2012-01-27 13:59:32 +11:00
Gustavo Niemeyer
cdbed823bd cmd/go: solve ambiguity of get lp.net/project/foo
This solves the ambiguity for "lp.net/project/foo". In these URLs,
"foo" could be a series name registered in Launchpad with its own
branch, and it could also be the name of a directory within the
main project branch one level up.

Solve it by testing if the series branch exists in Launchpad
and if it doesn't moving the root one level up.

R=rsc
CC=golang-dev
https://golang.org/cl/5577058
2012-01-27 00:58:24 -02:00
David Symonds
2332439b1b gc: permit unsafe.Pointer for inlined functions.
R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5573075
2012-01-27 13:44:48 +11:00
Russ Cox
408f0b1f74 gc, runtime: handle floating point map keys
Fixes #2609.

R=ken2
CC=golang-dev
https://golang.org/cl/5572069
2012-01-26 16:25:07 -05:00
Russ Cox
109a976355 6c, 8c: make floating point code NaN-safe
R=ken2
CC=golang-dev
https://golang.org/cl/5569071
2012-01-26 16:23:29 -05:00
Andrew Gerrand
29dbd988b8 cmd/go: update doc.go with text generated from the usage strings
Fixes #2783.

R=bsiegert, rsc
CC=golang-dev
https://golang.org/cl/5570069
2012-01-27 08:19:43 +11:00
Luuk van Dijk
93e547a0c2 gc: softer criteria for inlinability.
R=rsc
CC=golang-dev
https://golang.org/cl/5555072
2012-01-26 17:20:48 +01:00
Luuk van Dijk
0a55958b52 cmd/gc: forgotten recursion on ninit itself in order.c
Fixes test/reorder2.go for all cases tripped up with -lll in 5555072

R=rsc
CC=golang-dev
https://golang.org/cl/5569069
2012-01-26 15:10:24 +01:00
Brad Fitzpatrick
5c04272ff3 cmd/goapi: new tool for tracking exported API over time
The idea is that we add files to the api/ directory which
are sets of promises for the future.  Each line in a file
is a stand-alone feature description.

When we do a release, we make sure we haven't broken or changed
any lines from the past (only added them).

We never change old files, only adding new ones. (go-1.1.txt,
etc)

R=dsymonds, adg, r, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/5570051
2012-01-25 17:47:57 -08:00
Gustavo Niemeyer
9d4ae0ae5c gofix: handle xml.Unmarshal in xmlapi fix
This improves the handling of xml.Unmarshal in
the xmlapi fix by guessing some of the common
types used on it.

This also fixes a bug in the partial typechecker.
In an expression such as f(&a), it'd mark a as
having &T rather than *T.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5572058
2012-01-25 21:07:00 -02:00
Russ Cox
ee9bfb023a gc: fix order of evaluation
Pulling function calls out to happen before the
expression being evaluated was causing illegal
reorderings even without inlining; with inlining
it got worse.  This CL adds a separate ordering pass
to move things with a fixed order out of expressions
and into the statement sequence, where they will
not be reordered by walk.

Replaces lvd's CL 5534079.

Fixes #2740.

R=lvd
CC=golang-dev
https://golang.org/cl/5569062
2012-01-25 17:53:50 -05:00
Russ Cox
0368ca138b build: remove code now in subrepositories
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5569064
2012-01-25 15:30:42 -05:00
Russ Cox
b6f671b901 gofix: update go1pkgrename for subrepositories
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5576044
2012-01-25 15:30:03 -05:00
Robert Griesemer
2355d18e3c gofix: add -debug flag for quicker diagnosis of internal errors
R=rsc, r
CC=golang-dev
https://golang.org/cl/5564055
2012-01-25 15:26:19 -05:00
Robert Griesemer
6e3af46e7d gofmt: fix test.sh
R=adg, iant
CC=golang-dev
https://golang.org/cl/5573062
2012-01-25 08:58:41 -08:00
Andrew Gerrand
8eaf38cbdd godoc: update metadata upon launch
Without this change it's possible to launch godoc,
immediately GET /, and see a directory listing instead of root.html

R=gri
CC=golang-dev
https://golang.org/cl/5575054
2012-01-25 11:56:31 +11:00
Robert Griesemer
e7d513eab0 go/parser: Use explicit parser.Mode type.
R=r, bradfitz
CC=golang-dev
https://golang.org/cl/5574058
2012-01-24 16:36:20 -08:00
Shenghou Ma
0ae6084fef build: do not build all C compilers
In order to allow buildscript.sh to generate buildscripts for all
        $GOOS/$GOARCH combinations, we have to generate dummy files for cmd/go.
        Fixes #2586.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5557050
2012-01-24 15:03:41 -05:00
Olivier Duperray
0da89b3964 test: Add the usual Copyright notice.
Fixes #2759.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5570053
2012-01-24 14:48:15 -05:00
Russ Cox
59ae15106a cmd/go: fix get github
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5569054
2012-01-24 14:15:37 -05:00
Luuk van Dijk
0e919ff2c9 gc: static implements check on typeswitches only applies to concrete case types.
Fixes #2700.

R=rsc
CC=golang-dev
https://golang.org/cl/5574046
2012-01-24 13:53:00 +01:00
Gustavo Niemeyer
0442087f93 encoding/xml: bring API closer to other packages
Includes gofix module. The only case not covered should be
xml.Unmarshal, since it remains with a similar interface, and
would require introspecting the type of its first argument
better.

Fixes #2626.

R=golang-dev, rsc, gustavo
CC=golang-dev
https://golang.org/cl/5574053
2012-01-24 01:10:32 -02:00
Russ Cox
1cfae8bcbf cmd/go: add missing files (fix build)
TBR=r
CC=golang-dev
https://golang.org/cl/5571050
2012-01-23 15:24:20 -05:00
Russ Cox
ed936a3f22 cmd/go: implement go get + bug fixes
Move error information into Package struct, so that
a package can be returned even if a dependency failed
to load or did not exist.  This makes it possible to run
'go fix' or 'go fmt' on packages with broken dependencies
or missing imports.  It also enables go get -fix.
The new go list -e flag lets go list process those package
errors as normal data.

Change p.Doc to be first sentence of package doc, not
entire package doc.  Makes go list -json or
go list -f '{{.ImportPath}} {{.Doc}}' much more reasonable.

The go tool now depends on http, which means also
net and crypto/tls, both of which use cgo.  Trying to
make the build scripts that build the go tool understand
and handle cgo is too much work.  Instead, we build
a stripped down version of the go tool, compiled as go_bootstrap,
that substitutes an error stub for the usual HTTP code.
The buildscript builds go_bootstrap, go_bootstrap builds
the standard packages and commands, including the full
including-HTTP-support go tool, and then go_bootstrap
gets deleted.

Also handle the case where the buildscript needs updating
during all.bash: if it fails but a go command can be found on
the current $PATH, try to regenerate it.  This gracefully
handles situations like adding a new file to a package
used by the go tool.

R=r, adg
CC=golang-dev
https://golang.org/cl/5553059
2012-01-23 15:16:51 -05:00
Russ Cox
b5777571b3 go/build: add BuildTags to Context, allow !tag
This lets the client of go/build specify additional tags that
can be recognized in a // +build directive.  For example,
a build for a custom environment like App Engine might
include "appengine" in the BuildTags list, so that packages
can be written with some files saying

        // +build appengine   (build only on app engine)

or

        // +build !appengine  (build only when NOT on app engine)

App Engine here is just a hypothetical context.  I plan to use
this in the cmd/go sources to distinguish the bootstrap version
of cmd/go (which will not use networking) from the full version
using a custom tag.  It might also be useful in App Engine.

Also, delete Build and Script, which we did not end up using for
cmd/go and which never got turned on for real in goinstall.

R=r, adg
CC=golang-dev
https://golang.org/cl/5554079
2012-01-23 15:16:38 -05:00
Russ Cox
bf0c190343 gc: avoid DOT in error messages
R=ken2
CC=golang-dev
https://golang.org/cl/5573047
2012-01-23 15:10:53 -05:00
Shenghou Ma
eb984f524e cgo: -cdefs should translate unsafe.Pointer to void *
Fixes #2454.

R=rsc, mikioh.mikioh, golang-dev, iant, iant
CC=golang-dev
https://golang.org/cl/5557068
2012-01-23 14:45:30 -05:00
Luuk van Dijk
93c4e29605 gc: missed typecheck in subscripting a const string.
Fixes #2674.

R=rsc
CC=golang-dev
https://golang.org/cl/5574045
2012-01-23 16:57:12 +01:00
Luuk van Dijk
5ad9e2db28 gc: handle function calls in arguments to builtin complex operations.
Fixes #2582

R=rsc
CC=golang-dev
https://golang.org/cl/5574044
2012-01-23 16:56:57 +01:00
Mikkel Krautz
280d85a80b ld: fix Mach-O code signing for non-cgo binaries
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5561060
2012-01-23 09:42:09 -05:00
Russ Cox
427b5bddcd gc: fix recursion loop in interface comparison
iant's idea.

Fixes #2745.

R=iant, dsymonds
CC=golang-dev
https://golang.org/cl/5536085
2012-01-23 09:19:02 -05:00
Robert Griesemer
2a9c012498 godoc: log node printing error
Invaluable when changing template files.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5571044
2012-01-22 19:36:34 -08:00
Shenghou Ma
41914c1df8 6l, 8l: remove unused macro definition
Their last use is removed in rev 70ed048caad2.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5532115
2012-01-22 10:35:15 -08:00
Russ Cox
e56dc0ad37 cmd/go: every test imports regexp
This fixes the bug Rob ran into when editing package bytes.
Regexp imports regexp/syntax, which imports bytes, and
regexp/syntax was not being properly recompiled during a
test of a change to package bytes.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5555065
2012-01-20 23:35:28 -05:00
Russ Cox
290e68b983 gc: undo most of 'fix infinite recursion for embedded interfaces'
Preserve test.

changeset:   11593:f1deaf35e1d1
user:        Luuk van Dijk <lvd@golang.org>
date:        Tue Jan 17 10:00:57 2012 +0100
summary:     gc: fix infinite recursion for embedded interfaces

This is causing 'interface type loop' errors during compilation
of a complex program.  I don't understand what's happening
well enough to boil it down to a simple test case, but undoing
this change fixes the problem.

The change being undone is fixing a corner case (uses of
pointer to interface in an interface definition) that basically
only comes up in erroneous Go programs.  Let's not try to
fix this again until after Go 1.

Unfixes issue 1909.

TBR=lvd
CC=golang-dev
https://golang.org/cl/5555063
2012-01-20 17:14:09 -05:00
Shenghou Ma
c088ebef16 go run: correctly handle -n and -x flags
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5557069
2012-01-20 15:48:01 -05:00
Jeff R. Allen
46e7cb57c9 gc: do not try to add a key with incorrect type to a hash
Fixes #2623.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5533043
2012-01-20 13:34:38 -05:00
Scott Lawrence
b0360e469c go/ast: respect ImportSpec.EndPos
Fixes #2566.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5541068
2012-01-20 13:34:19 -05:00
Rob Pike
a67c69cbae goyacc: fix indexing bug when yydebug >= 2
Fixes #2701.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5556070
2012-01-20 10:22:41 -08:00
Dmitriy Vyukov
1ff1405cc7 runtime: add type algorithms for zero-sized types
BenchmarkChanSem old=127ns new=78.6ns

R=golang-dev, bradfitz, sameer, rsc
CC=golang-dev
https://golang.org/cl/5558049
2012-01-20 10:32:55 +04:00
Brad Fitzpatrick
6454a3eb15 os: use FileMode instead of uint32 in various functions
Fixes #2733

R=chickencha, ality, rsc
CC=golang-dev
https://golang.org/cl/5553064
2012-01-19 15:45:18 -08:00
Luit van Drongelen
8d66a416cb crypto/hmac: Deprecate hmac.NewMD5, hmac.NewSHA1 and hmac.NewSHA256
Remove NewMD5, NewSHA1 and NewSHA256 in favor of using New and
explicitly importing the used hash-function. This way when using, for
example, HMAC with RIPEMD there's no md5, sha1 and sha256 linked in
through the hmac package.

A gofix rule is included, and applied to the standard library (3 files
altered).

This change is the result of a discussion at
https://golang.org/cl/5550043/ to pull the discussion about
deprecating these functions out of that issue.

R=golang-dev, agl
CC=golang-dev, r, rsc
https://golang.org/cl/5556058
2012-01-19 17:28:38 -05:00
David Symonds
ee09a8cd9f gc: don't emit pkgpath for error type.
Fixes #2660.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5557060
2012-01-20 09:26:17 +11:00
Shenghou Ma
fec7aa952f doc: update out-of-date comments about runtime/cgo
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5532100
2012-01-19 17:13:33 -05:00
Andrew Gerrand
8bbe5ccb71 godoc: support canonical Paths in HTML metadata
Redirect to the canonical path when the old path is accessed.

R=gri
CC=golang-dev
https://golang.org/cl/5536061
2012-01-20 07:37:36 +11:00
Brad Fitzpatrick
f47807a57f cmd/go: skip _obj directories in package scans
Fixes #2693

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5557057
2012-01-18 19:27:16 -08:00
Andrew Gerrand
7cb21a79a4 godoc: specify HTML page metadata with a JSON blob
This allows HTML pages to specify arbitrary data in a header:

<!--{
        "Title": "The page title",
        ...
}-->

replacing the old style comments:

<!-- title The page title -->

R=gri, rsc, r, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/5532093
2012-01-19 11:24:54 +11:00
Luuk van Dijk
6ff01f01f4 gc: fieldnames in structliterals in exported inlines should not be qualified if they're embedded builtin types.
Trust me.
Fixes #2687.

R=rsc
CC=golang-dev
https://golang.org/cl/5545047
2012-01-18 17:51:28 +01:00
Luuk van Dijk
18ee75ec88 gc: handle printing of string/arrayrune conversions
Fixes #2714.

R=rsc
CC=golang-dev
https://golang.org/cl/5540066
2012-01-18 09:52:16 +01:00
Rob Pike
3495f39fc4 cmd/go: remove mentions of 'gotest' from the documentation
go test runs the tests itself; it does not run the gotest command,
so these mentions are confusing.

R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5551043
2012-01-17 13:13:50 -08:00
Luuk van Dijk
4e78818259 gc: give esc.c's sink an orig so -mm diagnostics work again.
R=rsc
CC=golang-dev
https://golang.org/cl/5543063
2012-01-17 10:01:12 +01:00
Luuk van Dijk
9523b4d59c gc: fix infinite recursion for embedded interfaces
Fixes #1909

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5523047
2012-01-17 10:00:57 +01:00
Shenghou Ma
b24d1cb5ec 5l: remove redundant code
5l/asm.c: code in line 311-319 has already outputed segtext.sect->next;

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5532048
2012-01-16 19:29:54 -05:00
Scott Lawrence
b16f3a2d50 gc: don't fault on return outside function
Fixes #2598.

R=golang-dev, ality, minux.ma, mpimenov, rsc
CC=golang-dev
https://golang.org/cl/5510043
2012-01-16 18:12:25 -05:00
Rémy Oudompheng
6b72b07016 gc: do not compile switch on interface values into a binary search.
Fixes #2672.

R=golang-dev, lvd
CC=golang-dev, remy
https://golang.org/cl/5543058
2012-01-14 17:00:14 +01:00
Olivier Duperray
c40314821b cmd/gofmt: fix simplify.go by running gofmt on cmd/gofmt
R=golang-dev
CC=golang-dev
https://golang.org/cl/5539061
2012-01-13 18:05:47 -08:00
Dmitriy Vyukov
a4f7024e0a cmd/go: fix data race during build
Fixes #2695.

R=golang-dev, mpimenov, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5545052
2012-01-13 22:22:03 +04:00
Robert Griesemer
c7cdce13f5 godoc: make ?m=src mode deterministic
Merge package files in the go/ast MergePackageFiles
function always	    in the same order (sorted by filename)
instead	 of map iteration order to obtain the same
package	 file each time.  This functionality is used
by godoc when displaying packages in ?m=src mode.

Also: minor cleanup in godoc.go.

R=rsc
CC=golang-dev
https://golang.org/cl/5540054
2012-01-13 09:32:35 -08:00
Robert Griesemer
eac31c67a8 go/doc: streamlined go/doc API
- the main changes are removing the Doc suffix
  from the exported types, so instead of
  doc.TypeDoc one will have doc.Type, etc.

- All exported types now have a Name (or Names) field.
  For Values, the Names field lists all declared variables
  or constants.

- Methods have additional information about where they are
  coming from.

- There's a mode field instead of a bool to
  control the package's operation, which makes
  it easier to extend w/o API changes.

Except for the partially implemented new Method type,
this is based on existing code. A clean rewrite is in
progress based on this new API.

R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/5528060
2012-01-12 17:36:57 -08:00
Robert Griesemer
74cb963225 go/parser: Remove unused Parse* functions. Simplified ParseExpr signature.
Only ParseFile, ParseDir, and ParseExpr are used in the tree.
If partial parsing of code is required, it is fairly simple
to wrap the relevant piece of code into a dummy package for
parsing (see parser.ParseExpr).

Also: minor cleanups.

R=rsc
CC=golang-dev
https://golang.org/cl/5535055
2012-01-12 16:04:48 -08:00
Russ Cox
c2ffd9d0c2 cmd/go: use relative paths in go fix, go fmt, go vet output
Fixes #2686.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5528089
2012-01-12 15:28:52 -08:00
Russ Cox
4505ae3863 cmd/go: handle path to cmd directory
Now it works to run 'go install' (no args) in cmd/go.

Fixes #2679.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5543046
2012-01-12 15:27:57 -08:00
Russ Cox
811006c89d cmd/go: handle cgo pkg-config pragmas
Fixes #2681.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5540047
2012-01-12 15:04:39 -08:00
Russ Cox
ba0e02b207 cgo: write _cgo_export.h to object directory, not source dir
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5540048
2012-01-12 15:04:31 -08:00
Russ Cox
c624fa691d go/build: pass CgoLDFLAGS at end of link command
By the time a Unix linker gets to the end of the
command line it has forgotten what you told it
at the beginning of the command line, so you
have to put library arguments (like -lm) at the end.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5541043
2012-01-12 13:44:02 -08:00
Russ Cox
f0f6aa59cc go/doc: move CommentText to ast.CommentGroup's Text method
Now only godoc imports go/doc.

R=gri
CC=golang-dev
https://golang.org/cl/5541045
2012-01-12 11:34:02 -08:00
Russ Cox
267f56e10b ld: parse but do not implement -X flag
This will let programs invoking ld prepare for it.
See issue 2676.

R=iant
CC=golang-dev
https://golang.org/cl/5535044
2012-01-12 10:23:24 -08:00
Russ Cox
725f084b11 cmd/go: fix linker arguments
Especially affects tests, but not test-specific.
The linker was only being told where to find the
direct dependencies of package main.  Sometimes that
was sufficient to find the rest; sometimes not.

Fixes #2657.
Fixes #2666.
Fixes #2680.

R=golang-dev, adg, rogpeppe
CC=golang-dev
https://golang.org/cl/5528079
2012-01-12 10:18:03 -08:00
Shenghou Ma
26ba35666e goyacc: fix units.y build breakage
This breakage is mainly due to API changes in pkg.
(e.g., package utf8 moved to unicode/utf8;
       remove of strconv.Atof64;
       change character type from int to rune.)
Also correct the usage comment.

This fixes issue 2646.
PS: I don't change the goyacc.go, because I think token type
    should not be force to rune.

R=golang-dev, adg, rogpeppe, r, r
CC=golang-dev
https://golang.org/cl/5502093
2012-01-12 07:54:20 -08:00
Rémy Oudompheng
94ff311d1b gc: avoid false positives when using scalar struct fields.
The escape analysis code does not make a distinction between
scalar and pointers fields in structs. Non-pointer fields
that escape should not make the whole struct escape.

R=lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5489128
2012-01-12 12:08:40 +01:00
Russ Cox
524fb81c41 gc: inlining bug
R=lvd
CC=golang-dev
https://golang.org/cl/5533078
2012-01-11 20:32:02 -05:00
Russ Cox
81728cf06d gc: fix inlining bug
R=lvd
CC=golang-dev
https://golang.org/cl/5532077
2012-01-11 17:25:09 -05:00
Robert Griesemer
3fc327b33b go/scanner: 17% faster scanning
- Changed the Scan API semantics slightly:
The token literal string is only returned
if the token is a literal, comment, semicolon,
or illegal character. In all other cases, the
token literal value is determined by the token
value.

Clients that care about the token literal value
when not present can always use the following
piece of code:

pos, tok, lit := scanner.Scan()
if lit == "" {
   lit = tok.String()
}

- Changed token.Lookup API to use a string instead
of a []byte argument.

- Both these changes were long-standing TODOs.

- Added BenchmarkScan.

This change permits a faster implementation of Scan
with much fewer string creations:

benchmark                old ns/op    new ns/op    delta
scanner.BenchmarkScan        74404        61457  -17.40%

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5532076
2012-01-11 14:20:32 -08:00
Russ Cox
836a517f69 gc: fix inlining bug
Fixes #2682.

R=lvd
CC=golang-dev
https://golang.org/cl/5538043
2012-01-11 13:21:06 -08:00
Russ Cox
f2b51f564f cmd/go: change deadline to 10 minutes
1 minute is not enough for the slower builders.

R=adg
CC=golang-dev
https://golang.org/cl/5533068
2012-01-11 12:44:31 -08:00
Luuk van Dijk
feaa9ed10a gc: export nil literals without inferred type.
Fixes #2678

R=rsc
CC=golang-dev
https://golang.org/cl/5529066
2012-01-11 21:26:54 +01:00
Robert Griesemer
b8f76764cb go test: align "no test files" message
R=rsc
CC=golang-dev
https://golang.org/cl/5533070
2012-01-11 11:15:36 -08:00
Robert Griesemer
276f177b9c go/scanner: remove (exported) InsertSemis mode
This is a relic from the times when we switched
to automatic semicolon insertion. It's still use-
ful to have a non-exported switch for testing.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5528077
2012-01-11 10:06:44 -08:00
Dmitriy Vyukov
c7fdbeb6c1 cmd/go: fix test documentation
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5529067
2012-01-11 09:47:08 -08:00