mirror of
https://github.com/golang/go
synced 2024-11-18 16:14:46 -07:00
083d94f69c
3 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Russ Cox
|
a987aaf5f7 |
cmd/compile: require -p flag
The -p flag specifies the import path of the package being compiled. This CL makes it required when invoking the compiler and adjusts tests that invoke the compiler directly to conform to this new requirement. The go command already passes the flag, so it is unmodified in this CL. It is expected that any other Go build systems also already pass -p, or else they will need to arrange to do so before updating to Go 1.19. Of particular note, Bazel already does for rules with an importpath= attribute, which includes all Gazelle-generated rules. There is more cleanup possible now in cmd/compile, cmd/link, and other consumers of Go object files, but that is left to future CLs. Additional historical background follows but can be ignored. Long ago, before the go command, or modules, or any kind of versioning, symbols in Go archive files were named using just the package name, so that for example func F in math/rand and func F in crypto/rand would both be the object file symbol 'rand.F'. This led to collisions even in small source trees, which made certain packages unusable in the presence of other packages and generally was a problem for Go's goal of scaling to very large source trees. Fixing this problem required changing from package names to import paths in symbol names, which was mostly straightforward. One wrinkle, though, is that the compiler did not know the import path of the package being compiled; it only knew the package name. At the time, there was no go command, just Makefiles that people had invoking 6g (now “go tool compile”) and then copying the resulting object file to an importable location. That is, everyone had a custom build setup for Go, because there was no standard one. So it was not particularly attractive to change how the compiler was invoked, since that would break approximately every Go user at the time. Instead, we arranged for the compiler to emit, and other tools reading object files to recognize, a special import path (the empty string, it turned out) denoting “the import path of this object file”. This worked well enough at the time and maintained complete command-line compatibility with existing Go usage. The changes implementing this transition can be found by searching the Git history for “package global name space”, which is what they eliminated. In particular, CL 190076 ( |
||
Than McIntosh
|
ad8b7a70c5 |
test: fix fixedbugs/issue30908.go to work with no-opt builder
Update the issue 30908 test to work with the no-opt builder (this requires a corresponding change in the linker as well). As part of this change, 'rundir' tests are now linked without passing "-w" to the linker. Updates #30908. Fixes #31034. Change-Id: Ic776e1607075c295e409e1c8230aaf55a79a6323 Reviewed-on: https://go-review.googlesource.com/c/go/+/169161 Reviewed-by: Ian Lance Taylor <iant@golang.org> |
||
Than McIntosh
|
6582ee9cba |
test: new test for issue 30908
New test case designed to mimic the code in issue 30908, which features duplicate but non-indentical DWARF abstract subprogram DIEs. Updates #30908. Change-Id: Iacb4b53e6a988e46c801cdac236cef883c553f8f Reviewed-on: https://go-review.googlesource.com/c/go/+/168957 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> |