Skip to content

Commit a1ffad5

Browse files
committed
fix conflict
2 parents f4c4daa + 1e55371 commit a1ffad5

File tree

1,010 files changed

+43416
-12336
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,010 files changed

+43416
-12336
lines changed

README.md

Lines changed: 76 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,94 @@
22

33
[![PkgGoDev](https://pkg.go.dev/badge/golang.org/x/tools)](https://pkg.go.dev/golang.org/x/tools)
44

5-
This subrepository holds the source for various packages and tools that support
6-
the Go programming language.
5+
This repository provides the `golang.org/x/tools` module, comprising
6+
various tools and packages mostly for static analysis of Go programs,
7+
some of which are listed below.
8+
Use the "Go reference" link above for more information about any package.
79

8-
Some of the tools, `godoc` and `vet` for example, are included in binary Go
9-
distributions.
10+
It also contains the
11+
[`golang.org/x/tools/gopls`](https://pkg.go.dev/golang.org/x/tools/gopls)
12+
module, whose root package is a language-server protocol (LSP) server for Go.
13+
An LSP server analyses the source code of a project and
14+
responds to requests from a wide range of editors such as VSCode and
15+
Vim, allowing them to support IDE-like functionality.
1016

11-
Others, including the Go `guru` and the test coverage tool, can be fetched with
12-
`go get`.
17+
<!-- List only packages of general interest below. -->
1318

14-
Packages include a type-checker for Go and an implementation of the
15-
Static Single Assignment form (SSA) representation for Go programs.
19+
Selected commands:
1620

17-
## Download/Install
21+
- `cmd/goimports` formats a Go program like `go fmt` and additionally
22+
inserts import statements for any packages required by the file
23+
after it is edited.
24+
- `cmd/callgraph` prints the call graph of a Go program.
25+
- `cmd/digraph` is a utility for manipulating directed graphs in textual notation.
26+
- `cmd/stringer` generates declarations (including a `String` method) for "enum" types.
27+
- `cmd/toolstash` is a utility to simplify working with multiple versions of the Go toolchain.
1828

19-
The easiest way to install is to run `go get -u golang.org/x/tools/...`. You can
20-
also manually git clone the repository to `$GOPATH/src/golang.org/x/tools`.
29+
These commands may be fetched with a command such as
30+
`go install golang.org/x/tools/cmd/goimports@latest`.
2131

22-
## JS/CSS Formatting
32+
Selected packages:
2333

24-
This repository uses [prettier](https://prettier.io/) to format JS and CSS files.
34+
- `go/ssa` provides a static single-assignment form (SSA) intermediate
35+
representation (IR) for Go programs, similar to a typical compiler,
36+
for use by analysis tools.
2537

26-
The version of `prettier` used is 1.18.2.
38+
- `go/packages` provides a simple interface for loading, parsing, and
39+
type checking a complete Go program from source code.
2740

28-
It is encouraged that all JS and CSS code be run through this before submitting
29-
a change. However, it is not a strict requirement enforced by CI.
41+
- `go/analysis` provides a framework for modular static analysis of Go
42+
programs.
43+
44+
- `go/callgraph` provides call graphs of Go programs using a variety
45+
of algorithms with different trade-offs.
46+
47+
- `go/ast/inspector` provides an optimized means of traversing a Go
48+
parse tree for use in analysis tools.
49+
50+
- `go/cfg` provides a simple control-flow graph (CFG) for a Go function.
51+
52+
- `go/expect` reads Go source files used as test inputs and interprets
53+
special comments within them as queries or assertions for testing.
54+
55+
- `go/gcexportdata` and `go/gccgoexportdata` read and write the binary
56+
files containing type information used by the standard and `gccgo` compilers.
57+
58+
- `go/types/objectpath` provides a stable naming scheme for named
59+
entities ("objects") in the `go/types` API.
60+
61+
Numerous other packages provide more esoteric functionality.
3062

31-
## Report Issues / Send Patches
63+
<!-- Some that didn't make the cut:
3264
33-
This repository uses Gerrit for code changes. To learn how to submit changes to
34-
this repository, see https://golang.org/doc/contribute.html.
65+
golang.org/x/tools/benchmark/parse
66+
golang.org/x/tools/go/ast/astutil
67+
golang.org/x/tools/go/types/typeutil
68+
golang.org/x/tools/go/vcs
69+
golang.org/x/tools/godoc
70+
golang.org/x/tools/playground
71+
golang.org/x/tools/present
72+
golang.org/x/tools/refactor/importgraph
73+
golang.org/x/tools/refactor/rename
74+
golang.org/x/tools/refactor/satisfy
75+
golang.org/x/tools/txtar
76+
77+
-->
78+
79+
## Contributing
80+
81+
This repository uses Gerrit for code changes.
82+
To learn how to submit changes, see https://golang.org/doc/contribute.html.
3583

3684
The main issue tracker for the tools repository is located at
3785
https://github.com/golang/go/issues. Prefix your issue with "x/tools/(your
3886
subdir):" in the subject line, so it is easy to find.
87+
88+
### JavaScript and CSS Formatting
89+
90+
This repository uses [prettier](https://prettier.io/) to format JS and CSS files.
91+
92+
The version of `prettier` used is 1.18.2.
93+
94+
It is encouraged that all JS and CSS code be run through this before submitting
95+
a change. However, it is not a strict requirement enforced by CI.

cmd/auth/cookieauth/cookieauth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// It expects the location of the file as the first command-line argument.
88
//
99
// Example GOAUTH usage:
10-
// export GOAUTH="cookieauth $(git config --get http.cookieFile)"
10+
//
11+
// export GOAUTH="cookieauth $(git config --get http.cookieFile)"
1112
//
1213
// See http://www.cookiecentral.com/faq/#3.5 for a description of the Netscape
1314
// cookie file format.

cmd/auth/gitauth/gitauth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// directory for the 'git' command as the first command-line argument.
88
//
99
// Example GOAUTH usage:
10-
// export GOAUTH="gitauth $HOME"
10+
//
11+
// export GOAUTH="gitauth $HOME"
1112
//
1213
// See https://git-scm.com/docs/gitcredentials or run 'man gitcredentials' for
1314
// information on how to configure 'git credential'.

cmd/auth/netrcauth/netrcauth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// It expects the location of the file as the first command-line argument.
88
//
99
// Example GOAUTH usage:
10-
// export GOAUTH="netrcauth $HOME/.netrc"
10+
//
11+
// export GOAUTH="netrcauth $HOME/.netrc"
1112
//
1213
// See https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html
1314
// or run 'man 5 netrc' for a description of the .netrc file format.

cmd/benchcmp/compare.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ func (x ByParseOrder) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
109109
func (x ByParseOrder) Less(i, j int) bool { return x[i].Before.Ord < x[j].Before.Ord }
110110

111111
// lessByDelta provides lexicographic ordering:
112-
// * largest delta by magnitude
113-
// * alphabetic by name
112+
// - largest delta by magnitude
113+
// - alphabetic by name
114114
func lessByDelta(i, j BenchCmp, calcDelta func(BenchCmp) Delta) bool {
115115
iDelta, jDelta := calcDelta(i).mag(), calcDelta(j).mag()
116116
if iDelta != jDelta {

cmd/benchcmp/doc.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
/*
6-
76
Deprecated: benchcmp is deprecated in favor of benchstat: golang.org/x/perf/cmd/benchstat
87
98
The benchcmp command displays performance changes between benchmarks.
@@ -34,6 +33,5 @@ in a format like this:
3433
3534
benchmark old bytes new bytes delta
3635
BenchmarkConcat 80 48 -40.00%
37-
3836
*/
3937
package main // import "golang.org/x/tools/cmd/benchcmp"

cmd/bundle/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
//
2222
// By default, bundle writes the bundled code to standard output.
2323
// If the -o argument is given, bundle writes to the named file
24-
// and also includes a ``//go:generate'' comment giving the exact
25-
// command line used, for regenerating the file with ``go generate.''
24+
// and also includes a //go:generate comment giving the exact
25+
// command line used, for regenerating the file with go generate.
2626
//
2727
// Bundle customizes its output for inclusion in a particular package, the destination package.
2828
// By default bundle assumes the destination is the package in the current directory,
@@ -47,7 +47,7 @@
4747
// process. The -import option, which may be repeated, specifies that
4848
// an import of "old" should be rewritten to import "new" instead.
4949
//
50-
// Example
50+
// # Example
5151
//
5252
// Bundle archive/zip for inclusion in cmd/dist:
5353
//
@@ -68,7 +68,6 @@
6868
// Update all bundles in the standard library:
6969
//
7070
// go generate -run bundle std
71-
//
7271
package main
7372

7473
import (

cmd/callgraph/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ var stdout io.Writer = os.Stdout
166166

167167
func doCallgraph(dir, gopath, algo, format string, tests bool, args []string) error {
168168
if len(args) == 0 {
169-
fmt.Fprintln(os.Stderr, Usage)
169+
fmt.Fprint(os.Stderr, Usage)
170170
return nil
171171
}
172172

@@ -187,7 +187,8 @@ func doCallgraph(dir, gopath, algo, format string, tests bool, args []string) er
187187
}
188188

189189
// Create and build SSA-form program representation.
190-
prog, pkgs := ssautil.AllPackages(initial, 0)
190+
mode := ssa.InstantiateGenerics // instantiate generics by default for soundness
191+
prog, pkgs := ssautil.AllPackages(initial, mode)
191192
prog.Build()
192193

193194
// -- call graph construction ------------------------------------------

cmd/callgraph/main_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"log"
1616
"os"
1717
"path/filepath"
18+
"runtime"
1819
"strings"
1920
"testing"
2021

@@ -34,6 +35,10 @@ func init() {
3435
}
3536

3637
func TestCallgraph(t *testing.T) {
38+
if runtime.GOOS == "windows" && runtime.GOARCH == "arm64" {
39+
t.Skipf("skipping due to suspected file corruption bug on windows/arm64 (https://go.dev/issue/50706)")
40+
}
41+
3742
testenv.NeedsTool(t, "go")
3843

3944
gopath, err := filepath.Abs("testdata")

0 commit comments

Comments
 (0)