Apparently there was a typo during initial import,
and compilebench was placed at the top level,
rather than in the cmd subdirectory. Oops. Fix that.
Change-Id: Ibea9ed132dca26c022ea02933defec9534105f18
Reviewed-on: https://go-review.googlesource.com/39792
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
When the -count flag is provided,
instead of having each run overwrite the previous profile,
add a count suffix to the profile filename.
Then you can combine the profiles with
go tool pprof `go tool -n compile` <all profile files here>
This allows generation of precise profiles,
even for fast-compiling packages.
Change-Id: I006cf8fad143346b28a646a0b3582cc0f6eec310
Reviewed-on: https://go-review.googlesource.com/39718
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Instead of running make.bash, run 'go build -a std cmd'.
Change the benchmark name to reflect this.
This does roughly the same task, namely compile and link
all the code in the tree, but with several advantages:
* It works cross-platform.
* It is a bit faster, while measuring the same fundamentals.
* It doesn't measure how fast the bootstrap compiler works,
which is irrelevant.
* If interrupted, it leaves the current Go installation
in a usable state.
Change-Id: I469b1d032b48b06e3dea021bd031283bc3a16ff4
Reviewed-on: https://go-review.googlesource.com/39714
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
There's a surprising amount of variety
in the drivers of compilation speed.
It's helpful to have a variety of packages here.
For example, archive/tar exhibits golang/go#19839
much more than the others.
Change-Id: If66b332d63427fb246305cb14cfee9ef450bcdcf
Reviewed-on: https://go-review.googlesource.com/39713
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This CL is an import of compilebench from rsc.io/compilebench
at commit 1a5bec7724500bd6df47e053dbc42b41fe653372.
This CL brings in only main.go, unaltered.
The other files were:
* LICENSE: now unnecessary
* README.md: now unnecessary
* compilecmp: still available at its original home,
soon to be superceded by a new tool in x/tools
Once compilecmp is available in x/tools,
I will replace rsc.io/compilebench with a breadcrumb repo.
All outstanding pull requests against rsc.io/compilebench are from me.
They will be closed, and new CLs sent here as appropriate.
Change-Id: Ic436abf4a662173c6c184bc765b1b9cab13b3cfb
Reviewed-on: https://go-review.googlesource.com/39712
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Linking cmd for android requires a cross-compiling toolchain,
which is not standard fare.
Skip it, and trust that the other platforms will pick up the slack.
Change-Id: Ifcf74f77e98489c859805ab7a448d80d019f3d20
Reviewed-on: https://go-review.googlesource.com/39556
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
At some point we switched tip.golang.org to run in GKE, which
terminates TLS directly on port 443. This requires a new technique
for detecting a plain HTTP connection. In addition we may want to run
talks.golang.org on App Engine Flex, which uses an X-Forwarded-Proto
header to indicate HTTP, so let's prepare for that possibility.
Fixesgolang/go#19759.
Change-Id: Iddc567214c5d28f61c405db065aa1b3f2c92fd85
Reviewed-on: https://go-review.googlesource.com/38800
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Change-Id: Ia12ff7a0f6898f8d140565d255793904ce8585c4
Reviewed-on: https://go-review.googlesource.com/38754
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Change-Id: Ie19a60595862c0afff9364ee21dd9598370e6c91
Reviewed-on: https://go-review.googlesource.com/38752
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This is already tested in the std library. Ok to take the easy way
out here.
Change-Id: Ie17e16fddba827bfe279e1f790006b3874f830ad
Reviewed-on: https://go-review.googlesource.com/38455
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This fixes several issues:
* The ls sed hackery generates GOARCH values mipsx and mipsxle,
instead of mips, mips64, mipsle, and mips64le.
* It removes the dependence on the 9 command.
* It marginally increases readability.
Change-Id: Ie46abc289c2c9923eed693dcf1194f4fd3ea9bd2
Reviewed-on: https://go-review.googlesource.com/38347
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
In golang.org/cl/38089, I removed all of the prog.go files.
Change-Id: I4d8dd021a62b5d6d8b7cb5cfe0ecd7268812805c
Reviewed-on: https://go-review.googlesource.com/38432
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The runtime cannot be compiled with optimizations disabled.
This lead to very confusing error messages
when toolstash -cmp failed.
Change-Id: Ie341d633ff9b26693b475957309591ff0757f1ab
Reviewed-on: https://go-review.googlesource.com/38378
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This allows URLs like golang.org/wiki/DevExp/, where before only
golang.org/wiki/DevExp was accepted.
Fixesgolang/go#19432.
Change-Id: Ie41a4fe1d1930fd947c1d0523060d08c7c6d6d39
Reviewed-on: https://go-review.googlesource.com/37882
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
Found with honnef.co/go/tools/cmd/unused (in CockroachDB).
Change-Id: I0e2f7ac6ad2a0fdc724928f316060f06c3261ece
Reviewed-on: https://go-review.googlesource.com/38178
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Found with honnef.co/go/tools/cmd/simple.
Change-Id: I04c65394f1c6404f57bb2088353325899f35011f
Reviewed-on: https://go-review.googlesource.com/38177
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
types.SizesFor was introduced for Go 1.9. Need to provide
a local implementation to have gotype build against earlier
versions.
Fixesgolang/go#19545.
Change-Id: I6fdbe414e6574eda00c01295b666230daff2dfdc
Reviewed-on: https://go-review.googlesource.com/38157
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Except for the added comment in the beginning and the removal of
the 'ignore' build tag, there is no difference between gotype.go
and the original.
Fixesgolang/go#19516.
Change-Id: Ie1ab9aced6e650573c2cdce0c165af1e1094213f
Reviewed-on: https://go-review.googlesource.com/38132
Reviewed-by: Alan Donovan <adonovan@google.com>
Change the shouldTraverse function to no longer keep a global map of
which inodes it's seen. Instead, whenever a symlink is seen for a path
name, check every directory entry in that path name and see if any are
the same inode as the current one, detecting any loop just from the
name itself.
More details of why the test was flaky are in the bug.
Fixesgolang/go#18142
Change-Id: I869f7a13d130c63d78b7af81802a16c4b4b2f3bd
Reviewed-on: https://go-review.googlesource.com/37947
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The go1.9 type checker now returns fake packages in addition to an
error if the package was not found at all. This changes the behavior
of guru in a release-specific way, requiring the test to be split into
a common part and a go1.9-specific part.
In hindsight, perhaps it would have been better to place the
expectation in a comment alongside the query so that they can be
easily enabled or disabled together. (The downside of that design is
that you can't batch-update all the expectations to match the actual
behavior.)
Change-Id: I58054adec428fbab7fe3c57097aefc827f89a46e
Reviewed-on: https://go-review.googlesource.com/37865
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The existing API for querying values only allows directly querying
pointer-like values, or pointers to such values. The new, extended
queries make it possible to destructure values and access arbitrarily
nested pointers, such as fields in structs, or specific values in
tuples.
We use single Go expressions as the queries, which we further restrict
to a subset of the language (indexing, field access, pointer
dereferences and channel receives).
Instead of adding another map to Result, we return a *Pointer and
populate it during analysis. This does mean that a Config cannot be
reused for multiple analyses, as it now holds analysis-specific state.
That is, however, not a big problem as reusing one Config had little
use.
Since the new API can do everything the old could, it deprecates
AddQuery and AddIndirectQuery.
Change-Id: I4b2ae7d85c462bc7faa6bab76456106e76be5a65
Reviewed-on: https://go-review.googlesource.com/37635
Reviewed-by: Alan Donovan <adonovan@google.com>
Prior to this change, handlerServer.GetPageInfo created a build.Context
starting with build.Default, and provided custom implementations for
its IsAbsPath, ReadDir, and OpenFile funcs. Those funcs would operate
on h.c.fs virtual filesystem.
https://godoc.org/go/build#Context.IsDir is documented as:
// IsDir reports whether the path names a directory.
// If IsDir is nil, Import calls os.Stat and uses the result's IsDir method.
IsDir func(path string) bool
IsDir was left as nil, and so the default implementation was used.
The default implementation uses os.Stat and isn't aware of the h.c.fs
virtual filesystem.
This appears to have been harmless in the past, but after the change to
go/build in https://golang.org/cl/33158, it started to interfere with
the operation of godoc. The command godoc began to fail to resolve
relative import path "." in directories that exist, because the
incorrect IsDir implementation was looking in real filesystem, rather
than the virtual one:
$ ./godoc fmt
2017/03/04 18:59:50 cannot find package "." in:
/target
$ ./godoc -http=localhost:6060
2017/03/04 19:00:07 cannot find package "." in:
/src/fmt
Providing a custom implementation of IsDir that is aware of the h.c.fs
virtual filesystem, and performs a stat operation on the correct path
there resolves that problem. It also fixes the failing tests.
Additionally, because the exact error string returned from
Context.Import has changed after https://golang.org/cl/33158,
and now contains the text "package not found" rather than the
underlying error text from filesystem caused by a failed ReadDir
operation, the expected error message from "./godoc nonexistingpkg"
in a test needed to be updated to "cannot find package". It's no longer
dependent on the operating system.
It might be desirable to provide more relevant detail in the error
message from cmd/godoc when a package is not found, but that should be
determined and done in a followup CL. The scope of this one is to fix
normal functionality.
This change follows update to go/build in https://golang.org/cl/33158.
Helps golang/go#19401.
Change-Id: I00e2f746ec4a2fe7e640218adce75f15bdf29aaf
Reviewed-on: https://go-review.googlesource.com/37768
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
CL golang.org/cl/37349 broke the tests, because the
golden files were not updated appropriately.
Change-Id: I9a2a56d1ca74b8bc77935aff26ed6297fbacf232
Reviewed-on: https://go-review.googlesource.com/37770
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Dominik Honnef <dominik@honnef.co>
A 'what' query reports which other query modes are applicable to the
selected syntax. A 'whicherrs' query is similar to a 'pointsto'
query, so we enable it using the same criteria.
Fixes issue golang/go#18938
Change-Id: Iae062e0c933c7764bc335488adabf816d63ac837
Reviewed-on: https://go-review.googlesource.com/37349
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Remove inadvertent and unwanted spaces in the middle of an
indented block.
Insert blank lines before indented sections for consistency.
Insert colon after "pointer" for consistency with "type".
Fixesgolang/go#19356.
Change-Id: Iaae12f69d17adb51a27b516727c13132cb8df8e8
Reviewed-on: https://go-review.googlesource.com/37660
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Dominik Honnef <dominik@honnef.co>
Package "unsafe" has no files, and is treated like a regular package since
https://go-review.googlesource.com/37710, and the interpreter needs an
init function with a body for every package.
Change-Id: I27bd7cdb1ecaf01d0b5ed91db57145d1b4f551e1
Reviewed-on: https://go-review.googlesource.com/37711
Reviewed-by: Robert Griesemer <gri@golang.org>
https://golang.org/cl/37694 is a backwards-incompatible change to the
go/types API that causes "unsafe" to be included among the results of
(*types.Package).Imports(). Client packages such as go/loader and
go/ssa now need to recognize the special unsafe package and its
unusual *Bultin members and not create a types.Package for it.
Change-Id: I902725d3053cb887246978efdb5ec5dcdc0e4818
Reviewed-on: https://go-review.googlesource.com/37710
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Found with honnef.co/go/tools/cmd/unused.
Change-Id: I193ddd265673f133a489d268629b94be693a8dbc
Reviewed-on: https://go-review.googlesource.com/37606
Reviewed-by: Alan Donovan <adonovan@google.com>
Found with honnef.co/go/tools/cmd/unused.
Change-Id: Ib8acac744a171b70f3f842f8f5f8c34064869383
Reviewed-on: https://go-review.googlesource.com/37604
Reviewed-by: Alan Donovan <adonovan@google.com>
Found with honnef.co/go/tools/cmd/unused.
Change-Id: I1dc8e4dbfd784bb22b2f0dabb7c1a08cf1ef44ee
Reviewed-on: https://go-review.googlesource.com/37603
Reviewed-by: Alan Donovan <adonovan@google.com>
Found with honnef.co/go/tools/cmd/unused.
Change-Id: Ifd1ed4005eec55cebfd5c0d0519b8af328fcc470
Reviewed-on: https://go-review.googlesource.com/37601
Reviewed-by: Alan Donovan <adonovan@google.com>
Found with honnef.co/go/tools/cmd/unused.
Change-Id: Ied3a906269ca7782071428eeb1764b3b863576a2
Reviewed-on: https://go-review.googlesource.com/37600
Reviewed-by: Alan Donovan <adonovan@google.com>
Found with honnef.co/go/tools/cmd/unused.
Change-Id: I3db2aad14de33f0be69569cd355e453173098358
Reviewed-on: https://go-review.googlesource.com/37599
Reviewed-by: Alan Donovan <adonovan@google.com>
This reverts commit 79902b439b.
Reason for revert: build broken on some platforms.
Change-Id: I5ceddc305580ff97f47ae27da831f99e96dab424
Reviewed-on: https://go-review.googlesource.com/37539
Reviewed-by: David R. Jenni <david.r.jenni@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>