1
0
mirror of https://github.com/golang/go synced 2024-11-18 14:14:46 -07:00
Commit Graph

1055 Commits

Author SHA1 Message Date
Robert Griesemer
8df7a779db go.tools/go/types: package name must not be blank
Fixes golang/go#8077.

LGTM=adonovan
R=golang-codereviews, adonovan
CC=golang-codereviews
https://golang.org/cl/91640043
2014-05-22 13:45:29 -07:00
Robert Griesemer
2afc128b30 go.tools/go/types: interfaces may not have blank methods
Fixes golang/go#8050.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/96520047
2014-05-22 13:10:53 -07:00
Robert Griesemer
2fcf90cfac go.tools/go/types: re-disable float_lit2.go std test
go/types doesn't correctly round the largest possible
float32 literal values and fails. Instead of relying
on Rat.Float64 and float32 conversion, we need a
Rat.Float32 implementation with correct rounding.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/96540045
2014-05-21 09:55:02 -07:00
Robert Griesemer
11314ad3ea go.tools/go/types: enable float_lit2.go test
Pending CL 91590047 which fixes that test.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/91630043
2014-05-21 08:54:23 -07:00
Andrew Gerrand
d29843f35e go.tools/cmd/present: re-enable transitions
They were disabled by mistake during the move to go.tools.

LGTM=dan.kortschak
R=golang-codereviews, dan.kortschak
CC=golang-codereviews
https://golang.org/cl/98440048
2014-05-21 14:35:45 +10:00
Mikio Hara
d6c0aa161e go.tools/dashboard/builder: fix build on dragonfly, nacl, solaris
LGTM=bradfitz
R=adg, bradfitz
CC=golang-codereviews
https://golang.org/cl/97640043
2014-05-21 10:45:47 +09:00
Dmitri Shuralyov
1154a04eb0 go.tools/imports: fix case where output not gofmt-compatible
Fixes 7866. Adds a test case.

When trying to add newlines before certain imports via text manipulation,
a regex is used to iterate over all imports. The regex failed to match
dot imports because \w doesn't match a literal dot. This changes the regex
to accept a dot as well.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/99400043
2014-05-20 14:02:16 -07:00
Robert Griesemer
33097bf3ed go.tools/go/types: exclude newly added std test (fix build)
TBR=adonovan

TBR=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/99410045
2014-05-20 13:27:11 -07:00
Alan Donovan
65906ce503 go.tools/container/intsets: support negative elements in BitString().
(I forgot about this when we added support for negative elements generally.)

We use floating point for negative numbers.  The order of the
output is reversed from the previous (little-endian) behaviour
since it makes for more readable floating point.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/95570043
2014-05-20 14:52:50 -04:00
Dmitri Shuralyov
c0060eca2c go.tools/astutil: fix edge case in DeleteImport causing merging of import sections.
The issue occurs only when deleting an import that has a blank line immediately preceding,
and other imports before that.

Currently, DeleteImport assumes there's a blank line-sized hole left behind
where the import was, and always deletes it. That blank line-sized hole is there in all cases
except the above edge case.

This fix checks for that edge case, and does not remove the blank line-sized hole.

The CL also adds a previously failing test case that catches this scenario. After the change to
DeleteImport, the new test passes (along with all other tests).

Fixes golang/go#7679.

Note that there is no attempt to ensure the result *ast.File and *token.FileSet are perfectly
matching to what you would get if you printed the AST and parsed it back. This is how the
rest of the package and the current tests work (i.e., they only check that printing the AST gives
the correct output).
Changing that is very hard, if not impossible, at least not
without resorting to manipulating AST via printing, text manipulation and parsing.
This is okay for most usages, but it does create potential problems. For example,
astutil.Imports() currently only works correctly on freshly parsed AST. If that AST
is manipulated via astutil funcs, then Imports() may not always generate correct
output. However, thas is a separate issue and should be treated as such.

LGTM=bradfitz
R=golang-codereviews, gobot, adonovan, bradfitz
CC=golang-codereviews
https://golang.org/cl/92250045
2014-05-19 14:04:30 -07:00
Rob Pike
4374c8910f go.tools/cmd/vet: clean up formatting of the package document
It was very ugly; a little tweaking helps godoc parse it better.
Also make unsafeptr.go not own the package doc (add a blank line)
and put one more sentence about that check into doc.go.

Fixes golang/go#7925.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/98370044
2014-05-19 11:34:31 -07:00
Chris Manghane
c309b30e41 go.tools/dashboard: update existing results when builder retries a commit
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/96360047
2014-05-19 09:51:04 -07:00
Rob Pike
a8c8f48be3 go.tools/all: the the thes are too frequent, it's clear that that's not what we want
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/98380043
2014-05-19 09:48:30 -07:00
Russ Cox
322a5f1b4c cmd/vet: add amd64p32 (nacl) support to asmdecl check
Also add 'ErrorString', for checking Plan 9's package syscall.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/93410045
2014-05-19 12:31:38 -04:00
Russ Cox
d8a81d8377 cmd/vet: fix line number in asm errors
Before:
: asm_amd64.s:16: [amd64] invalid offset new+16(FP); expected new+8(FP)
: asm_amd64.s:26: [amd64] invalid offset new+16(FP); expected new+8(FP)

After:
asm_amd64.s:16: [amd64] invalid offset new+16(FP); expected new+8(FP)
asm_amd64.s:26: [amd64] invalid offset new+16(FP); expected new+8(FP)

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/91510043
2014-05-19 12:31:28 -04:00
Rob Pike
6f17d00f0d go.tools: fix various minor issues found by go vet
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/96360048
2014-05-19 08:47:28 -07:00
Rob Pike
31d5e8dca1 go.tools/present: fix printf bug found by go vet
LGTM=iant
R=adg, iant
CC=golang-codereviews
https://golang.org/cl/93450044
2014-05-16 14:29:34 -07:00
Rob Pike
87a30fd93f go.tools/dashboard: fix printf buf found by go vet
LGTM=iant
R=adg, iant
CC=golang-codereviews
https://golang.org/cl/100460047
2014-05-16 14:27:32 -07:00
Robert Daniel Kortschak
ab1e5c6c94 go.tools/astutil: fix parameter omission in doc comment
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/98290045
2014-05-16 10:35:33 -07:00
Alan Donovan
174d6e8ca3 go.tools/container/intsets: use " " not ", " as (*Sparse).String() separator.
This is both easier to read and 25% shorter (helpful when
using String() as a map key for interning sets).

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/96370045
2014-05-16 13:06:08 -04:00
Alan Donovan
18c694293a go.tools/go/ssa: fix incorrect indentation in SSA printout.
Very long instructions caused the printf width spec to go
negative, which causes right-padding, often several lines'
worth.

Also: print the basic block comment once on the RHS. It's too
verbose to print it each time we mention the block.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/97490046
2014-05-16 12:37:17 -04:00
Russ Cox
b752e9ffdf cmd/vet: diagnose use of unsafe.Pointer to convert integer to pointer
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/100470044
2014-05-15 15:32:51 -04:00
Alan Donovan
e1b97610f0 go.tools/container/intsets: fix compile error on 32-bit platforms.
Also, fix typo.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/99310043
2014-05-15 14:03:05 -04:00
Chris Manghane
ce3f450b0d go.tools/dashboard/builder: remove redundant makefile
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/95410043
2014-05-14 16:34:51 -07:00
Alan Donovan
61c5c64029 go.tools/container/intsets: Sparse: a space-efficient representation for ordered sets of int values.
intsets.Sparse is a sparse bit vector.  It uses space proportional
to the number of elements, not the maximum element (as is the case		for a dense bit vector).

A forthcoming CL will make use of it in go/pointer, where it reduces
solve time by 78%.  A similar representation is used for Andersen's
analysis in gcc and LLVM.

+ Tests.

LGTM=sameer, crawshaw, gri
R=gri
CC=crawshaw, golang-codereviews, sameer
https://golang.org/cl/10837043
2014-05-14 17:54:14 -04:00
Robert Obryk
91b1b28499 go.tools/cmd/vet: fix a panic on invalid AddInt
Ignore calls to various flavours of atomic.AddInt with a wrong
number of arguments.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/91370045
2014-05-14 12:16:58 -07:00
Alex Brainman
d52b449ed7 go.tools/cmd/godoc: prevent duplicate GOROOT/GOPATH in environment in TestTypeAnalysis
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/94430044
2014-05-14 12:39:20 +10:00
Alex Brainman
63a1026f64 go.tools/godoc/analysis: convert path to url (fixes windows build)
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/94440043
2014-05-14 12:38:43 +10:00
Dmitriy Vyukov
240540d096 dashboard: database updater for performance dashboard (server part)
This CL moves code from code.google.com/p/dvyukov-go-perf-dashboard,
which was previously reviewed.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/96170043
2014-05-13 11:02:19 +04:00
Dmitriy Vyukov
904c4641c7 dashboard: server app UI changes for performance dashboard
This CL moves code from code.google.com/p/dvyukov-go-perf-dashboard,
which was previously reviewed.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/96180043
2014-05-13 11:01:50 +04:00
Dmitriy Vyukov
9bb1e09cc4 dashboard: database updater for performance dashboard
This CL moves code from code.google.com/p/dvyukov-go-perf-dashboard,
which was previously reviewed.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/97250044
2014-05-13 11:01:38 +04:00
Dmitriy Vyukov
828191dc1e dashboard: server app changes for performance dashboard
This CL moves code from code.google.com/p/dvyukov-go-perf-dashboard,
which was previously reviewed.
UI part will be submitted separately.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/97260043
2014-05-13 11:00:32 +04:00
Dmitriy Vyukov
d2a9e7164e dashboard: builder changes for performance dashboard
This CL moves code from code.google.com/p/dvyukov-go-perf-dashboard,
which was previously reviewed.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/95190043
2014-05-13 11:00:11 +04:00
Andrew Gerrand
a41b4fc37a go.tools/cmd/present: update docs after move
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/99060043
2014-05-13 09:17:18 +10:00
Robert Griesemer
51d8ee0ff8 go.tools/go/types: report init dependencies via method values
- one-line fix
- comprehensive set of test cases added

Fixes golang/go#7963.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/100320043
2014-05-09 13:57:38 -07:00
Alan Donovan
4700b7a612 go/callgraph: fix asymptote trap in DeleteSyntheticNodes.
The previous implementation would cause the graph to contain
many duplicate edges resulting in very large cross products,
so that for some inputs (and random map iteration orders) the
running time of DeleteSyntheticNodes was many minutes---more
than the pointer analysis!

Duplicate edges can arise from an interface call that
dispatches to several different wrapper functions each
wrapping the same declared method.

For example, in the callgraph for go/types, a call to
Object.Pos() dispatches to the synthetic functions (*Type).Pos
and (*Var).Pos, each of which wrap (*object).Pos().  After
DeleteSyntheticNodes, Object.Pos() appeared to call
(*object).Pos() twice.

This change builds the set of all edges and avoids adding
edges already in the set.

Also, document findings.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/96100043
2014-05-08 14:03:06 -04:00
Alan Donovan
c212b356b8 go.tools/go/types: add API test of Selection mechanism.
Also: fixed a crash in (*Selection).String() for FieldVal of a
non-function type.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/93830043
2014-05-07 18:35:43 -04:00
Josh Bleecher Snyder
e6020f7229 go.tools/godoc/static: fix import path doc typo
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/98970043
2014-05-05 17:42:00 -07:00
Andrew Gerrand
ca18093fea go.tools/cmd/present: add present tool
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/97030045
2014-05-05 14:55:27 -07:00
Robert Griesemer
9f1412014f go.tools/go/types: added test case for channel make
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/95910044
2014-05-05 10:12:50 -07:00
Andrew Gerrand
3d0528640b go.tools/playground/socket: require origin to set up socket handler
This prevents cross-site request forgery attacks.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/95030044
2014-05-05 08:42:12 -07:00
Robert Griesemer
30b1abe2f7 go.tools: fix various typos
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/97920045
2014-05-02 14:38:08 -07:00
Robert Griesemer
f84e8b3f03 go.tools/cmd/godex: print correct type for const/var decls
The old code printed the underlying type; e.g., the type
of time.Millisecond was reported to be int64 rather than
time.Duration.

Testsuite (and corresponding tests) in progress (another CL).

LGTM=adonovan
R=adonovan, dsymonds
CC=golang-codereviews
https://golang.org/cl/94770045
2014-04-29 19:58:47 -07:00
Stephen Weinberg
55d5722095 imports, cmd/goimports: add missing package main if func main exists
Assuming:
        1) package declaration does not exist
        2) the Fragment option is set
        3) a main function exists

We will assume it is a main package and add the declaration.

This change also sets the Fragment option in goimports.

LGTM=crawshaw, bradfitz
R=bradfitz, crawshaw
CC=golang-codereviews
https://golang.org/cl/96850044
2014-04-28 17:15:33 -04:00
Alan Donovan
6e03bb4eb4 go.tools: remove dead code
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/90320043
2014-04-25 15:08:13 -04:00
Alan Donovan
8e263c554d go.tools/go/types: fix incorrect receiver in (*Selection).Type().
Method expressions T.f are reported as having type (T)func(T),
i.e. T appears twice, as a receiver and a regular parameter.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/96780044
2014-04-25 12:08:31 -04:00
Alan Donovan
c288136f0c go.tools/cmd/eg: Use Print, not Printf, to print Help string.
Fixes golang/go#7861

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/95770043
2014-04-25 12:03:38 -04:00
Alan Donovan
7d1d69032b go.tools/go/ssa: don't attempt fusion on single-pred blocks with φ-nodes
During block optimization, degenerate conditional logic such
as "false && x" may result in single-predecessor blocks
containing φ-nodes.  (Ideally such φ-nodes would be replaced
by their sole operand, but that requires Referrers information
which isn't computed until later.)  It is obviously not safe
to fuse such blocks, so now we don't.

Fixes golang/go#7840

LGTM=gri
R=gri
CC=golang-codereviews, pcc
https://golang.org/cl/90620043
2014-04-24 09:08:21 -04:00
Shenghou Ma
35875c1a92 go.tools/cmd/godoc/static: fix text template for variable examples.
Fixes golang/go#7771.

LGTM=bgarcia
R=golang-codereviews, bradfitz, bgarcia
CC=golang-codereviews
https://golang.org/cl/87180044
2014-04-22 18:46:26 -04:00
Robert Griesemer
4bc2f4e34b go.tools/go/types: fix doc comment
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/90100043
2014-04-21 16:35:40 -07:00