1
0
mirror of https://github.com/golang/go synced 2024-10-01 08:18:32 -06:00
Commit Graph

1552 Commits

Author SHA1 Message Date
Nigel Tao
9622599500 cmd/vet: allow spaces in struct tag values.
The validateStructTag code now closely mimics the StructTag.Get code in
package reflect.

This addresses the comment raised on issue #9500:
https://github.com/golang/go/issues/9500#issuecomment-70218780

See also https://go-review.googlesource.com/3953

Change-Id: I583f7447dbc5a2d7ecbb393d9bb6b1515cb10b18
Reviewed-on: https://go-review.googlesource.com/3952
Reviewed-by: Rob Pike <r@golang.org>
2015-02-06 02:26:15 +00:00
Joël Stemmer
913f41fc5f cmd/vet: warn about zero arg index in print format
Argument indexes in a format string are one-based, however vet would not
warn when using a zero-index unless the type of the argument referenced
was not a string. That warning was misleading as it would say the type
was not a string. Vet will now print a correct warning when using a zero
index.

Included are tests for both cases.

Fixes #9752

Change-Id: I285e99990a86a653b4668b0c279d5f5f1c34f7aa
Reviewed-on: https://go-review.googlesource.com/3692
Reviewed-by: Rob Pike <r@golang.org>
2015-02-04 18:31:58 +00:00
Alan Donovan
0dda50d42a go/loader: improve robustness in face of input errors
Before this change, many kinds of error would cause the loader to stop.
    making it brittle when analyzing large codebases, as in "godoc -analysis".

    This change moves operations that used to occur during
    configuration---(*build.Context).Import, loading, and parsing of
    initial packages---into the Load call, and ensures that all failures
    during Loading are reported at the end so that the maximum amount of
    progress is made.

    Also: redesign the tests and add many new cases.

Change-Id: Ia8cd99416af7c5d4a5fe133908adfa83676d401f
Reviewed-on: https://go-review.googlesource.com/3626
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-02 20:01:59 +00:00
Matt T. Proud
7f3a9aa4e4 benchmark/parse: fix cosmetic defect in error str.
The "Benchmark" header parser's error string lacked a closing double
quotation mark.

Change-Id: I2361cc86866296503f2733aa84b3fd52cdf33c09
Reviewed-on: https://go-review.googlesource.com/3683
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-02 17:07:43 +00:00
Robert Griesemer
1afe783e9f go/types: update testdata (fix build)
Change-Id: Ifd38444c7c22f65f6e85fe6233b01703d1d14b4f
Reviewed-on: https://go-review.googlesource.com/3540
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-29 22:22:27 +00:00
Andrew Gerrand
39a2d013be cmd/tipgodoc: set GOROOT_BOOTSTRAP environment variable
Change-Id: I7d5dc5f7510641d2976f2ea6acf0d52cb10b94e8
Reviewed-on: https://go-review.googlesource.com/3266
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-24 16:29:45 +00:00
Alan Donovan
84312aa521 refactor/rename: clarify usage message
In the example, we use backslashes (not single quotes) to escape
double-quotes since it works on both Windows and POSIX.

Change-Id: Id883f5457bec4d8a36d5b12c759ad385125a98a6
Reviewed-on: https://go-review.googlesource.com/2862
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-23 18:40:31 +00:00
Alan Donovan
d569772660 Extend duplicate check to exported wrappers
Change-Id: I892fca0a374476aa9e65bf26fb03b73d6a0ae75a
Reviewed-on: https://go-review.googlesource.com/1583
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-23 18:36:53 +00:00
Alex Brainman
2ef5a0d23b refactor/rename: make tests pass on windows (fixes build)
- use import path not file path in go/buildutil.FakeContext OpenFile;
- use regexp to compare error messages in TestErrors, because
  they contain windows file paths;
- use OS file path (not unix path), when checking move results
  in TestMoves.

Change-Id: Ib62d344acb551fb612d8a0773ae1ab5f18341294
Reviewed-on: https://go-review.googlesource.com/3171
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-23 05:30:55 +00:00
Alan Donovan
96af1504f6 go/ssa: add list-of-tests constant to generated testmain package
And log its value in godoc -analysis.

Related to issue 8968

Change-Id: I96a96922a3fa5c434c69e0faff1cc8ec4686b6f2
Reviewed-on: https://go-review.googlesource.com/3154
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-22 22:45:41 +00:00
Alan Donovan
f011631cea go/ssa: simplify TypesWithMethodSets
Details:
- rename (*Program).TypesWithMethodSets() to RuntimeTypes()
- delete (*Package).TypesWithMethodSets() method and simplify
- move code to methods.go
- update test to use

1-2% improvement in space and time (though I barely trust this data
because the GC at tip is in such terrible state).

Change-Id: I38eab78b11e0ad0ff16e0530e775b6ff6a2ab246
Reviewed-on: https://go-review.googlesource.com/3148
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-22 14:03:32 +00:00
Alan Donovan
e079f6c632 go/ssa: change import path of synthetic test package to "test$main"
...to avoid namespace conflicts.
Also make its name "main", since it defines func main().

And fix 2 typos.

Change-Id: I7cf7894d6bed134907b3d2742255e5a82426071b
Reviewed-on: https://go-review.googlesource.com/3150
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-21 22:21:01 +00:00
Alan Donovan
4d45c85020 go/types: expose IsInterface predicate, eliminating 6 copies
Change-Id: I3704d7bd7a11f691c66556c1b77ef79a503d2fe9
Reviewed-on: https://go-review.googlesource.com/2173
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-21 18:49:27 +00:00
Andrew Gerrand
d702aaaabe cmd/godoc: add golang.org/x/build to go-import redirect list
Change-Id: Id372b2da716b31bc016855d2d7f783fd1764e5c0
Reviewed-on: https://go-review.googlesource.com/3110
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-21 06:59:18 +00:00
Andrew Gerrand
cb6b359e69 dashboard: delete after move to the golang.org/x/build repository
Change-Id: I04335eb643d342fa7de1f39fc3fc26b1543a60e1
Reviewed-on: https://go-review.googlesource.com/3078
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-21 06:38:18 +00:00
Brad Fitzpatrick
b34c44b0e2 dashboard: buildlet client, server, and gomote enhancements
- get tarballs out of buildlets
- gomote can pass arguments to buildlet's exec handler
- buildlet's exec handler can run system-level commands
- hard-code GOROOT_BOOTSTRAP to be "go1.4" under the workdir
- adjust MTU size on GCE

etc

Change-Id: I73e18b7a5e395a889f5ee93ba9850d331ffb7812
Reviewed-on: https://go-review.googlesource.com/3052
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-21 02:32:54 +00:00
Dominik Honnef
4a084c7791 refactor/rename: allow passing -force flag from Emacs
Change-Id: Iac9355bc8a98cf61cb3d4ff871723ce466d38531
Reviewed-on: https://go-review.googlesource.com/2912
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-20 22:08:13 +00:00
Brad Fitzpatrick
b09f9e69fa dashboard/cmd/buildlet: support for writing files from tgz URL directly
Client + server support, and gomote flags.

Change-Id: I91320f47731f8c69b84c4961028bfbbdfc85467a
Reviewed-on: https://go-review.googlesource.com/3029
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-20 04:00:09 +00:00
Brad Fitzpatrick
3aad931e88 dashboard: start of cmd/gomote buildlet client, more packification
Change-Id: I874f4f5ef253cf7f1d6d5073d7c81e76fa1de863
Reviewed-on: https://go-review.googlesource.com/2981
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-20 03:05:44 +00:00
Brad Fitzpatrick
3ecc311976 dashboard: move buildlet exec code from coordinator to client package
Change-Id: I778ac78ed02be9f67436ec045a3816dfc24afda3
Reviewed-on: https://go-review.googlesource.com/2923
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-16 17:58:30 +00:00
Brad Fitzpatrick
d78771bc1c dashboard: create buildlet client package, move coordinator code into it
Operation Packification, step 2 of tons.

Eventually the buildlet client binary will use this stuff now.

Change-Id: I4cf5f3e6beb9e56bdc795ed513ce6daaf61425e3
Reviewed-on: https://go-review.googlesource.com/2921
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-16 16:34:20 +00:00
Jongmin Kim
694e7507fc present: fix References link of talks.golang.org
Change-Id: I797a745dc891483217b732e9bf5413539f8c417e
Reviewed-on: https://go-review.googlesource.com/2954
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-16 16:06:45 +00:00
Nigel Tao
045f02ba9d cmd/stringer: fix ignored error in TestEndToEnd.
Change-Id: Ia139e9da37aecddebe8895c0d3427d7e97d408f8
Reviewed-on: https://go-review.googlesource.com/2931
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-01-15 23:10:50 +00:00
Alan Donovan
771af7e25c go/buildutil: FakeContext: create build.Context of fake file tree, for testing
This refactoring of the tests of go/loader and refactor/rename made it
possible to write some loader tests I wanted, but the new tests reveal
bugs so they're commented out for now.  I will fix them in a follow-up.

Change-Id: Iae3a20681a0a0791076debd4b82bb5ed74b0c577
Reviewed-on: https://go-review.googlesource.com/2825
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-15 22:46:57 +00:00
Brad Fitzpatrick
03b46a3e2f dashboard: move builder configuration out of coordinator into a package
The new package will be used by the buildlet command line tool in the
future.

Also use the metadata package in the coordinator for the master build key,
since it was already depending on that package. Might as well use it.

Change-Id: I6ad7593787ebba364090951ccbaecb4aa38e1dd6
Reviewed-on: https://go-review.googlesource.com/2920
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-15 22:21:59 +00:00
Brad Fitzpatrick
44f7d38ccc dashboard/cmd/retrybuilds: add another flaky detection rule
Change-Id: Ifb88fc7903260e9d32dbeac6bfbc1b60d26bedc8
Reviewed-on: https://go-review.googlesource.com/2891
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-15 21:50:13 +00:00
Brad Fitzpatrick
94e3c965eb dashboard: fixes from tree move, use 'extdep' build tag consistently
extdep means the package has contains external dependencies and will
be omitted from the regular x/tools build + tests.

Change-Id: I48d9161665811f0a0dc988d6f0c25d9c14b9e4ab
Reviewed-on: https://go-review.googlesource.com/2892
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-15 18:52:22 +00:00
Hyang-Ah Hana Kim
e14d0b6f6b cmd/godoc: godoc test needs clean up tmp dir when buildGodoc fails.
Change-Id: I584ed27d37a85d39294b07febf396f567d4016a5
Reviewed-on: https://go-review.googlesource.com/2901
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-15 18:36:28 +00:00
Brad Fitzpatrick
e83451b9c2 dashboard: rearrange tree, in prep for packagification
Package main binaries now go under cmd, leaving the top level for
similarly-named packages.

I'll be moving a lot of data structures and functions out of the
commands and into common packages.

A future CL will also unify all the "+build whatever" restrictions
into one common build tag, since there will be so much package sharing
coming up. Probably they will become "+build extdep", to indicate that
they have dependencies outside of x/tools.

Change-Id: Idc198e0dfa933b5f5de8f2b581533e8d299d2293
Reviewed-on: https://go-review.googlesource.com/2738
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-15 02:58:11 +00:00
Dominik Honnef
9f20d8c198 benchmark/parser, cmd/benchcmp: improve names of exported identifiers
Most of the names have been brought in line with the names used in
testing/BenchmarkResult. For example, NsOp becomes NsPerOp.

Additionally, "Bench" becomes "Benchmark" and "BenchSet" becomes "Set".

Change-Id: I7dfca68a804e285a87ab9692b5bb99ccb676da7f
Reviewed-on: https://go-review.googlesource.com/2610
Reviewed-by: Rob Pike <r@golang.org>
2015-01-15 01:28:17 +00:00
Brad Fitzpatrick
d272cc0504 dashboard/builder: log to stderr when a build fails
Fixes golang/go#9593

Change-Id: I62c8152995db05945fb0c3dd5c62915e45aaeff9
Reviewed-on: https://go-review.googlesource.com/2737
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-01-14 23:47:04 +00:00
Brad Fitzpatrick
31ce909f96 dashboard/coordinator: set timeout when polling buildlet, show more status
Change-Id: I04f1f2bb1f13718a07f6939042b61b3f675ca8be
Reviewed-on: https://go-review.googlesource.com/2735
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-14 23:30:16 +00:00
Brad Fitzpatrick
c573f9d0b5 dashboard/buildlet: fix start-up crash when TLS attributes aren't set
I had never run the 44d7ecb402 on GCE, and never caught that it
crashed on start-up if TLS attributes weren't defined.

Updated to use the new NotDefinedError from the metadata package in
https://code-review.googlesource.com/#/c/1790/

Change-Id: Iaec8df126e4cef8026c930e8cc0163ae088affb3
Reviewed-on: https://go-review.googlesource.com/2736
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-01-14 23:00:17 +00:00
Andrew M Bursavich
ac8637e9fa container/intsets: Intersects, SubsetOf, SymmetricDifference(With)
Just reading through intsets and decided to knock out a few TODOs.

Change-Id: I677dbcc5ff934fbe0f0af09a4741e708a893f8db
Reviewed-on: https://go-review.googlesource.com/2733
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-14 20:51:28 +00:00
Brad Fitzpatrick
84afeba471 dashboard: consolidate upload code, update to new oauth2 libraries
Adds dashboard/upload/upload.go, instead of oddly shoving it as part
of the coordinator/buildongce tool.

And as part of that (in order to compile and test buildongce/create.go
without installing mercurial on this machine), I updated it from
goauth2 to oauth2.

Despite this "just" being a cleanup CL, it took forever because I hit
OAuth2+Cloud Storage+Web UI woes along the way, documented partially
in upload.go. The web UI misled me for a long time. Maybe I shouldn't
have used service accounts, but it does make configuration easier for
upload.go. The buildongce/create.go probably should use them too,
but I can do that later. I'm done cleaning for now.

Change-Id: Icb8e3decb682d3685edffecea2a10fcb4e385e10
Reviewed-on: https://go-review.googlesource.com/2731
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-14 18:11:56 +00:00
Michael Matloob
796e50ba32 cmd/mvpkg: a package moving tool
This change adds a command mvpkg that will move a given package and
update all its imports. It uses similar logic to gorename to update
the imports.

Change-Id: Iebbd0b4c93c2302b0a71c3b99c68f6778106012a
Reviewed-on: https://go-review.googlesource.com/1973
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-14 17:37:29 +00:00
Alan Donovan
9c9660e35a go/loader: use concurrency to reduce I/O latency and perform typechecking in parallel.
See loader.go comments for orientation.

This is what happens when you use start using Dmitry's new trace tool. :)

Tests:
- added test of cycles
- load/parse/typecheck of 'godoc' is ~2.5x faster
- race detector finds no errors.

Change-Id: Icb5712c7825002342baf471b216252cecd9149d6
Reviewed-on: https://go-review.googlesource.com/1582
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-14 16:10:20 +00:00
Andrew Gerrand
af97332187 cmd/godoc: send go-source meta tag for golang.org/x repos
This allows godoc.org to link to the source code. I chose to link to
github.com instead of googlesource.com because their file browser is
better.

Details here:
864b1c0aba

Change-Id: I962b3fadc822e753245f52240937be5c7e158dc7
Reviewed-on: https://go-review.googlesource.com/2719
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-14 02:42:10 +00:00
Brad Fitzpatrick
44d7ecb402 dashboard/buildlet: optional TLS + password support
Change-Id: Id72301c1be8da12d2c31cbec6cc94f26dc5ad808
Reviewed-on: https://go-review.googlesource.com/2743
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-13 23:27:48 +00:00
David Crawshaw
e0ba1bf74c cmd/vet: keep processing files after warning
This lets go vet produce useful results for syscall on darwin/amd64,
otherwise it gets caught on asm.s.

Change-Id: I3daa49cf61eeada52eb9d4e94e40c4d21d1d5b2d
Reviewed-on: https://go-review.googlesource.com/2741
Reviewed-by: Rob Pike <r@golang.org>
2015-01-13 19:51:41 +00:00
Alan Donovan
47f2109c64 go/ssa: slight simplification to setCallFunc
Change-Id: I6b8cc35f779910ebab3db9994bb17456a6df4b94
Reviewed-on: https://go-review.googlesource.com/2742
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-13 17:32:58 +00:00
Peter Collingbourne
d3e7567302 go/loader: introduce PackageCreated hook
PackageCreated is a hook called when a types.Package
is created but before it has been populated.

The package's import Path() and Scope() are defined,
but not its Name() since no package declaration has
been seen yet.

Clients may use this to insert synthetic items into
the package scope, for example.

Change-Id: I210a0c4c766f03f715f03f26d5cd765f15f56e04
Reviewed-on: https://go-review.googlesource.com/2138
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-13 15:48:33 +00:00
Peter Collingbourne
4f8578d2c0 astutil: move to go/ast/astutil
Change-Id: I9a45bfc07613eb2210081d306d71f0a4d152eda5
Reviewed-on: https://go-review.googlesource.com/2592
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-13 15:47:47 +00:00
Tw
230eaff9cf cmd/benchcmp: close file when parse done
prevent file descriptor leak

Signed-off-by: Tw <tw19881113@gmail.com>

Change-Id: Ia1cacb3a287477b1f9b50fae248b5c34156c9557
Reviewed-on: https://go-review.googlesource.com/2740
Reviewed-by: Rob Pike <r@golang.org>
2015-01-13 09:03:36 +00:00
Brad Fitzpatrick
996ff9bec3 dashboard/env: update Linux builders to contain Go 1.4 for GOROOT_BOOTSTRAP
Change-Id: I256168d1bbe542ae78e4c1e7c4879d2b62b74c7e
Reviewed-on: https://go-review.googlesource.com/2690
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-13 01:43:41 +00:00
Rob Pike
682ca03389 vet: improve validation of struct tags
Actually parse the strings to check them more accurately.
The particular problem it missed was that it didn't check
for control characters in the key. The only valid separator
is a space.

More tests.

Fixes #9500

Change-Id: Ib547e11c7e8d47d81eb8b1e8f1ab9c26174933df
Reviewed-on: https://go-review.googlesource.com/2685
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-12 23:15:16 +00:00
Alan Donovan
86040b7505 go/types: close scope for each "select" case after its body
Classic Go pitfall: "defer" in a loop does not do what you might expect.

+ test case

Fixes issue 9570
Fixes issue 9569

Change-Id: Iec05420872ef71190083a7192f76c92f54f4a2a1
Reviewed-on: https://go-review.googlesource.com/2655
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-12 18:04:11 +00:00
Andrew Gerrand
4ed956ea27 cmd/tipgodoc: kill old process as we switch over
Change-Id: I0d311b479441d1a359f953466e4ff93f3397c52d
Reviewed-on: https://go-review.googlesource.com/2630
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-12 02:54:00 +00:00
Brad Fitzpatrick
d79e0375a0 dashboard/builder: pass GOROOT_BOOTSTRAP to child processes
Part of https://golang.org/s/go15bootstrap

This is one step in a series of CLs to make the dev.cc branch build
after https://golang.org/cl/2470 (which converted cmd/dist from C to
Go)

TBR to adg because subsequent changes to Dockerfiles depend on knowing
the commit hash of this one.

Change-Id: I26122e2446c345446bbbca0df601f50ea9383adb
Reviewed-on: https://go-review.googlesource.com/2651
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-11 18:38:01 +00:00
Dmitri Shuralyov
c10e262955 go/vcs: fix bug in remote package discovery
The parser was assuming it would find <body> or </head>.
If the entire response is just <meta> tags, it finds EOF and
treats that as an error. It's not.

This is the same change as in https://golang.org/cl/68520044.

Fixes #9556.

Change-Id: If51ed36e7364c15788311039caf8323eb5fe9a6c
Reviewed-on: https://go-review.googlesource.com/2650
Reviewed-by: Minux Ma <minux@golang.org>
2015-01-10 08:10:09 +00:00