Skip to content

Commit

Permalink
[gopls-release-branch.0.6] all: merge master into gopls-release-branc…
Browse files Browse the repository at this point in the history
…h.0.6

fe37c9e all: replace all usages of os/exec with golang.org/x/sys/execabs
a46736d internal/lsp/source: handle possible nil pointer in rename check
e0d2015 gopls/doc: rewrite troubleshooting.md
d78b04b gopls/doc: clean up and slightly reorganize documentation
1bdb73f gopls/doc: move contents of golang/go#36899 to documentation
f964368 gopls/internal/regtest: fix synchronization for TestUseGoplsMod
8b4aab6 gopls/doc/vscode.md: update vscode setting example

Change-Id: Iec71457cdff70ef15b77cf4193a0006f5ca47c01
  • Loading branch information
stamblerre committed Jan 19, 2021
2 parents 43a3173 + fe37c9e commit 0a1a968
Show file tree
Hide file tree
Showing 64 changed files with 430 additions and 336 deletions.
2 changes: 1 addition & 1 deletion cmd/auth/authtest/authtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import (
"bytes"
"flag"
"fmt"
exec "golang.org/x/sys/execabs"
"io"
"log"
"net/http"
"net/textproto"
"net/url"
"os"
"os/exec"
"path/filepath"
"strings"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/auth/gitauth/gitauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ package main
import (
"bytes"
"fmt"
exec "golang.org/x/sys/execabs"
"log"
"net/http"
"net/url"
"os"
"os/exec"
"path/filepath"
"strings"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/compilebench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ import (
"encoding/json"
"flag"
"fmt"
exec "golang.org/x/sys/execabs"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
Expand Down
2 changes: 1 addition & 1 deletion cmd/cover/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"bufio"
"bytes"
"fmt"
exec "golang.org/x/sys/execabs"
"html/template"
"io"
"io/ioutil"
"math"
"os"
"os/exec"
"path/filepath"
"runtime"

Expand Down
2 changes: 1 addition & 1 deletion cmd/eg/eg.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"go/format"
"go/parser"
"go/token"
exec "golang.org/x/sys/execabs"
"os"
"os/exec"
"strings"

"golang.org/x/tools/go/buildutil"
Expand Down
2 changes: 1 addition & 1 deletion cmd/fiximports/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ import (
"go/format"
"go/parser"
"go/token"
exec "golang.org/x/sys/execabs"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
"path"
"path/filepath"
"sort"
Expand Down
2 changes: 1 addition & 1 deletion cmd/getgo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"errors"
"flag"
"fmt"
exec "golang.org/x/sys/execabs"
"os"
"os/exec"
"strings"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/getgo/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package main
import (
"bytes"
"context"
"os/exec"
exec "golang.org/x/sys/execabs"
"runtime"
"strings"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/go-contrib-init/contrib.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"flag"
"fmt"
"go/build"
exec "golang.org/x/sys/execabs"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
Expand Down
2 changes: 1 addition & 1 deletion cmd/godoc/goroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
package main

import (
exec "golang.org/x/sys/execabs"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
Expand Down
2 changes: 1 addition & 1 deletion cmd/godoc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ import (
"flag"
"fmt"
"go/build"
exec "golang.org/x/sys/execabs"
"io"
"log"
"net/http"
_ "net/http/pprof" // to serve /debug/pprof/*
"net/url"
"os"
"os/exec"
"path"
"path/filepath"
"regexp"
Expand Down
2 changes: 1 addition & 1 deletion cmd/goimports/goimports.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"flag"
"fmt"
"go/scanner"
exec "golang.org/x/sys/execabs"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"runtime"
"runtime/pprof"
Expand Down
2 changes: 1 addition & 1 deletion cmd/stress/stress.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package main
import (
"flag"
"fmt"
exec "golang.org/x/sys/execabs"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
Expand Down
2 changes: 1 addition & 1 deletion cmd/toolstash/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ import (
"bufio"
"flag"
"fmt"
exec "golang.org/x/sys/execabs"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ require (
golang.org/x/mod v0.3.0
golang.org/x/net v0.0.0-20201021035429-f5854403a974
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
2 changes: 1 addition & 1 deletion go/internal/cgo/cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ import (
"go/build"
"go/parser"
"go/token"
exec "golang.org/x/sys/execabs"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
Expand Down
2 changes: 1 addition & 1 deletion go/internal/cgo/cgo_pkgconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"errors"
"fmt"
"go/build"
"os/exec"
exec "golang.org/x/sys/execabs"
"strings"
)

Expand Down
2 changes: 1 addition & 1 deletion go/internal/gccgoimporter/gccgoinstallation.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ package gccgoimporter
import (
"bufio"
"go/types"
exec "golang.org/x/sys/execabs"
"os"
"os/exec"
"path/filepath"
"strings"
)
Expand Down
2 changes: 1 addition & 1 deletion go/packages/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"bytes"
"encoding/json"
"fmt"
exec "golang.org/x/sys/execabs"
"os"
"os/exec"
"strings"
)

Expand Down
2 changes: 1 addition & 1 deletion go/packages/golist.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"encoding/json"
"fmt"
"go/types"
exec "golang.org/x/sys/execabs"
"io/ioutil"
"log"
"os"
"os/exec"
"path"
"path/filepath"
"reflect"
Expand Down
2 changes: 1 addition & 1 deletion go/pointer/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"bytes"
"fmt"
"go/types"
exec "golang.org/x/sys/execabs"
"log"
"os"
"os/exec"
"runtime"
"time"

Expand Down
2 changes: 1 addition & 1 deletion go/vcs/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"encoding/json"
"errors"
"fmt"
exec "golang.org/x/sys/execabs"
"log"
"net/url"
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
Expand Down
6 changes: 3 additions & 3 deletions gopls/doc/acme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Acme

Use the experimental [`acme-lsp`], simply follow the [install steps]
Use the experimental [`acme-lsp`] plugin.
Get started by following the[installation guide].

[`acme-lsp`]: https://github.com/fhs/acme-lsp
[install steps]: https://github.com/fhs/acme-lsp#gopls

[installation guide]: https://github.com/fhs/acme-lsp#gopls
2 changes: 1 addition & 1 deletion gopls/doc/atom.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Atom

Install the [`ide-gopls`] package.
Use the [`ide-gopls`] package.
You will also need to install the [`atom-ide-ui`] package.

[`ide-gopls`]: https://github.com/MordFustang21/ide-gopls
Expand Down
18 changes: 10 additions & 8 deletions gopls/doc/command-line.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Command line

## Flags
**Note: The `gopls` command-line is still experimental and subject to change at any point.**

## Commands
`gopls` exposes some (but not all) features on the command-line. This can be useful for debugging `gopls` itself.

### Serve
<!--TODO(rstambler): Generate this file.-->

### Check
Learn about available commands and flags by running `gopls help`.

### Format
Much of the functionality of `gopls` is available through a command line interface.

<!--- TODO: command line
detailed command line instructions, use cases and flags
--->
There are two main reasons for this. The first is that we do not want users to rely on separate command line tools when they wish to do some task outside of an editor. The second is that the CLI assists in debugging. It is easier to reproduce behavior via single command.

It is not a goal of `gopls` to be a high performance command line tool. Its command line is intended for single file/package user interaction speeds, not bulk processing.

For more information, see the `gopls` [command line page](command-line.md).
48 changes: 36 additions & 12 deletions gopls/doc/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,35 @@ it is likely that we might already be working on a fix for your issue.

## Finding issues

All `gopls` issues are labeled as such (see the [`gopls` label][issue-gopls]). Issues that are suitable for contributors are additionally tagged with the [`help-wanted` label][issue-wanted].
All `gopls` issues are labeled as such (see the [`gopls` label][issue-gopls]).
Issues that are suitable for contributors are additionally tagged with the
[`help-wanted` label][issue-wanted].

Before you begin working on an issue, please leave a comment that you are claiming it.
Before you begin working on an issue, please leave a comment that you are
claiming it.

## Getting started

<!--- TODO: getting started
Provide information to get contributors up and running here
--->
Most of the `gopls` logic is actually in the `golang.org/x/tools/internal/lsp`
directory, so you are most likely to develop in the golang.org/x/tools module.

## Build

To build a version of `gopls` with your changes applied:

```bash
cd /path/to/tools/gopls
go install
```

To confirm that you are testing with the correct `gopls` version, check that
your `gopls` version looks like this:

```bash
$ gopls version
golang.org/x/tools/gopls master
golang.org/x/tools/gopls@(devel)
```

## Getting help

Expand All @@ -30,21 +50,24 @@ about contributing in general.

To run tests for just `gopls/`, run,

```
```bash
cd /path/to/tools/gopls
go test ./...
```

But, much of the gopls work involves `internal/lsp` too, so you might want to
But, much of the gopls work involves `internal/lsp` too, so you will want to
run both:

```
```bash
cd /path/to/tools
cd gopls && go test ./...
cd ..
go test ./internal/lsp/...
```

There is additional information about the `internal/lsp` tests in the
[internal/lsp/tests `README`](https://github.com/golang/tools/blob/master/internal/lsp/tests/README.md).

### Regtests

gopls has a suite of regression tests defined in the `./gopls/internal/regtest`
Expand Down Expand Up @@ -78,10 +101,11 @@ by the TryBots.

## Debugging

<!--- TODO: debugging
actual debugging steps
viewing telemetry
--->
The easiest way to debug your change is to run can run a single `gopls` test
with a debugger.

<!--TODO(rstambler): Add more details about the debug server and viewing
telemetry.-->

[issue-gopls]: https://github.com/golang/go/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Agopls "gopls issues"
[issue-wanted]: https://github.com/golang/go/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Agopls+label%3A"help+wanted" "help wanted"
Loading

0 comments on commit 0a1a968

Please sign in to comment.