summaryrefslogtreecommitdiff
path: root/src/go
Commit message (Collapse)AuthorAgeFilesLines
...
* go/types: make Identical(nil, T) == Identical(T, nil)Alan Donovan2016-04-072-0/+19
| | | | | | | | | Fixes #15173 Change-Id: I353756f7bc36db0d2b24d40c80771481b7b18f6b Reviewed-on: https://go-review.googlesource.com/21585 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/compile, go/importer: minor cleanupsRobert Griesemer2016-04-061-3/+2
| | | | | | Change-Id: I4ffb79d8cb08b0b44f59757fb7f0ec3ed1e4479f Reviewed-on: https://go-review.googlesource.com/21624 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* net, runtime: skip flaky tests on OpenBSDBrad Fitzpatrick2016-04-061-1/+1
| | | | | | | | | | | | | | | | | Flaky tests are a distraction and cover up real problems. File bugs instead and mark them as flaky. This moves the net/http flaky test flagging mechanism to internal/testenv. Updates #15156 Updates #15157 Updates #15158 Change-Id: I0e561cd2a09c0dec369cd4ed93bc5a2b40233dfe Reviewed-on: https://go-review.googlesource.com/21614 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* go/importer: match predeclared type list with gc's list in binary exporterRobert Griesemer2016-04-051-3/+7
| | | | | | | | I think we had this code before but it may have gone lost somehow. Change-Id: Ifde490e686de0d2bfe907cbe19c9197f24f5fa8e Reviewed-on: https://go-review.googlesource.com/21537 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* net/http: add Request.Context and Request.WithContextBrad Fitzpatrick2016-04-051-1/+2
| | | | | | | | | | | Currently only used by the client. The server is not yet wired up. A TODO remains to document how it works server-side, once implemented. Updates #14660 Change-Id: I27c2e74198872b2720995fa8271d91de200e23d5 Reviewed-on: https://go-review.googlesource.com/21496 Reviewed-by: Andrew Gerrand <adg@golang.org>
* context: add the context package from golang.org/x/net/contextBrad Fitzpatrick2016-04-051-0/+1
| | | | | | | | | | | | | | | | | This copies the golang.org/x/net/context package to the standard library. It is imported from the x/net repo's git rev 1d9fd3b8333e (the most recent modified to x/net/context as of 2016-03-07). The corresponding change to x/net/context is in https://golang.org/cl/20347 Updates #14660 Change-Id: Ida14b1b7e115194d6218d9ac614548b9f41641cc Reviewed-on: https://go-review.googlesource.com/20346 Reviewed-by: Sameer Ajmani <sameer@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: export inlined function bodiesRobert Griesemer2016-04-041-51/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Completed implementation for exporting inlined functions using the new binary export format. This change passes (export GO_GCFLAGS=-newexport; make all.bash) but for gc's builtin_test.go which we need to adjust before enabling this code by default. For a high-level description of the export format see the comment at the top of bexport.go. Major changes: 1) The export format for the platform independent export data changed: When we export inlined function bodies, additional objects (other functions, types, etc.) that are referred to by the function bodies will need to be exported. While this doesn't affect the platform-independent portion directly, it adds more objects to the exportlist while we are exporting. Instead of trying to sort the objects into groups, just export objects as they appear in the export list. This is slightly less compact (one extra byte per object), but it is simpler and much more flexible. 2) The export format contains now three sections: 1) The plat- form independent objects, 2) the objects pulled in for export via inlined function bodies, and 3) the inlined function bodies. 3) Completed the exporting and importing code for inlined function bodies. The format is completely compiler-specific and easily changeable w/o affecting other tools. There is still quite a bit of room for denser encoding. This can happen at any time in the future. This change contains also the adjustments for go/internal/gcimporter, necessary because of the export format change 1) mentioned above. For #13241. Change-Id: I86bca0bd984b12ccf13d0d30892e6e25f6d04ed5 Reviewed-on: https://go-review.googlesource.com/21172 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/types: better error when assigning to struct field in mapCaio Marcelo de Oliveira Filho2016-04-042-1/+9
| | | | | | | | | | | | | | | | | | | | | | Identify this assignment case and instead of the more general error prog.go:6: cannot assign to students["sally"].age (value of type int) produce prog.go:6: cannot directly assign to struct field students["sally"].age in map that explains why the assignment is not possible. Used ExprString instead of String of operand since the type of the field is not relevant to the error. Updates #13779. Change-Id: I581251145ae6336ddd181b9ddd77f657c51b5aff Reviewed-on: https://go-review.googlesource.com/21463 Reviewed-by: David Chase <drchase@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime, syscall: only search for Windows DLLs in the System32 directoryBrad Fitzpatrick2016-04-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Make sure that for any DLL that Go uses itself, we only look for the DLL in the Windows System32 directory, guarding against DLL preloading attacks. (Unless the Windows version is ancient and LoadLibraryEx is unavailable, in which case the user probably has bigger security problems anyway.) This does not change the behavior of syscall.LoadLibrary or NewLazyDLL if the DLL name is something unused by Go itself. This change also intentionally does not add any new API surface. Instead, x/sys is updated with a LoadLibraryEx function and LazyDLL.Flags in: https://golang.org/cl/21388 Updates #14959 Change-Id: I8d29200559cc19edf8dcf41dbdd39a389cd6aeb9 Reviewed-on: https://go-review.googlesource.com/21140 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: fix buildKeith Randall2016-03-311-0/+1
| | | | | | | | | Pushed from an old client by mistake. These are the missing changes. Change-Id: Ia8d61c5c0bde907369366ea9ea98711823342803 Reviewed-on: https://go-review.googlesource.com/21349 Reviewed-by: Todd Neal <todd@tneal.org>
* vendor: move golang.org/x/net/http2/hpack back to vendorBrad Fitzpatrick2016-03-242-2/+1
| | | | | | | | | | Updates #14047 Change-Id: I7e314e2c7e3e8da18ab023729740fbc9ea3f661e Reviewed-on: https://go-review.googlesource.com/21063 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
* net/http, internal/testenv: find go binary in PATHDavid Crawshaw2016-03-221-1/+1
| | | | | | | | | | Fixes #14901 Change-Id: Ia32e09767374a341c9a36c5d977d47d7d1a82315 Reviewed-on: https://go-review.googlesource.com/20967 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org>
* all: delete dead test codeDominik Honnef2016-03-212-28/+0
| | | | | | | | | | This deletes unused code and helpers from tests. Change-Id: Ie31d46115f558ceb8da6efbf90c3c204e03b0d7e Reviewed-on: https://go-review.googlesource.com/20927 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile/internal/gc: support invalid types/constants in binary export dataAlan Donovan2016-03-181-1/+4
| | | | | | | | (Corresponding x/tools/go/gcimporter change is https://go-review.googlesource.com/#/c/20827/) Change-Id: I64e7fee2e273d387f1c51b87986294489978d250 Reviewed-on: https://go-review.googlesource.com/20828 Reviewed-by: Robert Griesemer <gri@golang.org>
* cmd/compile: keep variable numbering for inlineable exported functionsRobert Griesemer2016-03-141-1/+3
| | | | | | | | | Another step towards hooking up exported inlined function bodies. Change-Id: Ib8094b03ac7970fee0e51b5826b5f8aa232e23fb Reviewed-on: https://go-review.googlesource.com/20605 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Robert Griesemer <gri@golang.org>
* testing: implement 'Unordered Output' in Examples.Brady Catherman2016-03-091-12/+18
| | | | | | | | | | | | | | | | | Adds a type of output to Examples that allows tests to have unordered output. This is intended to help clarify when the output of a command will produce a fixed return, but that return might not be in an constant order. Examples where this is useful would be documenting the rand.Perm() call, or perhaps the (os.File).Readdir(), both of which can not guarantee order, but can guarantee the elements of the output. Fixes #10149 Change-Id: Iaf0cf1580b686afebd79718ed67ea744f5ed9fc5 Reviewed-on: https://go-review.googlesource.com/19280 Reviewed-by: Andrew Gerrand <adg@golang.org>
* go/build: introduce go1.7 build tagBrad Fitzpatrick2016-03-072-1/+2
| | | | | | | | | | | This is needed now for subrepos to be able to conditionally use API symbols found only after Go 1.6. Change-Id: Ie7d9301332aa1739b585d93f8025424ae72a2430 Reviewed-on: https://go-review.googlesource.com/20344 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/types: don't emit conversion error in non-numeric increment/decrementCaio Marcelo de Oliveira Filho2016-03-072-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In increment and decrement statements, explicit check that the type of operand is numeric. This avoids a related but less clear error about converting "1" to be emitted. So, when checking package main func main() { var x bool x++ } instead of emitting the error prog.go:5:2: cannot convert 1 (untyped int constant) to bool emits prog.go:5:2: invalid operation: x++ (non-numeric type bool). Updates #12525. Change-Id: I00aa6bd0bb23267a2fe10ea3f5a0b20bbf3552bc Reviewed-on: https://go-review.googlesource.com/20244 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/ast: fix typo in commentIan Lance Taylor2016-03-021-1/+1
| | | | | | | | Change-Id: I719231466286b3c0135314388a7c560ef44d7c35 Reviewed-on: https://go-review.googlesource.com/20130 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: single space after period.Brad Fitzpatrick2016-03-0218-41/+41
| | | | | | | | | | | | | | | | | | | | The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: make copyright headers consistent with one space after periodBrad Fitzpatrick2016-03-0111-11/+11
| | | | | | | | | | | | | | | | | | | | | | This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/types: nicer shift error messageMatthew Dempsky2016-03-012-6/+6
| | | | | | | | | Updates #13940. Change-Id: I41974c292dd981d82ac03b9b8b406713445362c3 Reviewed-on: https://go-review.googlesource.com/20081 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* go/constant: fix typos in MakeFromLiteral docsMatthew Dempsky2016-03-011-2/+2
| | | | | | Change-Id: I99c737415a082df883a9c12cdb43bdd5a1b9a8ad Reviewed-on: https://go-review.googlesource.com/20082 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* all: remove public named return values when uselessBrad Fitzpatrick2016-02-294-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Named returned values should only be used on public funcs and methods when it contributes to the documentation. Named return values should not be used if they're only saving the programmer a few lines of code inside the body of the function, especially if that means there's stutter in the documentation or it was only there so the programmer could use a naked return statement. (Naked returns should not be used except in very small functions) This change is a manual audit & cleanup of public func signatures. Signatures were not changed if: * the func was private (wouldn't be in public godoc) * the documentation referenced it * the named return value was an interesting name. (i.e. it wasn't simply stutter, repeating the name of the type) There should be no changes in behavior. (At least: none intended) Change-Id: I3472ef49619678fe786e5e0994bdf2d9de76d109 Reviewed-on: https://go-review.googlesource.com/20024 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
* cmd: stop looking for __.(GO)?SYMDEF entries in archivesMatthew Dempsky2016-02-261-24/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The Go toolchain stopped creating them before Go 1.3, so no point in worrying about them today. History: - Git commit 250a091 added cmd/ar, which wrote Plan 9 __.SYMDEF entries into archive files. - golang.org/cl/6500117 renamed __.SYMDEF to __.GOSYMDEF. (Notably, the commit message suggests users need to use Go nm to read symbols, but even back then the toolchain did nothing with __.(GO)?SYMDEF files except skip over them.) - golang.org/cl/42880043 added the -pack flag to cmd/gc to directly produce archives by the Go compiler, and did not write __.GOSYMDEF entries. - golang.org/cl/52310044 rewrote cmd/pack in Go, and removed support for producing __.GOSYMDEF entries. Change-Id: I255edf40d0d3690e3447e488039fcdef73c6d6b1 Reviewed-on: https://go-review.googlesource.com/19924 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/compile, go/parser: simpler binary expression parsingMatthew Dempsky2016-02-261-15/+11
| | | | | | | | | | | The existing nested loops are too tricky for me to grok and don't seem necessary. Change-Id: I75c65c8470b799d6f4cfb05bb1b4796c5d7d32e7 Reviewed-on: https://go-review.googlesource.com/19927 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
* all: fix typos and spellingMartin Möhrmann2016-02-245-8/+8
| | | | | | | | Change-Id: Icd06d99c42b8299fd931c7da821e1f418684d913 Reviewed-on: https://go-review.googlesource.com/19829 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go, go/build: add support for Fortrankortschak2016-02-241-1/+8
| | | | | | | | | | | | | | | | | | This change adds support for Fortran files (.f, .F, .for, .f90) to the go tool, in a similar fashion to Objective-C/C++. Only gfortran is supported out of the box so far but leaves other Fortran compiler toolchains the ability to pass the correct link options via CGO_LDFLAGS. A simple test (misc/cgo/fortran) has been added and plugged into the general test infrastructure. This test is only enabled when the $FC environment variable is defined (or if 'gfortran' was found in $PATH.) Derived from CL 4114. Change-Id: Ifc855091942f95c6e9b17d91c17ceb4eee376408 Reviewed-on: https://go-review.googlesource.com/19670 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/dist, go/build: make cmd/dist generate cgoEnabled map for go/buildShenghou Ma2016-02-241-28/+0
| | | | | | | | | | | | | This reduces the amount of duplication. Now there is only one list of platforms supporting cgo. Update #12270. Change-Id: I5dcd55cb6be7c5bb6ce560383c71d90ab1189dc9 Reviewed-on: https://go-review.googlesource.com/14278 Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: fix typosShawn Smith2016-02-231-1/+1
| | | | | | | | Change-Id: I6035941df8b0de6aeaf6c05df7257bcf6e9191fe Reviewed-on: https://go-review.googlesource.com/19320 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/types: skip $GOROOT/src/*.go in TestStdlibShenghou Ma2016-02-211-7/+10
| | | | | | Change-Id: I4a75d98a48675e2beb5b4843fb2c6ff5d4c8d2a2 Reviewed-on: https://go-review.googlesource.com/14769 Reviewed-by: Robert Griesemer <gri@golang.org>
* cmd/compile: make -A and -newexport compatibleMatthew Dempsky2016-02-191-0/+4
| | | | | | | | | | | | | | | | | Packages compiled with -A may reference the builtin "any" type, so it needs to be included in the list of predeclared types for binary import/export. Also, when -A is used, mark all symbols as SymExport instead of SymPackage in importsym. This parallels the logic in autoexport and is necessary to prevent a "export/package mismatch" errors in exportsym during dumpexport's verifyExport pass. Change-Id: Iff5ec5fbfe2219525ec9d1a975307fa8936af9b9 Reviewed-on: https://go-review.googlesource.com/19627 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: replace strings.Index with strings.Contains where possibleNathan VanBenschoten2016-02-192-2/+2
| | | | | | | Change-Id: Ia613f1c37bfce800ece0533a5326fca91d99a66a Reviewed-on: https://go-review.googlesource.com/18120 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org>
* go/internal/gcimporter: add missing argument to error messageAlberto Donizetti2016-02-181-1/+1
| | | | | | Change-Id: I3071f0e876506c6dc283e97bc15f157bf2ff011e Reviewed-on: https://go-review.googlesource.com/19641 Reviewed-by: Robert Griesemer <gri@golang.org>
* go/constant: fix doc stringsRobert Griesemer2016-02-181-2/+2
| | | | | | | | Fixes #14357. Change-Id: I91acff0b0cc7be2bcbad68925a19a437dbd4c83d Reviewed-on: https://go-review.googlesource.com/19620 Reviewed-by: Alan Donovan <adonovan@google.com>
* go/internal/gcimporter: interpret relative srcDir relative to cwdRobert Griesemer2016-02-102-7/+9
| | | | | | | | | | | | | 1) go/types.dir: Correctly return "." if there is no path. 2) go/internal/gcimporter.FindPkg: work-around for build.Import (build.Import doesn't produce expected result if srcDir is relative). See also issue 14282. Fixes #14215. Change-Id: Ia3721f9ad8a1115d2595fe99b04baaf30d5765f2 Reviewed-on: https://go-review.googlesource.com/19393 Reviewed-by: Russ Cox <rsc@golang.org>
* go/constant: fix String() implementationRobert Griesemer2016-02-082-1/+3
| | | | | | | | | | Fixes #14262. Change-Id: Id590995dd4460e81f6b91bcfb3f02515a97650fe Reviewed-on: https://go-review.googlesource.com/19361 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/types: make sure constants valid in integer operations are in integer formRobert Griesemer2016-02-082-3/+22
| | | | | | | | | | | | | | | | | The operation where this manifested in a crash was % (only defined on integers). However, the existing code was sloppy in that it didn't retain the integer form after a value (e.g., 3.0) was accepted as representable in integer form (3 for the example). We would have seen a crash in such cases for / as well except that there was code to fix it for just that case. Remove the special code for / and fix more generally by retaining the integer form for all operations if applicable. Fixes #14229. Change-Id: I8bef769e6299839fade27c6e8b5ff29ad6521d0d Reviewed-on: https://go-review.googlesource.com/19300 Reviewed-by: Alan Donovan <adonovan@google.com>
* net/http: update http2 to check header values, move from vendor to internalBrad Fitzpatrick2016-01-212-1/+2
| | | | | | | | | | | | | Updates x/net/http2 to git rev b2ed34f for https://golang.org/cl/18727 Updates #14029 (fixes it enough for Go 1.6) Fixes #13961 Change-Id: Id301247545507671f4e79df0e7c6ec9c421d5a7c Reviewed-on: https://go-review.googlesource.com/18728 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
* cmd/go, go/build: ignore vendor directories with no Go source filesRuss Cox2016-01-142-1/+33
| | | | | | | | | | | Otherwise it is impossible to vendor a/b/c without hiding the real a/b. I also updated golang.org/s/go15vendor. Fixes #13832. Change-Id: Iee3d53c11ea870721803f6e8e67845b405686e79 Reviewed-on: https://go-review.googlesource.com/18644 Reviewed-by: Andrew Gerrand <adg@golang.org>
* go/types: rename Importer2 to ImporterFromgo1.6beta2Brad Fitzpatrick2016-01-134-26/+26
| | | | | | | | | | | Per https://groups.google.com/forum/#!topic/golang-dev/javNmryAh0I Change-Id: I08d7cbc94da4fc61c848f3dbee4637bf8fcfeb01 Reviewed-on: https://go-review.googlesource.com/18630 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Chris Broadfoot <cbro@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
* go/importer: fix field/method package for binary importerRobert Griesemer2016-01-131-29/+38
| | | | | | | | | | | | | | This is the equivalent of https://golang.org/cl/18549 for the binary importer (which is usually not used because by default the gc compiler produces the traditional textual export format). For #13898. Change-Id: Idb6b515f2ee49e6d0362c71846994b0bd4dae8f7 Reviewed-on: https://go-review.googlesource.com/18598 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Robert Griesemer <gri@golang.org>
* go/importer: revert incorrect change that slipped in prior CLRobert Griesemer2016-01-131-4/+2
| | | | | | | | | | The package of anonymous fields is the package in which they were declared, not the package of the anonymous field's type. Was correct before and incorrectly changed with https://golang.org/cl/18549. Change-Id: I9fd5bfbe9d0498c8733b6ca7b134a85defe16113 Reviewed-on: https://go-review.googlesource.com/18596 Reviewed-by: Alan Donovan <adonovan@google.com>
* go/importer: associate exported field and interface methods with correct packageRobert Griesemer2016-01-133-37/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | In gc export data, exported struct field and interface method names appear in unqualified form (i.e., w/o package name). The (gc)importer assumed that unqualified exported names automatically belong to the package being imported. This is not the case if the field or method belongs to a struct or interface that was declared in another package and re-exported. The issue becomes visible if a type T (say an interface with a method M) is declared in a package A, indirectly re-exported by a package B (which imports A), and then imported in C. If C imports both A and B, if A is imported before B, T.M gets associated with the correct package A. If B is imported before A, T.M appears to be exported by B (even though T itself is correctly marked as coming from A). If T.M is imported again via the import of A if gets dropped (as it should) because it was imported already. The fix is to pass down the parent package when we parse imported types so that the importer can use the correct package when creating fields and methods. Fixes #13898. Change-Id: I7ec2ee2dda15859c582b65db221c3841899776e1 Reviewed-on: https://go-review.googlesource.com/18549 Reviewed-by: Alan Donovan <adonovan@google.com>
* go/types: slightly better doc stringsRobert Griesemer2016-01-111-4/+4
| | | | | | | | Per suggestion from adonovan. Change-Id: Icbb4d2f201590bc94672b8d8141b6e7901e11dc5 Reviewed-on: https://go-review.googlesource.com/18510 Reviewed-by: Robert Griesemer <gri@golang.org>
* go/importer: use correct path for path->package mapRobert Griesemer2016-01-111-1/+8
| | | | | | | | | | In the presence of vendored packages, the path found in a package declaration may not be the path at which the package imported from srcDir was found. Use the correct package path. Change-Id: I74496c3cdf82a5dbd6a5bd189bb3cd0ca103fd52 Reviewed-on: https://go-review.googlesource.com/18460 Reviewed-by: Alan Donovan <adonovan@google.com>
* go/types, go/importer: importing package unsafe is responsibility of importerRobert Griesemer2016-01-093-12/+8
| | | | | | | | | | TBR adonovan Fixes #13882. Change-Id: I8664669f5d6adfec6f16e154263b1f0ea8988175 Reviewed-on: https://go-review.googlesource.com/18445 Reviewed-by: Robert Griesemer <gri@golang.org>
* go/types: provide Importer2 supporting the Go 1.5 vendor experimentRobert Griesemer2016-01-086-51/+139
| | | | | | | | Fixes #13688. Change-Id: I53363aeeeba4560211d56d4571a8e058d5dbbd8a Reviewed-on: https://go-review.googlesource.com/18308 Reviewed-by: Alan Donovan <adonovan@google.com>
* go/build: invert AllowVendor to IgnoreVendorRuss Cox2016-01-082-6/+8
| | | | | | | | | | | | | Looking for vendor directories is a better default. Fixes #13772 Change-Id: Iabbaea71ccc67b72f14f1f412dc8ab70cb41996d Reviewed-on: https://go-review.googlesource.com/18450 Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* go/doc: don't drop "factory" functions with dot-imported result typesRobert Griesemer2016-01-085-7/+105
| | | | | | | | Fixes #13742. Change-Id: I7c8b51b60e31402bf708bf8d70e07fd06295e8ce Reviewed-on: https://go-review.googlesource.com/18393 Reviewed-by: Russ Cox <rsc@golang.org>