Skip to content

Commit

Permalink
[release] prepare v0.32.0
Browse files Browse the repository at this point in the history
03af3d4 package.json: sync gopls settings @ v0.8.0
1274335 package.json: fix spelling for generateTestForPackage
b6187d8 package.json: add go.toolsManagement.go
6399238 codereview.cfg: declare issue repo
09c4936 src/goEnv.ts: pass uri to getGoConfig
0f849d1 src/config: add ExtensionInfo to replace isInPreview/isInCloudIDE
0bd09b6 src/goMain: install tools for suggested updates if autoUpdate is on
2434bfa src/utils: add utils/README.md and move test_events.md to goTest
acbe503 src/goImport,goOutline: check registered gopls commands
4aa4554 src/goLanguageServer: skip buildLanguageClient if it's disabled
073b8fc src/goLanguageServer: include go version in the gopls crash report
e6dc469 src/goLanguageServer: sample half of gopls opt-out users for survey
4b6318c src/goLanguageServer: clean unused `surveyOnly` param
5494d35 src/goLanguageServer.ts: don't let config change trigger opt-out survey
2222461 src/goOutline.ts: use regexp to find package decl
7bc14ec src/goStatus: add go.work to status bar quickpick
16eadfa src/goMain: suggest tool updates if tools were compiled with old go
934911a src/goLanguageServer: cache language server info
28136c8 src/goOutline: use language server to get document symbols
af9afa3 src/goMain.ts: remove warning about dlv-dap in alternateTools
bdcd7a6 src/goMain.ts: remove prompt for nightly extension users
b3048fc src/goLanguageServer: use 1.42+ workspace.getConfiguration API
9156fb4 src/goMain: use inspectGoToolVersion instead of runGoVersionM
3e9fb0e src/util: remove vendoring support check
4435e8e src/util: fix vendor support check
37ffd3c test: update switch goroutine test
e04eb10 build: log shm size & increase shm size to 8G
e50cf23 src/goPackages: make goListPkgs async and run go list with -e
5b290fa CHANGELOG.md: list changes for v0.31.1
fb8ba52 vscode-go: remove references to gopkgs
68fae93 tools: remove gopkgs from all tools information
037e8a3 src/goTest: avoid a name conflicting with the proposed quickpick api
3ad379c src/goEnvironmentStatus: use installTool for golang.org/dl/* install
9d0ec81 .github/workflows: replace go1.18-beta1 with go1.18-beta2
c01699e docs/features.md: discuss default formatting behavior and template support
c5ebe02 docs/advanced.md: use go1.18beta2 in the instruction
d5403b9 src/goToolsInformation: require go1.13+ for gopls
0a9d740 .github/workflows: partially revert go.dev/cl/380175
59d4c16 test/integration: skip 'disconnect with multiple disconnectRequests' test
92797b2 package.json: bump dev version to 0.32.0
6264294 docs/advanced.md: fix broken link and add more links
debf84a docs/advanced.md: add go1.18 instruction
2735f15 src/goTest: remove '#' in subtest name parsing cutset
c42b3cd src/goTest: detect Fuzz tests and list them in test explorer UI
6a37048 workflows: replace repository dispatch with workflow dispatch
b5b4835 CHANGELOG.md: Update changelog for release continued
6135b6e src/goPackages.ts: replace use of gopkgs with go list
1b607ad tests/testdata: fix package name in importTest
6fb2a2a package.json: update [email protected]
e4e5dfa test: remove flaky step out test
59db2c8 tools/license.sh: only include production dependencies in LICENSE

Change-Id: Ia9e1dab191444b17f968ba64c9e95556ac5483ee
  • Loading branch information
hyangah committed Mar 2, 2022
2 parents 44e78e9 + 03af3d4 commit a3d3b81
Show file tree
Hide file tree
Showing 47 changed files with 952 additions and 735 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
name: Release (golang.go-nightly)

# Daily release on 15:00 UTC, monday-thursday.
# Or, force to release by triggering repository_dispatch events by using
# curl -v -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/golang/vscode-go/dispatches -d '{ "event_type": "force-release" }'
# Or, trigger with workflow dispatch event.
on:
schedule:
- cron: "0 15 * * MON-THU" # 15 UTC, monday-thursday daily
repository_dispatch:
types: [force-release]
workflow_dispatch:

jobs:
release:
if: github.ref == 'refs/heads/master' && github.repository == 'golang/vscode-go'

name: Release Nightly
runs-on: ubuntu-latest
environment: nightly
timeout-minutes: 20

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-long-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
version: ['stable', 'insiders']
go: ['1.15', '1.16', '1.17', '1.18.0-beta1']
go: ['1.15', '1.16', '1.17', '1.18.0-beta2']

steps:
- name: Clone repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-long.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest] # TODO: reenable macos-latest
version: ['stable']
go: ['1.15', '1.16', '1.17', '1.18.0-beta1']
go: ['1.15', '1.16', '1.17', '1.18.0-beta2']

steps:
- name: Clone repository
Expand Down
3 changes: 2 additions & 1 deletion build/all.bash
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ go_binaries_info() {

run_test() {
echo "**** Run test ****"
df -h | grep shm
npm ci
npm run compile
npm run unit-test
Expand All @@ -61,7 +62,7 @@ run_test_in_docker() {
docker build -t vscode-test-env ${GOVERSION:+ --build-arg GOVERSION="${GOVERSION}"} -f ./build/Dockerfile .

# For debug tests, we need ptrace.
docker run --cap-add SYS_PTRACE --workdir=/workspace -v "$(pwd):/workspace" vscode-test-env ci
docker run --cap-add SYS_PTRACE --shm-size=8G --workdir=/workspace -v "$(pwd):/workspace" vscode-test-env ci
}

prepare_nightly() {
Expand Down
1 change: 1 addition & 0 deletions codereview.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
issuerepo: golang/vscode-go
56 changes: 56 additions & 0 deletions docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,62 @@
This document describes more advanced ways of working with the VS Code Go
extension.

## Using Go1.18

The latest Go extension (`v0.31.0+` or [Nightly](./nightly.md))
contains experimental support for the [new Go 1.18 features](https://tip.golang.org/doc/go1.18).

* [Generics](https://go.dev/doc/tutorial/generics): IntelliSense, Code Editing, Diagnostics, Sytax Highlighting, etc.
* [Fuzzing](https://go.dev/doc/tutorial/fuzz): Run/Debug Test using CodeLens and Test UI (available in Nightly).
* [Go workspace mode](https://pkg.go.dev/cmd/[email protected]#hdr-Workspace_maintenance): _WIP_

The latest Go extension (v0.31.0+, or [Nightly](./nightly.md)) supports the new Go 1.18 features with
the following configuration.

1. Get the preview of Go 1.18 by visiting [the official Go downloads page](https://go.dev/dl/#go1.18beta2).
The following command will install `go1.18beta2` binary in your `$GOPATH/bin`
or `GOBIN` directory, and download the Go 1.18 SDK.
```sh
go install golang.org/dl/go1.18beta2@latest
go1.18beta2 download
```

The location of the downloaded Go 1.18 SDK directory can be found with
```sh
go1.18beta2 env GOROOT
```

2. Configure the extension to use `go1.18beta2`
(or the `go` binary in the Go 1.18 SDK `bin` directory), using [one of
the options listed below](https://github.com/golang/vscode-go/blob/master/docs/advanced.md#choosing-a-different-version-of-go).

3. In order to process the new language features, [tools](./tools.md) this extension
needs rebuilding with Go 1.18. **Please run the [`Go: Install/Update Tools`](commands.md#go-installupdate-tools)
command to update tools**.

4. (optional) for correct syntax highlighting, we recommend to enable
[semantic highlighting](https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide)
by turning on [Gopls' `ui.semanticTokens` setting](https://github.com/golang/vscode-go/blob/master/docs/settings.md#uisemantictokens).
```
"gopls": { "ui.semanticTokens": true }
```

### Known Issues

The Go Tools team are actively working on fixing bugs and improving usability
of the new Go 1.18 features. Please take a look at current known
[`vscode-go` issues](https://github.com/golang/vscode-go/issues?q=is%3Aissue+label%3Ago1.18+)
and [`gopls` issues](https://github.com/golang/go/milestone/244).

* Features that depend on 3rd party tools (`staticcheck`, `golangci-lint`, ...) may not work yet.
Please follow the [tracking issue](https://github.com/golang/go/issues/50558).
* Support for `go.work` is a work in progress.

In order to pick up the latest fixes, please consider to use the [Nightly](./nightly.md) version of
the extension. We plan to make prereleases of `gopls` v0.8.0 available frequently.
The Nightly version installs the pre-release version of `gopls`, so you will be able to pick up the
latest bug fixes of `gopls` without manual installation.

## Choosing a different version of Go

The extension chooses the `go` command using the `PATH` (or `Path`) environment
Expand Down
21 changes: 19 additions & 2 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This document describes the features supported by this extension.
* [Find interface implementations](#find-interface-implementations)
* [Document outline](#document-outline)
* [Toggle between code and tests](#toggle-between-code-and-tests)
* [Syntax Highlighting](#syntax-highlighting)
* [Code Editing](#code-editing)
* [Snippets](#snippets)
* [Format and organize imports](#format-and-organize-imports)
Expand Down Expand Up @@ -103,6 +104,19 @@ Quickly toggle between a file and its corresponding test file by using the [`Go:

<div style="text-align: center;"><img src="images/toggletestfile.gif" alt="Toggle between reverse.go and reverse_test.go" style="width: 75%"> </div>


## Syntax Highlighting

The default syntax highlighting for Go files is implemented in Visual Studio Code using TextMate grammar, not by this extension.

If you are using `gopls`, you can enable [Semantic Highlighting](https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide) for more accurate syntax highlighting based on semantic tokenization using `"gopls": { "ui.semanticTokens": true }`.

### Go template syntax highlighting

When `gopls`'s semantic tokens feature is enabled, `gopls` also provides semantic tokens for Go template files (language identifier: `gotmpl`). By default, the extension associates all `*.tmpl` or `*.gotmpl` files in the workspace with `gotmpl` language. Users can override the language mode by using Visual Studio Code's UI or the `"files.associations"` setting. See [Visual Studio Code's doc](https://code.visualstudio.com/docs/languages/overview#_changing-the-language-for-the-selected-file) for more details.

<div style="text-align: center;"><img src="images/gotmpl.gif" alt="Enable Go template language support by changing the language ID" style="width: 75%"> </div>

## Code Editing

### [Snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets)
Expand All @@ -115,13 +129,16 @@ Predefined snippets for quick coding. These snippets will appear as completion s

Format code and organize imports, either manually or on save.

The extension formats Go code, organizes imports, and removes unused imports by default. For different behavior, please override per-language default settings following [the instruction](https://github.com/golang/vscode-go/blob/master/docs/advanced.md#formatting-code-and-organizing-imports).

When organizing imports, the imported packages are grouped in the default `goimports` style. In order to group some packages after 3rd-party packages, use [`"gopls": { "formatting.local": <comma-separated imports prefix>}`](https://github.com/golang/vscode-go/blob/master/docs/settings.md#formattinglocal).

#### Add import

Manually add a new import to your file through the [`Go: Add Import`](commands.md#go-add-import) command. Available packages are offered from your `GOPATH` and module cache.
The extension organizes imports automatically and can add missing imports if the package is present in your module cache already. However, you can also manually add a new import to your file through the [`Go: Add Import`](commands.md#go-add-import) command. Available packages are offered from module cache (or from your `GOPATH` in GOPATH mode).

<div style="text-align: center;"><img src="images/addimport.gif" alt="Add byte import to Go file" style="width: 75%"> </div>


### [Rename symbol](https://code.visualstudio.com/docs/editor/refactoring#_rename-symbol)

Rename all occurrences of a symbol in your workspace.
Expand Down
Binary file added docs/images/gotmpl.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 10 additions & 5 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Alternate tools or alternate paths for the same tools used by the Go extension.
| `dlv` | Alternate tool to use instead of the dlv binary or alternate path to use for the dlv binary. <br/> Default: `"dlv"` |
| `go` | Alternate tool to use instead of the go binary or alternate path to use for the go binary. <br/> Default: `"go"` |
| `go-outline` | Alternate tool to use instead of the go-outline binary or alternate path to use for the go-outline binary. <br/> Default: `"go-outline"` |
| `gopkgs` | Alternate tool to use instead of the gopkgs binary or alternate path to use for the gopkgs binary. <br/> Default: `"gopkgs"` |
| `gopls` | Alternate tool to use instead of the gopls binary or alternate path to use for the gopls binary. <br/> Default: `"gopls"` |
### `go.autocompleteUnimportedPackages`

Expand Down Expand Up @@ -175,7 +174,7 @@ Experimental Feature: Enable/Disable entries from the context menu in the editor
| `fillStruct` | If true, adds command to fill struct literal with default values to the editor context menu <br/> Default: `true` |
| `generateTestForFile` | If true, adds command to generate unit tests for current file to the editor context menu <br/> Default: `true` |
| `generateTestForFunction` | If true, adds command to generate unit tests for function under the cursor to the editor context menu <br/> Default: `true` |
| `generateTestForPackage` | If true, adds command to generate unit tests for currnt package to the editor context menu <br/> Default: `true` |
| `generateTestForPackage` | If true, adds command to generate unit tests for current package to the editor context menu <br/> Default: `true` |
| `playground` | If true, adds command to upload the current file or selection to the Go Playground <br/> Default: `true` |
| `removeTags` | If true, adds command to remove configured tags from struct fields to the editor context menu <br/> Default: `true` |
| `testAtCursor` | If true, adds command to run the test under the cursor to the editor context menu <br/> Default: `false` |
Expand Down Expand Up @@ -455,6 +454,11 @@ Allowed Options:


Default: `"proxy"`
### `go.toolsManagement.go`

The path to the `go` binary used to install the Go tools. If it's empty, the same `go` binary chosen for the project will be used for tool installation.

Default: `""`
### `go.trace.server`

Trace the communication between VS Code and the Go language server.<br/>
Expand Down Expand Up @@ -731,7 +735,7 @@ Example Usage:
| `nilfunc` | check for useless comparisons between functions and nil <br/> A useless comparison is one like f == nil as opposed to f() == nil. <br/> Default: `true` |
| `nilness` | check for redundant or impossible nil comparisons <br/> The nilness checker inspects the control-flow graph of each function in a package and reports nil pointer dereferences, degenerate nil pointers, and panics with nil values. A degenerate comparison is of the form x==nil or x!=nil where x is statically known to be nil or non-nil. These are often a mistake, especially in control flow related to errors. Panics with nil values are checked because they are not detectable by <br/> <pre>if r := recover(); r != nil {</pre><br/> This check reports conditions such as: <br/> <pre>if f == nil { // impossible condition (f is a function)<br/>}</pre><br/> and: <br/> <pre>p := &v<br/>...<br/>if p != nil { // tautological condition<br/>}</pre><br/> and: <br/> <pre>if p == nil {<br/> print(*p) // nil dereference<br/>}</pre><br/> and: <br/> <pre>if p == nil {<br/> panic(p)<br/>}</pre><br/> <br/> Default: `false` |
| `nonewvars` | suggested fixes for "no new vars on left side of :=" <br/> This checker provides suggested fixes for type errors of the type "no new vars on left side of :=". For example: <pre>z := 1<br/>z := 2</pre>will turn into <pre>z := 1<br/>z = 2</pre><br/> <br/> Default: `true` |
| `noresultvalues` | suggested fixes for "no result values expected" <br/> This checker provides suggested fixes for type errors of the type "no result values expected". For example: <pre>func z() { return nil }</pre>will turn into <pre>func z() { return }</pre><br/> <br/> Default: `true` |
| `noresultvalues` | suggested fixes for unexpected return values <br/> This checker provides suggested fixes for type errors of the type "no result values expected" or "too many return values". For example: <pre>func z() { return nil }</pre>will turn into <pre>func z() { return }</pre><br/> <br/> Default: `true` |
| `printf` | check consistency of Printf format strings and arguments <br/> The check applies to known functions (for example, those in package fmt) as well as any detected wrappers of known functions. <br/> A function that wants to avail itself of printf checking but is not found by this analyzer's heuristics (for example, due to use of dynamic calls) can insert a bogus call: <br/> <pre>if false {<br/> _ = fmt.Sprintf(format, args...) // enable printf checking<br/>}</pre><br/> The -funcs flag specifies a comma-separated list of names of additional known formatting functions or methods. If the name contains a period, it must denote a specific function using one of the following forms: <br/> <pre>dir/pkg.Function<br/>dir/pkg.Type.Method<br/>(*dir/pkg.Type).Method</pre><br/> Otherwise the name is interpreted as a case-insensitive unqualified identifier such as "errorf". Either way, if a listed name ends in f, the function is assumed to be Printf-like, taking a format string before the argument list. Otherwise it is assumed to be Print-like, taking a list of arguments with no format string. <br/> <br/> Default: `true` |
| `shadow` | check for possible unintended shadowing of variables <br/> This analyzer check for shadowed variables. A shadowed variable is a variable declared in an inner scope with the same name and type as a variable in an outer scope, and where the outer variable is mentioned after the inner one is declared. <br/> (This definition can be refined; the module generates too many false positives and is not yet enabled by default.) <br/> For example: <br/> <pre>func BadRead(f *os.File, buf []byte) error {<br/> var err error<br/> for {<br/> n, err := f.Read(buf) // shadows the function variable 'err'<br/> if err != nil {<br/> break // causes return of wrong value<br/> }<br/> foo(buf)<br/> }<br/> return err<br/>}</pre><br/> <br/> Default: `false` |
| `shift` | check for shifts that equal or exceed the width of the integer <br/> Default: `true` |
Expand All @@ -742,6 +746,7 @@ Example Usage:
| `stdmethods` | check signature of methods of well-known interfaces <br/> Sometimes a type may be intended to satisfy an interface but may fail to do so because of a mistake in its method signature. For example, the result of this WriteTo method should be (int64, error), not error, to satisfy io.WriterTo: <br/> <pre>type myWriterTo struct{...}</pre> func (myWriterTo) WriteTo(w io.Writer) error { ... } <br/> This check ensures that each method whose name matches one of several well-known interface methods from the standard library has the correct signature for that interface. <br/> Checked method names include: <pre>Format GobEncode GobDecode MarshalJSON MarshalXML<br/>Peek ReadByte ReadFrom ReadRune Scan Seek<br/>UnmarshalJSON UnreadByte UnreadRune WriteByte<br/>WriteTo</pre><br/> <br/> Default: `true` |
| `stringintconv` | check for string(int) conversions <br/> This checker flags conversions of the form string(x) where x is an integer (but not byte or rune) type. Such conversions are discouraged because they return the UTF-8 representation of the Unicode code point x, and not a decimal string representation of x as one might expect. Furthermore, if x denotes an invalid code point, the conversion cannot be statically rejected. <br/> For conversions that intend on using the code point, consider replacing them with string(rune(x)). Otherwise, strconv.Itoa and its equivalents return the string representation of the value in the desired base. <br/> <br/> Default: `true` |
| `structtag` | check that struct field tags conform to reflect.StructTag.Get <br/> Also report certain struct tags (json, xml) used with unexported fields. <br/> Default: `true` |
| `stubmethods` | stub methods analyzer <br/> This analyzer generates method stubs for concrete types in order to implement a target interface <br/> Default: `true` |
| `testinggoroutine` | report calls to (*testing.T).Fatal from goroutines started by a test. <br/> Functions that abruptly terminate a test, such as the Fatal, Fatalf, FailNow, and Skip{,f,Now} methods of *testing.T, must be called from the test goroutine itself. This checker detects calls to these functions that occur within a goroutine started by the test. For example: <br/> func TestFoo(t *testing.T) { go func() { t.Fatal("oops") // error: (*T).Fatal called from non-test goroutine }() } <br/> <br/> Default: `true` |
| `tests` | check for common mistaken usages of tests and examples <br/> The tests checker walks Test, Benchmark and Example functions checking malformed names, wrong signatures and examples documenting non-existent identifiers. <br/> Please see the documentation for package testing in golang.org/pkg/testing for the conventions that are enforced for Tests, Benchmarks, and Examples. <br/> Default: `true` |
| `undeclaredname` | suggested fixes for "undeclared name: <>" <br/> This checker provides suggested fixes for type errors of the type "undeclared name: <>". It will either insert a new statement, such as: <br/> "<> := " <br/> or a new function declaration, such as: <br/> func <>(inferred parameters) { <pre>panic("implement me!")</pre>} <br/> <br/> Default: `true` |
Expand All @@ -751,7 +756,7 @@ Example Usage:
| `unusedparams` | check for unused parameters of functions <br/> The unusedparams analyzer checks functions to see if there are any parameters that are not being used. <br/> To reduce false positives it ignores: - methods - parameters that do not have a name or are underscored - functions in test files - functions with empty bodies or those with just a return stmt <br/> Default: `false` |
| `unusedresult` | check for unused results of calls to some functions <br/> Some functions like fmt.Errorf return a result and have no side effects, so it is always a mistake to discard the result. This analyzer reports calls to certain functions in which the result of the call is ignored. <br/> The set of functions may be controlled using flags. <br/> Default: `true` |
| `unusedwrite` | checks for unused writes <br/> The analyzer reports instances of writes to struct fields and arrays that are never read. Specifically, when a struct object or an array is copied, its elements are copied implicitly by the compiler, and any element write to this copy does nothing with the original object. <br/> For example: <br/> <pre>type T struct { x int }<br/>func f(input []T) {<br/> for i, v := range input { // v is a copy<br/> v.x = i // unused write to field x<br/> }<br/>}</pre><br/> Another example is about non-pointer receiver: <br/> <pre>type T struct { x int }<br/>func (t T) f() { // t is a copy<br/> t.x = i // unused write to field x<br/>}</pre><br/> <br/> Default: `false` |
| `useany` | check for constraints that could be simplified to "any" <br/> Default: `true` |
| `useany` | check for constraints that could be simplified to "any" <br/> Default: `false` |
### `ui.diagnostic.annotations`

(Experimental) annotations specifies the various kinds of optimization diagnostics
Expand Down Expand Up @@ -841,7 +846,7 @@ Default: `"Both"`
<br/>
Allowed Options: `CaseInsensitive`, `CaseSensitive`, `FastFuzzy`, `Fuzzy`

Default: `"Fuzzy"`
Default: `"FastFuzzy"`
### `ui.navigation.symbolStyle`

(Advanced) symbolStyle controls how symbols are qualified in symbol responses.
Expand Down
Loading

0 comments on commit a3d3b81

Please sign in to comment.