Skip to content

Commit dc70717

Browse files
committed
all: merge master (304195c) into gopls-release-branch.0.8
Also add a replace directive for x/tools to gopls/go.mod. For golang/go#52892 Conflicts: - gopls/go.mod - gopls/go.sum Merge List: + 2022-05-13 304195c go/ssa: create *ssa.selection. + 2022-05-12 f918e87 gopls/internal/vulncheck: copy logic of govulncheck -html + 2022-05-12 a518b79 gopls/internal/vulncheck: synchronize cache access + 2022-05-12 ad497c6 internal/lsp/cmd: add -config option to gopls vulncheck + 2022-05-12 62d837c go/analysis/passes/httpresponse: minor clarification + 2022-05-11 6eb3de2 internal/lsp/analysis: fix a doc comment typo + 2022-05-11 728485f gopls/internal/regtest: add a test for using staticcheck with generics + 2022-05-11 1a5eed3 cmd/compilebench: use -p, handle packages with asm files + 2022-05-11 93852cb internal/lsp: fix source.CompareDiagnostic asymmetry + 2022-05-11 8ec40b5 x/tools/go/ssa: instantiate sel.Recv() on MethodVal. + 2022-05-11 28c754d internal/lsp/analysis: analyzer for //go:embed directive + 2022-05-11 033cbfc internal/typeparams: run go generate with go1.18.2 + 2022-05-10 bc0e26e internal/typeparams: remove examples in favor of x/exp/typeparams + 2022-05-09 b87ceec go/analysis/passes/httpresponse: inspect enclosing context of resp, err + 2022-05-09 313af96 go/ast/astutil: make Apply follow TypeParams fields + 2022-05-09 d303668 internal/lsp/cache: use cached parsed files for symbols, if available + 2022-05-09 0fb1abf internal/lsp: factor out go/token wrapper into a safetoken package + 2022-05-09 cde25b3 internal/lsp/lsppos: add helpers for mapping token positions + 2022-05-06 22b7096 internal/lsp/cmd: change vulncheck to directly call the hook + 2022-05-06 72a884b gopls: update golang.org/x/vuln dependency + 2022-05-06 d7e01c0 internal/lsp/source/completion: use typeutil.Map for short-circuiting + 2022-05-05 d299b94 passes/copylock: suppress reports on Offsetof and Alignof + 2022-05-05 30fbd19 internal/lsp: fix fillstruct for structs with unsafe.Pointer + 2022-05-05 0ebacc1 internal: remove pre-go1.12 conditionally compiled files + 2022-05-04 45c8a71 internal/tool: implement structured help command + 2022-05-04 d27d783 cmd/godoc: expand skips in TestWeb + 2022-05-04 4911e4a internal/testenv: remove darwin/arm case from NeedsGoBuild + 2022-05-04 54c7ba5 go/analysis/passes/asmdecl: add build tag for loong64 + 2022-05-04 b4c4500 README: restructure and update + 2022-05-02 556c550 internal/lsp/cache: invalidate packages that have added files + 2022-05-02 4a3fc21 internal/lsp: only linkify urls with http, https, and ftp schemes + 2022-05-02 04fc2ba cmd/godoc: skip TestWeb if waitForServerReady fails + 2022-05-02 6872d3b passes/unusedwrites: Add TODO for how to handle generics. + 2022-05-02 7c895e0 pointer: Adds unit tests for pointer with type parameters. + 2022-05-02 ddadc42 guru: Add a TODO list to the guru cmd. + 2022-05-02 c39ac6a callgraph/vta: Removes dead return statement (misc cleanup). + 2022-04-29 aafffac internal/lsp/source: avoid panic in HoverIdentifier + 2022-04-29 c862641 cmd/digraph: only print non-trivial sccs + 2022-04-29 6fff1af go/analysis/passes/errorsas: update testdata for new warning + 2022-04-28 115b454 go/analysis/passes/errorsas: warn if errors.As target is *error + 2022-04-28 60b4456 go/callgraph/static: adds tests for (instantiated) generics + 2022-04-28 a37ba14 go/callgraph/cha: adds tests for (instantiated) generics + 2022-04-26 dcaea06 go/callgraph/vta: adds tests for (instantiated) generics + 2022-04-26 b44fad8 lsp/completion: fix func literals with type params + 2022-04-26 5bb9a5e lsp/completion: fix literal completions with type params + 2022-04-26 0941294 lsp/completion: further improve generic func arg ranking + 2022-04-25 c903563 internal/lsp/cache: don't cache parsed files when checking for metadata changes + 2022-04-25 825b661 nilness: add unit test for generic instantiation. + 2022-04-25 2548a8b ssautil: Add unit tests that set ssa.InstantiateGenerics + 2022-04-25 ae12e8f ssa: switch lblocks to types.Object + 2022-04-25 559469a internal/lsp: render package documentation when hovering over a package import + 2022-04-22 fa7afc9 lsp/completion: improve generic func arg ranking + 2022-04-22 d567bc1 go/ssa: monomorphize generic instantiations. + 2022-04-20 5d7ca8a go/ssa: return nil on parameterized types on MethodValue. + 2022-04-20 48a2cc8 x/tools: remove dependency on golang.org/x/xerrors + 2022-04-20 235b13d cmd/godoc: remove usage of golang.org/x/xerrors + 2022-04-20 b22f048 internal/jsonrpc2*: remove usage of golang.org/x/xerrors + 2022-04-20 bcfc38f go/packages: remove usage of golang.org/x/xerrors + 2022-04-20 37590b3 gopls: remove usage of golang.org/x/xerrors + 2022-04-19 e854e02 go/ssa: fix miscompilation of <<= and >>= statements + 2022-04-19 c02adcc go/packages: ask for EmbedPatterns and EmbedFiles if needed + 2022-04-19 5bb9c48 x/tools/go/packages: on Go 1.19+, explicitly ask for -json fields needed + 2022-04-18 00aa68c go/ssa/interp: use *ssa.Global as key type for interpreter.globals + 2022-04-18 b4aba4b go/internal/gcimporter: key tparams by Package instead of pkgname + 2022-04-15 46bc274 go/ssa: Update callee for wrapper function instantiation. + 2022-04-14 884ffcd go/analysis: add support for loong64 + 2022-04-13 afc6aad go/packages: make loadFromExportData ignore go.shape + 2022-04-13 b7d7574 internal/lsp/protocol: avoid replying with non-nil interface values in case of error + 2022-04-12 1f10767 gopls/doc: update neovim examples for nvim 0.7 + 2022-04-12 a220087 internal/lsp/protocol: ignore reply values with non-nil errors in jsonrpc2_v2 adapters + 2022-04-12 d5f48fc all: gofmt + 2022-04-12 d996daa go/ssa: gofmt + 2022-04-12 f9c13bb go/pointer: gofmt + 2022-04-12 ad8ef15 go/callgraph: gofmt + 2022-04-12 ce1e683 go/analysis: gofmt + 2022-04-12 2bbdb7a gopls, internal/lsp: gofmt + 2022-04-12 5fef6fd cmd: gofmt + 2022-04-12 04fab9a go/callgraph/vta: avoids cycles for pathological recursive types + 2022-04-12 fbebf43 go/internal: gofmt + 2022-04-12 b900e88 go/ssa: emit Low expression before High in *ast.Slice + 2022-04-11 b2552ef internal/lsp: run go mod vendor exclusively to avoid file contention + 2022-04-11 9e788ee internal/lsp/fake: consider mtime when polling for file changes + 2022-04-08 fe932b4 go/ssa: Instantiate calls to generic functions and methods. + 2022-04-08 ce5936c go/ssa: bound functions are now unique per instantiation. + 2022-04-08 7dd9f20 go/ssa: Adds datastructures for function instantiation. + 2022-04-07 ee2bc8b go/ast/astutil: fix panic in DeleteNamedImport from line directive + 2022-04-07 48e6d8d cmd/fiximports: skip TestFixImports on plan9-arm Change-Id: Ife04cdbc94bfd70ff81c94cdfb9516950256847d
2 parents 961a87f + 304195c commit dc70717

File tree

415 files changed

+6873
-3889
lines changed

Some content is hidden

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

415 files changed

+6873
-3889
lines changed

README.md

Lines changed: 76 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +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 install`.
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 install golang.org/x/tools/...@latest`.
29+
These commands may be fetched with a command such as
30+
`go install golang.org/x/tools/cmd/goimports@latest`.
2031

21-
## JS/CSS Formatting
32+
Selected packages:
2233

23-
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.
2437

25-
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.
2640

27-
It is encouraged that all JS and CSS code be run through this before submitting
28-
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.
2962

30-
## Report Issues / Send Patches
63+
<!-- Some that didn't make the cut:
3164
32-
This repository uses Gerrit for code changes. To learn how to submit changes to
33-
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.
3483

3584
The main issue tracker for the tools repository is located at
3685
https://github.com/golang/go/issues. Prefix your issue with "x/tools/(your
3786
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/compilebench/main.go

Lines changed: 80 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,52 +60,55 @@
6060
// today they write only the profile for the last benchmark executed.
6161
//
6262
// The default memory profiling rate is one profile sample per 512 kB
63-
// allocated (see ``go doc runtime.MemProfileRate'').
63+
// allocated (see go doc runtime.MemProfileRate).
6464
// Lowering the rate (for example, -memprofilerate 64000) produces
6565
// a more fine-grained and therefore accurate profile, but it also incurs
6666
// execution cost. For benchmark comparisons, never use timings
6767
// obtained with a low -memprofilerate option.
6868
//
69-
// Example
69+
// # Example
7070
//
7171
// Assuming the base version of the compiler has been saved with
72-
// ``toolstash save,'' this sequence compares the old and new compiler:
72+
// toolstash save, this sequence compares the old and new compiler:
7373
//
7474
// compilebench -count 10 -compile $(toolstash -n compile) >old.txt
7575
// compilebench -count 10 >new.txt
7676
// benchstat old.txt new.txt
77-
//
7877
package main
7978

8079
import (
8180
"bytes"
8281
"encoding/json"
8382
"flag"
8483
"fmt"
85-
exec "golang.org/x/sys/execabs"
8684
"io/ioutil"
8785
"log"
8886
"os"
8987
"path/filepath"
9088
"regexp"
89+
"runtime"
9190
"strconv"
9291
"strings"
9392
"time"
93+
94+
exec "golang.org/x/sys/execabs"
9495
)
9596

9697
var (
97-
goroot string
98-
compiler string
99-
linker string
100-
runRE *regexp.Regexp
101-
is6g bool
98+
goroot string
99+
compiler string
100+
assembler string
101+
linker string
102+
runRE *regexp.Regexp
103+
is6g bool
102104
)
103105

104106
var (
105107
flagGoCmd = flag.String("go", "go", "path to \"go\" command")
106108
flagAlloc = flag.Bool("alloc", false, "report allocations")
107109
flagObj = flag.Bool("obj", false, "report object file stats")
108110
flagCompiler = flag.String("compile", "", "use `exe` as the cmd/compile binary")
111+
flagAssembler = flag.String("asm", "", "use `exe` as the cmd/asm binary")
109112
flagCompilerFlags = flag.String("compileflags", "", "additional `flags` to pass to compile")
110113
flagLinker = flag.String("link", "", "use `exe` as the cmd/link binary")
111114
flagLinkerFlags = flag.String("linkflags", "", "additional `flags` to pass to link")
@@ -116,6 +119,7 @@ var (
116119
flagMemprofilerate = flag.Int64("memprofilerate", -1, "set memory profile `rate`")
117120
flagPackage = flag.String("pkg", "", "if set, benchmark the package at path `pkg`")
118121
flagShort = flag.Bool("short", false, "skip long-running benchmarks")
122+
flagTrace = flag.Bool("trace", false, "debug tracing of builds")
119123
)
120124

121125
type test struct {
@@ -178,6 +182,10 @@ func main() {
178182
is6g = true
179183
}
180184
}
185+
assembler = *flagAssembler
186+
if assembler == "" {
187+
_, assembler = toolPath("asm")
188+
}
181189

182190
linker = *flagLinker
183191
if linker == "" && !is6g { // TODO: Support 6l
@@ -238,8 +246,10 @@ func toolPath(names ...string) (found, path string) {
238246
}
239247

240248
type Pkg struct {
241-
Dir string
242-
GoFiles []string
249+
ImportPath string
250+
Dir string
251+
GoFiles []string
252+
SFiles []string
243253
}
244254

245255
func goList(dir string) (*Pkg, error) {
@@ -337,8 +347,30 @@ func (c compile) run(name string, count int) error {
337347
return err
338348
}
339349

340-
args := []string{"-o", "_compilebench_.o"}
350+
// If this package has assembly files, we'll need to pass a symabis
351+
// file to the compiler; call a helper to invoke the assembler
352+
// to do that.
353+
var symAbisFile string
354+
var asmIncFile string
355+
if len(pkg.SFiles) != 0 {
356+
symAbisFile = filepath.Join(pkg.Dir, "symabis")
357+
asmIncFile = filepath.Join(pkg.Dir, "go_asm.h")
358+
content := "\n"
359+
if err := os.WriteFile(asmIncFile, []byte(content), 0666); err != nil {
360+
return fmt.Errorf("os.WriteFile(%s) failed: %v", asmIncFile, err)
361+
}
362+
defer os.Remove(symAbisFile)
363+
defer os.Remove(asmIncFile)
364+
if err := genSymAbisFile(pkg, symAbisFile, pkg.Dir); err != nil {
365+
return err
366+
}
367+
}
368+
369+
args := []string{"-o", "_compilebench_.o", "-p", pkg.ImportPath}
341370
args = append(args, strings.Fields(*flagCompilerFlags)...)
371+
if symAbisFile != "" {
372+
args = append(args, "-symabis", symAbisFile)
373+
}
342374
args = append(args, pkg.GoFiles...)
343375
if err := runBuildCmd(name, count, pkg.Dir, compiler, args); err != nil {
344376
return err
@@ -429,6 +461,10 @@ func runBuildCmd(name string, count int, dir, tool string, args []string) error
429461
preArgs = append(preArgs, "-cpuprofile", "_compilebench_.cpuprof")
430462
}
431463
}
464+
if *flagTrace {
465+
fmt.Fprintf(os.Stderr, "running: %s %+v\n",
466+
tool, append(preArgs, args...))
467+
}
432468
cmd := exec.Command(tool, append(preArgs, args...)...)
433469
cmd.Dir = dir
434470
cmd.Stdout = os.Stderr
@@ -511,3 +547,34 @@ func runBuildCmd(name string, count int, dir, tool string, args []string) error
511547

512548
return nil
513549
}
550+
551+
// genSymAbisFile runs the assembler on the target packge asm files
552+
// with "-gensymabis" to produce a symabis file that will feed into
553+
// the Go source compilation. This is fairly hacky in that if the
554+
// asm invocation convenion changes it will need to be updated
555+
// (hopefully that will not be needed too frequently).
556+
func genSymAbisFile(pkg *Pkg, symAbisFile, incdir string) error {
557+
args := []string{"-gensymabis", "-o", symAbisFile,
558+
"-p", pkg.ImportPath,
559+
"-I", filepath.Join(goroot, "pkg", "include"),
560+
"-I", incdir,
561+
"-D", "GOOS_" + runtime.GOOS,
562+
"-D", "GOARCH_" + runtime.GOARCH}
563+
if pkg.ImportPath == "reflect" {
564+
args = append(args, "-compiling-runtime")
565+
}
566+
args = append(args, pkg.SFiles...)
567+
if *flagTrace {
568+
fmt.Fprintf(os.Stderr, "running: %s %+v\n",
569+
assembler, args)
570+
}
571+
cmd := exec.Command(assembler, args...)
572+
cmd.Dir = pkg.Dir
573+
cmd.Stdout = os.Stderr
574+
cmd.Stderr = os.Stderr
575+
err := cmd.Run()
576+
if err != nil {
577+
return fmt.Errorf("assembling to produce symabis file: %v", err)
578+
}
579+
return nil
580+
}

cmd/cover/cover.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ var slashslash = []byte("//")
300300
// whitespace and line comments. Any +build directives must appear
301301
// within this region. This approach is more reliable than using
302302
// go/printer to print a modified AST containing comments.
303-
//
304303
func initialComments(content []byte) []byte {
305304
// Derived from go/build.Context.shouldBuild.
306305
end := 0
@@ -453,7 +452,7 @@ func (f *File) newCounter(start, end token.Pos, numStmt int) ast.Stmt {
453452
// S1
454453
// if cond {
455454
// S2
456-
// }
455+
// }
457456
// S3
458457
//
459458
// counters will be added before S1 and before S3. The block containing S2

0 commit comments

Comments
 (0)