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>
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>
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>
The go/build parser accepts "//+build", with no spaces.
Make the cmd/dist bootstrap parser do the same.
While in theory we should always use the space form,
I copied some code that did not into the standard tree,
and I was very confused that 'go test' had had no problem
but then make.bash died.
(As a reminder, cmd/dist does not use go/build because
cmd/dist must build against earlier versions of Go.)
Change-Id: I90a18014bd878247b8811487e5c1a7589260cbfc
Reviewed-on: https://go-review.googlesource.com/19618
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Simply checking the exit code of `git rev-parse --git-dir` should
suffice here, but that requires deviating from the infrastructure
provided by `run`, so I've left that for a future change.
Originally by Tamir Duberstein but updated by iant & rsc to add
the filepath.Join logic.
Fixes#11211 (again).
Change-Id: I6d29b5ae39ba456088ae1fb5d41014cb91c86897
Reviewed-on: https://go-review.googlesource.com/18323
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Simply checking the exit code of `git rev-parse --git-dir` should
suffice here, but that requires deviating from the infrastructure
provided by `run`, so I've left that for a future change.
Fixes#11211.
Change-Id: I7cbad86a8a06578f52f66f734f5447b597ddc962
Reviewed-on: https://go-review.googlesource.com/18213
Reviewed-by: Russ Cox <rsc@golang.org>
Maybe it will say something that helps the user understand the problem.
Note that we can't use os/exec.ExitError's new Stderr field because
cmd/dist is compiled with Go 1.4.
Fixes#13099.
Change-Id: I4b5910434bf324d1b85107002a64684d8ba14dc8
Reviewed-on: https://go-review.googlesource.com/17940
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
An internal link may need the C compiler support library, libgcc.a. Add
a -libgcc option to set the name of the compiler support library. If
-libgcc is not used, run the compiler to find it. Permit -libgcc=none
to skip using libgcc at all and hope for the best.
Change cmd/dist to not copy libgcc into the distribution. Add tests to
ensure that all the standard packages that use cgo can be linked in
internal mode without using libgcc. This ensures that somebody with a
Go installation without a C compiler can build programs.
Change-Id: I8ba35fb87ab0dd20e5cc0166b5f4145b04ce52a4
Reviewed-on: https://go-review.googlesource.com/16993
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Change the linker to use a copy of the C compiler support library,
libgcc.a, when doing internal linking. This will be used to satisfy any
undefined symbols referenced by host objects.
Change the dist tool to copy the support library into a new directory
tree under GOROOT/pkg/libgcc. This ensures that libgcc is available
even when building Go programs on a system that has no C compiler. The
C compiler is required when building the Go installation in the first
place, but is not required thereafter.
Change the go tool to not link libgcc into cgo objects.
Correct the linker handling of a weak symbol in an ELF input object to
not always create a new symbol, but to use an existing symbol if there
is one; this is necessary on freebsd-amd64, where libgcc contains a weak
definition of compilerrt_abort_impl.
Fixes#9510.
Change-Id: I1ab28182263238d9bcaf6a42804e5da2a87d8778
Reviewed-on: https://go-review.googlesource.com/16741
Reviewed-by: Russ Cox <rsc@golang.org>
runtime/internal/sys will hold system-, architecture- and config-
specific constants.
Updates #11647
Change-Id: I6db29c312556087a42e8d2bdd9af40d157c56b54
Reviewed-on: https://go-review.googlesource.com/16817
Reviewed-by: Russ Cox <rsc@golang.org>
Change-Id: I22ea3352ad0794fc611334c2f2ec5f1e894985ce
Reviewed-on: https://go-review.googlesource.com/14460
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Shared libraries on ppc64le will require a larger minimum stack frame (because
the ABI mandates that the TOC pointer is available at 24(R1)). Part 3 of that
is using a #define in the ppc64 assembly to refer to the size of the fixed
part of the stack (finding all these took me about a week!).
Change-Id: I50f22fe1c47af1ec59da1bd7ea8f84a4750df9b7
Reviewed-on: https://go-review.googlesource.com/15525
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(Changed modified by bradfitz from original rsc version)
Change-Id: I8ea40044c325f333a13d48b59b4795b02c579533
Reviewed-on: https://go-review.googlesource.com/14026
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
At this stage, dist is only building go_bootstrap as cmd/compile and
the rest of the Go toolchain has already been built.
Change-Id: I6f99fa00ff1d3585e215f4ce84d49344c4fcb8a5
Reviewed-on: https://go-review.googlesource.com/12779
Reviewed-by: Russ Cox <rsc@golang.org>
The one in misc/makerelease/makerelease.go is particularly bad and
probably warrants rotating our keys.
I didn't update old weekly notes, and reverted some changes involving
test code for now, since we're late in the Go 1.5 freeze. Otherwise,
the rest are all auto-generated changes, and all manually reviewed.
Change-Id: Ia2753576ab5d64826a167d259f48a2f50508792d
Reviewed-on: https://go-review.googlesource.com/12048
Reviewed-by: Rob Pike <r@golang.org>
The bootstrap restriction is to avoid needing cgo for package net.
There's no problem with building debug/elf and debug/dwarf,
so do that.
An upcoming CL is going to add more note processing code,
and it simplifies things not to have to think about the code being
missing half the time.
Change-Id: I0e2f120ac23f14db6ecfcec7bfe254a69abcf7b6
Reviewed-on: https://go-review.googlesource.com/10703
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The go command uses file modification times to decide when a
package is out of date: if the .a file is older than a source file,
the .a file needs to be rebuilt. This scheme breaks down when
multiple source files compile into a single .a file: if one source file
is removed but no other changes are made, there is no indication
that the .a file is out of date.
The fix is to store a value called a build ID in the package archive itself.
The build ID is a hash of the names of all source files compiled into the package.
A later go command can read the build ID out of the package archive
and compare to the build ID derived from the list of source files it now
sees in the directory. If the build IDs differ, the file list has changed,
and the package must be rebuilt.
There is a cost here: when scanning a package directory, in addition
to reading the beginning of every source file for build tags and imports,
the go command now also reads the beginning of the associated
package archive, for the build ID. This is at most a doubling in the
number of files read. On my 2012 MacBook Pro, the time for
'go list std' increases from about 0.215 seconds to about 0.23 seconds.
For executable binaries, the approach is the same except that the
build ID information is stored in a trailer at the end of the executable file.
It remains to be seen if anything objects to the trailer.
I don't expect problems except maybe on Plan 9.
Fixes#3895.
Change-Id: I21b4ebf5890c1a39e4a013eabe1ddbb5f3510c04
Reviewed-on: https://go-review.googlesource.com/9154
Reviewed-by: Ian Lance Taylor <iant@golang.org>
In particular, this avoids moving the mtime on runtime/zversion.go
forward unless the file is out of date. In turn, this makes cross compiles
that run dist multiple times coexist nicely.
(It's no longer necessary to run dist multiple times to set up cross compiles,
but people still might, and it's easy to fix regardless.)
Fixes#4749.
Change-Id: Id430525f168f106bc4b821ca74b2ca498a748f14
Reviewed-on: https://go-review.googlesource.com/9152
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
It was mishandling conjunctions containing negations.
Change-Id: Ife571b28416870ba2ceadbdac5ecb4670432bba1
Reviewed-on: https://go-review.googlesource.com/9151
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This CL removes the remaining visible uses of the "architecture letter" concept.
(They are no longer in tool names nor in source directory names.)
Because the architecture letter concept is now gone, delete GOCHAR
from "go env" output, and change go/build.ArchChar to return an
error always.
The architecture letter is still used in the compiler and linker sources
as a clumsy architecture enumeration, but that use is not visible to
Go users and can be cleaned up separately.
Change-Id: I4d97a38f372003fb610c9c5241bea440d9dbeb8d
Reviewed-on: https://go-review.googlesource.com/10289
Reviewed-by: Rob Pike <r@golang.org>
This CL fixes the build to use the newly created go tool compile
and go tool link in place of go tool 5g, go tool 5l, and so on.
See golang-dev thread titled "go tool compile, etc" for background.
Although it was not a primary motivation, this conversion does
reduce the wall clock time and cpu time required for make.bash
by about 10%.
Change-Id: I79cbbdb676cab029db8aeefb99a53178ff55f98d
Reviewed-on: https://go-review.googlesource.com/10288
Reviewed-by: Rob Pike <r@golang.org>
In preparation for making the current linker cmd/link.
If cmd/newlink is ever completed, it can be moved back.
See golang-dev thread titled "go tool compile, etc" for background.
Change-Id: I4029580f470038240c5181a37ea4202ba971f9ef
Reviewed-on: https://go-review.googlesource.com/10286
Reviewed-by: Rob Pike <r@golang.org>
This CL copies golang.org/x/sys/windows/registry into
internal/syscall/windows/registry (minus KeyInfo.ModTime to prevent
dependency cycles). New registry package is used in mime and time
packages instead of calling Windows API directly.
Change-Id: I965a5a41d4739b3ba38e539a7b8d96d3223e3d56
Reviewed-on: https://go-review.googlesource.com/9271
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Add the new go doc command to the go command, installed in
the tool directory.
(Still to do: tests)
Fix cmd/dist to remove old "package documentation" code that was
stopping it from including cmd/go/doc.go in the build.
Implement the doc command. Here is the help info from "go help doc":
===
usage: go doc [-u] [package|[package.]symbol[.method]]
Doc accepts at most one argument, indicating either a package, a symbol within a
package, or a method of a symbol.
go doc
go doc <pkg>
go doc <sym>[.<method>]
go doc [<pkg>].<sym>[.<method>]
Doc interprets the argument to see what it represents, determined by its syntax
and which packages and symbols are present in the source directories of GOROOT and
GOPATH.
The first item in this list that succeeds is the one whose documentation is printed.
For packages, the order of scanning is determined by the file system, however the
GOROOT tree is always scanned before GOPATH.
If there is no package specified or matched, the package in the current directory
is selected, so "go doc" shows the documentation for the current package and
"go doc Foo" shows the documentation for symbol Foo in the current package.
Doc prints the documentation comments associated with the top-level item the
argument identifies (package, type, method) followed by a one-line summary of each
of the first-level items "under" that item (package-level declarations for a
package, methods for a type, etc.)
The package paths must be either a qualified path or a proper suffix of a path
(see examples below). The go tool's usual package mechanism does not apply: package
path elements like . and ... are not implemented by go doc.
When matching symbols, lower-case letters match either case but upper-case letters
match exactly.
Examples:
go doc
Show documentation for current package.
go doc Foo
Show documentation for Foo in the current package.
(Foo starts with a capital letter so it cannot match a package path.)
go doc json
Show documentation for the encoding/json package.
go doc json
Shorthand for encoding/json assuming only one json package
is present in the tree.
go doc json.Number (or go doc json.number)
Show documentation and method summary for json.Number.
go doc json.Number.Int64 (or go doc json.number.int64)
Show documentation for the Int64 method of json.Number.
Flags:
-u
Show documentation for unexported as well as exported
symbols and methods.
===
Still to do:
Tests.
Disambiguation when there is both foo and Foo.
Flag for case-sensitive matching.
Change-Id: I83d409a68688a5445f54297a7e7c745f749b9e66
Reviewed-on: https://go-review.googlesource.com/9227
Reviewed-by: Russ Cox <rsc@golang.org>
Previously, running
$ go get -u -v golang.org/x/tools/cmd/godoc
would results in dozens of HTTP requests for
https://golang.org/x/tools?go-get=1
once per package under x/tools.
Now it caches the results. We still end up doing one HTTP request for
all the packages under x/tools, but this reduces the total number of
HTTP requests in ~half.
This also moves the singleflight package back into an internal
package. singleflight was originally elsewhere as a package, then got
copied into "net" (without its tests). But now that we have internal,
put it in its own package, and restore its test.
Fixes#9249
Change-Id: Ieb5cf04fc4d0a0c188cb957efdc7ea3068c34e3f
Reviewed-on: https://go-review.googlesource.com/8727
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
There's no point to having them in every GOOS_GOARCH directory,
since they are neither GOOS- nor GOARCH-specific.
(There used to be other headers that were.)
This makes building for additional toolchains easier:
no need to run make.bash at all.
Fixes#10049.
Change-Id: I710ecaafd7a5c8cad85ccd595ea9cb6058f553b3
Reviewed-on: https://go-review.googlesource.com/6471
Reviewed-by: Rob Pike <r@golang.org>
This CL will break any uses of 'go tool 5a' etc.
That is intentional.
Code that invokes an assembler directly should be updated to use go tool asm.
We plan to keep the old5a around for bit-for-bit verification during
the release testing phase, but we plan to remove those tools for the
actual release. Renaming the directory now makes sure that lingering
references to 'go tool 5a' will be caught, changed to use asm, and
tested during the release evaluation.
Change-Id: I98748a7ddb34cc7f1b151c2ef421d3656821f5c2
Reviewed-on: https://go-review.googlesource.com/6366
Reviewed-by: Rob Pike <r@golang.org>
mv cmd/new5l cmd/5l and so on.
Minimal changes to cmd/dist and cmd/go to keep things building.
More can be deleted in followup CLs.
Change-Id: I1449eca7654ce2580d1f413a56dc4a75f3d4618b
Reviewed-on: https://go-review.googlesource.com/6361
Reviewed-by: Rob Pike <r@golang.org>
Liblink is still needed for the linker (for a bit longer) but mostly not.
Delete the unused parts.
Change-Id: Ie63a7c1520dee52b17425b384943cd16262d36e3
Reviewed-on: https://go-review.googlesource.com/6110
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The existing Hostname function uses the GetComputerName system
function in windows to determine the hostname. It has some downsides:
- The name is limited to 15 characters.
- The name returned is for NetBIOS, other OS's return a DNS name
This change adds to the internal/syscall/windows package a
GetComputerNameEx function, and related enum constants. They are used
instead of the syscall.ComputerName function to implement os.Hostname
on windows.
Fixes#9982
Change-Id: Idc8782785eb1eea37e64022bd201699ce9c4b39c
Reviewed-on: https://go-review.googlesource.com/5852
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Carlos Castillo <cookieo9@gmail.com>
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
Also stop building objwriter, which was only used by them.
Change-Id: Ia2353abd9426026a81a263cb46a72dd39c360ce4
Reviewed-on: https://go-review.googlesource.com/5634
Reviewed-by: Rob Pike <r@golang.org>
Make cmd/ld a real library invoked by the individual linkers.
There are no reverse symbol references anymore
(symbols referred to in cmd/ld but defined in cmd/5l etc).
This means that in principle we could do an automatic
conversion of these to Go, as a stopgap until cmd/link is done
or as a replacement for cmd/link.
Change-Id: I4a94570257a3a7acc31601bfe0fad9dea0aea054
Reviewed-on: https://go-review.googlesource.com/4649
Reviewed-by: Rob Pike <r@golang.org>
Currently, if there is a VERSION.cache, running make.bash will set
runtime.theVersion to the revision as of the *last* make.bash run
instead of the current make.bash run.
For example,
$ git rev-parse --short HEAD
5c4a86d
$ ./make.bash
...
$ cat ../VERSION.cache
devel +5c4a86d Tue Feb 10 01:46:30 2015 +0000
$ git checkout a1dbb92
$ ./make.bash
...
$ go version
go version devel +5c4a86d Tue Feb 10 01:46:30 2015 +0000 linux/amd64
$ ./make.bash
...
$ go version
go version devel +a1dbb92 Tue Feb 10 02:31:27 2015 +0000 linux/amd64
This happens because go tool dist reads the potentially stale
VERSION.cache into goversion during early initialization; then cleans,
which deletes VERSION.cache; then builds the runtime using the stale
revision read in to goversion. It isn't until make later in the build
process, when make.bash invokes go tool dist again, that VERSION.cache
gets updated with the current revision.
To address this, simply don't bother fetching the version until go
tool dist needs it and don't bother caching the value in memory. This
is more robust since it interacts with cleaning in the expected ways.
Futhermore, there's no downside to eliminating the in-memory cache;
the file system cache is perfectly reasonable for the whole three
times make.bash consults it.
Change-Id: I8c480100e56bb2db0816e8a088177004d9e87973
Reviewed-on: https://go-review.googlesource.com/4540
Reviewed-by: Russ Cox <rsc@golang.org>
- obj: add a missing setting of the context for a generated JMP instruction
- asm: correct the encoding of mode (R)(R*scale)
- asm: fix a silly bug in the test for macro recursion.
- asm: accept address mode sym(R)(R*8); was an oversight
Change-Id: I27112eaaa1faa0d2ba97e414f0571b70733ea087
Reviewed-on: https://go-review.googlesource.com/4502
Reviewed-by: Russ Cox <rsc@golang.org>
cmd/dist: recognize darwin/arm as (host) goos/goarches. also hard
code GOARM=7 for darwin/arm.
make.bash: don't pass -mmacosx-version-min=10.6 when building for
darwin/arm.
Change-Id: If0ecd84a5179cd9bb61b801ac1899adc45f12f75
Reviewed-on: https://go-review.googlesource.com/2126
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
cmd/gc contains symbol references into the back end dirs like 6g.
It also contains a few files that include the back end header files and
are compiled separately for each back end, despite being in cmd/gc.
cmd/gc also defines main, which makes at least one reverse symbol
reference unavoidable. (Otherwise you can't get into back-end code.)
This was all expedient, but it's too tightly coupled, especially for a
program written Go.
Make cmd/gc into a true library, letting the back end define main and
call into cmd/gc after making the necessary references available.
cmd/gc being a real library will ease the transition to Go.
Change-Id: I4fb9a0e2b11a32f1d024b3c56fc3bd9ee458842c
Reviewed-on: https://go-review.googlesource.com/3277
Reviewed-by: Rob Pike <r@golang.org>