1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:04:44 -07:00
go/src
Dmitri Shuralyov 67e47124fc go/build: return partial information on Import error, for local import paths
Documentation of build.Import says:

	// If the path is a local import path naming a package that can be imported
	// using a standard import path, the returned package will set p.ImportPath
	// to that path.
	// ...
	// If an error occurs, Import returns a non-nil error and a non-nil
	// *Package containing partial information.

That behavior was previously untested, and broken by change in CL 33158.

Fix that by avoiding returning early on error for local import paths.
First, gather partial information, and only then check that the p.Dir
directory exists.

Add tests for this behavior.

Fixes #19769.
Fixes #20175 (duplicate of #19769).
Updates #17863.

Change-Id: I169cb35291099d05e02aaa3cb23a7403d1cc3657
Reviewed-on: https://go-review.googlesource.com/42350
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-05-15 18:44:46 +00:00
..
archive archive/tar: remove file type bits from mode field 2017-05-13 00:22:29 +00:00
bufio
builtin builtin: fix signature of the builtin function make 2017-05-13 16:16:48 +00:00
bytes internal/cpu: new package to detect cpu features 2017-05-10 17:02:21 +00:00
cmd cmd/link: actually generate .debug_gdb_scripts section on windows 2017-05-15 06:16:19 +00:00
compress compress/lzw: fix hi code overflow. 2017-04-28 05:59:30 +00:00
container container/heap: avoid up() invoke if down() success at heap.Remove() 2017-05-13 19:10:24 +00:00
context
crypto internal/cpu: new package to detect cpu features 2017-05-10 17:02:21 +00:00
database/sql database/sql: ensure releaseConn is defined before a possible close 2017-04-28 22:55:26 +00:00
debug cmd/link: actually generate .debug_gdb_scripts section on windows 2017-05-15 06:16:19 +00:00
encoding encoding/gob: use MakeMapWithSize when decoding map 2017-05-03 02:43:40 +00:00
errors
expvar expvar: reduce sync.Map overhead for (*Map).Set 2017-05-02 17:13:40 +00:00
flag
fmt
go go/build: return partial information on Import error, for local import paths 2017-05-15 18:44:46 +00:00
hash internal/cpu: new package to detect cpu features 2017-05-10 17:02:21 +00:00
html html/template: allow safe usage of predefined escapers in pipelines 2017-05-05 18:56:31 +00:00
image image/gif: don't panic on large or nil-containing color.Palettes. 2017-05-06 00:37:43 +00:00
index/suffixarray
internal internal/cpu: new package to detect cpu features 2017-05-10 17:02:21 +00:00
io
log
math internal/cpu: new package to detect cpu features 2017-05-10 17:02:21 +00:00
mime mime: re-accept empty encoded-text 2017-04-29 04:14:36 +00:00
net net: allow Resolver to use a custom dialer 2017-05-12 18:08:12 +00:00
os os: remove extraneous 's' from TestStdPipe error message 2017-05-10 20:19:50 +00:00
path os: do not report ModeDir for symlinks on windows 2017-04-26 23:17:23 +00:00
plugin
reflect reflect: remove dead v.typ assignment 2017-05-11 08:07:21 +00:00
regexp regexp: speed up QuoteMeta with a lookup table 2017-04-28 06:43:14 +00:00
runtime runtime/pprof: expand inlined frames in symbolized proto profiles 2017-05-15 18:20:23 +00:00
sort
strconv
strings internal/cpu: new package to detect cpu features 2017-05-10 17:02:21 +00:00
sync sync: really test DeepCopyMap 2017-04-30 14:17:36 +00:00
syscall syscall: fix typo in documentation for StringToUTF16Ptr 2017-04-28 05:28:27 +00:00
testing
text text/scanner: clarify documentation on Pos and Position 2017-05-14 20:24:34 +00:00
time
unicode
unsafe
vendor/golang_org/x vendor/golang_org/x/crypto/chacha20poly1305: revendor 2017-05-03 13:47:50 +00:00
all.bash Revert "build: fail nicely if somebody runs all.bash from a binary tarball package" 2017-04-28 21:19:32 +00:00
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash
make.bat
Make.dist
make.rc
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc