Commit Graph

5 Commits

Author SHA1 Message Date
Alan Donovan 2477c0d578 x/tools/...: fork and tag !1.5 all files that use go/types et al
This change will ensure that the tree continues to work with go1.4.1.

All files continue to depend on golang.org/x/tools/go/types, but in a
follow-up change, I will switch the primary files to depend on the
standard go/types package.  Another (smaller) set of files will be
forked and tagged, this time !1.6, due to API differences between the
two packages.

All tests pass using 1.4.1, 1.5, and ~1.6 (tip).

Change-Id: Ifd75a6330e120957d646be91693daaba1ce0e8c9
Reviewed-on: https://go-review.googlesource.com/18333
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-06 20:40:09 +00:00
Russ Cox 93604a3dc2 go/loader: fix fd leak and limit calls to ioutil.ReadDir
This makes 'ulimit -n 128; go test -short -v' pass.
It did not before, and that was breaking the openbsd/386 builder.

For golang/go#11811.

Change-Id: Idfdb2f4007ed06c6084486c0e58a561add552d2c
Reviewed-on: https://go-review.googlesource.com/13695
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-08-18 23:39:26 +00:00
Alan Donovan 9872f0d268 go.tools/*: replace $GOROOT/src/pkg with $GOROOT/src where appropriate.
(godoc is excluded from this CL since it will continue to use
/src/pkg in its URL namespace, making the necessary cleanup
more subtle.)

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/141770043
2014-09-08 13:24:38 -04:00
Alan Donovan 935700a081 go.tools/go/loader: apply DisplayPath to working directory of cgo tool.
This transforms the virtualized directory (build.Context).Dir to a physical one,
for proprietary build systems that distinguish them.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/116230043
2014-07-24 14:12:52 -04:00
Alan Donovan 7746b67294 go.tools/go/loader: enable cgo processing of files that import "C".
Files that import "C" are not valid Go source files and
require preprocessing.  Until now, the loader has simply
hard-coded CGO_ENABLED=0 (in effect) which causes go/build to
use build tags select pure Go implementations where they exist
(e.g. in $GOROOT).  Where they don't (e.g. arbitrary user
code) this leads to masses of spurious type errors.
(Reported by Guillaume Charmes, private correspondence.)

This change causes the loader to invoke the cgo preprocessor
on such files and to load the preprocessed files instead,
using the original names.  This means that the syntax offset
position information is garbage, although thanks to //line
directives, the line numbers at least should be good.

See comment in cgo.go for details.

This CL changes the loader's default behaviour and may make it slower.
CGO_ENABLED=0 enables the old behaviour.

Tested via stdlib_test, which now loads all standard packages
using cgo, and also exercises CGO_ENABLED=0 for "net" and "os/user".

LGTM=gri
R=gri, rsc
CC=golang-codereviews, guillaume.charmes
https://golang.org/cl/86140043
2014-06-11 13:16:51 -04:00