Skip to content

Commit 1a04575

Browse files
committed
[release] prepare v0.37.0 release
7df32c8 CHANGELOG.md: addresses comments from cl/457476 f820eae CHANGELOG.md: change log for v0.37.0 107463e package-lock.json: npm audit fix 2f29f89 src/welcome: vulncheck analyzer announcement for v0.37.0 d28aeac src/goTest: add codelens for sub tests 357391a docs/features: add vulncheck feature description a64573f src/goVulncheck: add the feedback link, polish govulncheck output 6c62e5d src/goVulncheck: add go.vulncheck.toggle command 087370a goplsSurvey: remove lumpiness in survey days c141ad8 package.json: add 'go.diagnostic.vulncheck' 7848fb3 src/goVulncheck: add vulncheck output links provider b2decd2 src/goVulncheck2: rename goVulncheck2.ts to goVulncheck.ts c40f073 src/goVulncheck: remove the experimental "Go: Run Vulncheck" command 8ffb271 syntaxes: color govulncheck output in the output channel 3bcbaaf src/goVulncheck2: output govulncheck progress and result aff24c5 test/unit/goDebug: delete the goDebug test 3596635 package.json: sync gopls settings ([email protected]) 34c0efb src/goDebugFactory: re-enable version check 800c233 src/goVulncheck: update gopls govulncheck command name f76aad6 src/context: add govulncheckOutputChannel 3a4f19d src/debugAdapter: fix typo in panic message 5be7716 .github/workflows: update node version to 18 e51a4d7 src/goEnvironment: make the window reload request visible 1da1ea2 package-lock.json: bump loader-utils from 1.4.0 to 1.4.1 28f7c07 src/goInstallTools: handle unknown tools 8f81613 docs/settings: make the custom formatter support more visible 752577e test/gopls: narrow the scope of fake formatTool setting b713787 docs/features: mention inlay hints and update diagnostics part b54d132 .github/workflows/wiki: use cp instead of diff to handle binaries f67d75f src/goCover: ignore bogus-looking line/column data 91fe72d package.json: start of v0.37.0 dev 12dabf3 tools/license.sh: add CC-BY-4.0 license Change-Id: I89299b79b7939a759f875073baeedad6c6b8e346
2 parents 504beea + 7df32c8 commit 1a04575

Some content is hidden

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

48 files changed

+1525
-1394
lines changed

.github/workflows/release-nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Setup Node
2424
uses: actions/setup-node@v3
2525
with:
26-
node-version: '16'
26+
node-version: '18'
2727
cache: 'npm'
2828

2929
- name: Setup Go

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: Setup Node
4444
uses: actions/setup-node@v3
4545
with:
46-
node-version: '16'
46+
node-version: '18'
4747
cache: 'npm'
4848

4949
- name: get release version

.github/workflows/test-long-all.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Setup Node
2727
uses: actions/setup-node@v3
2828
with:
29-
node-version: '16'
29+
node-version: '18'
3030
cache: 'npm'
3131

3232
- name: Setup Go

.github/workflows/test-long.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Setup Node
2626
uses: actions/setup-node@v3
2727
with:
28-
node-version: '16'
28+
node-version: '18'
2929
cache: 'npm'
3030

3131
- name: Setup Go

.github/workflows/test-smoke.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup Node
2525
uses: actions/setup-node@v3
2626
with:
27-
node-version: '16'
27+
node-version: '18'
2828
cache: 'npm'
2929

3030
- name: Setup Go

.github/workflows/wiki.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
go run ./tools/docs2wiki -w ./docs
4747
cd ..
4848
cd wiki
49-
diff -ruN --exclude=.git . ../vscode-go/docs > ../mypatch || patch -p3 -E -f < ../mypatch
49+
rm -r ./* && cp -r ../vscode-go/docs/* .
5050
git config --local user.email "[email protected]"
5151
git config --local user.name "GitHub Action"
5252
git add .

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
1-
## v0.36.0 - 4 Nov, 2022
1+
## v0.37.0 - 19 Dec, 2022
2+
3+
This release includes new [static analysis features](https://github.com/golang/vscode-go/wiki/features#analyze-vulnerabilities-in-dependencies) that report known vulnerabilities in your dependencies. These vulncheck analysis tools are backed by [Go's vulnerability database](https://go.dev/security/vulndb) and the Go language server's integration of [`govulncheck`](https://golang.org/x/vuln/cmd/govulncheck").
4+
Read [Go's support for vulnerability management](https://go.dev/blog/vuln) to learn about the Go team's approach to helping Go developers secure their open-source dependencies.
5+
6+
### Changes
7+
- The new "Go: Toggle Vulncheck" command enables/disables imports-based vulnerability analysis. This requires gopls v0.11.0 or newer.
8+
- Test and debug test code lenses are added to some subtests if the test names can be determined. ([Issue 2536](https://github.com/golang/vscode-go/issues/2536))
9+
- Gopls settings was updated to match [email protected].
10+
- `"go.formatTool"` setting accepts a special value `"custom"`, which causes the extension to use the custom formatter configured with the setting `"go.alternateTools": { "customFormatter": <your custom tool name> }`. ([Issue 2503](https://github.com/golang/vscode-go/issues/2503))
11+
- The experimental "Go: Run Vulncheck (exp)" command was removed.
12+
- The extension no longer bypasses Delve's Go version check by default. Users must install the delve version compatible with their Go version, or explicitly configure their launch configuration to pass the `--check-go-version=false` flag using the `dlvFlags` attribute. ([Go Delve Issue 3058](https://github.com/go-delve/delve/issues/3058))
13+
14+
### Fixes
15+
- The editor survey prompt logic was adjusted for uniform sampling. ([Issue 2545](https://github.com/golang/vscode-go/issues/2545))
16+
- Fixed the crash bug when handling coverage profiles involving go `//line`-directive. ([Issue 2453](https://github.com/golang/vscode-go/issues/2453))
17+
- Updated dependencies to address [CVE-2022-37603](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-37603) and [CVE-2022-24999](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24999).
18+
19+
### Thanks
20+
21+
Thank you for your contribution, @devuo, @pjweinbgo, @aarzilli, @tklauser, @hyangah, @suzmue, @jamalc!
22+
23+
## v0.36.0 - 7 Nov, 2022
224
A list of all issues and changes can be found in the [v0.36.0 milestone](https://github.com/golang/vscode-go/milestone/52) and [commit history](https://github.com/golang/vscode-go/compare/v0.35.2...v0.36.0).
325

426
### Changes

docs/commands.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ Runs a unit test at the cursor if one is found, otherwise re-runs the last execu
4747

4848
Runs a sub test at the cursor.
4949

50+
### `Go: Debug Subtest At Cursor`
51+
52+
Debug a sub test at the cursor.
53+
5054
### `Go: Benchmark Function At Cursor`
5155

5256
Runs a benchmark at the cursor.
@@ -151,6 +155,10 @@ install/update the required go packages
151155

152156
Toggles between file in current active editor and the corresponding test file.
153157

158+
### `Go: Toggle Vulncheck`
159+
160+
Toggle the display of vulnerability analysis in dependencies.
161+
154162
### `Go: Add Tags To Struct Fields`
155163

156164
Add tags configured in go.addTags setting to selected struct using gomodifytags
@@ -266,7 +274,3 @@ Edit the Go Env for the active workspace.
266274
### `Go: Reset Workspace Env`
267275

268276
Reset the Go Env for the active workspace.
269-
270-
### `Go: Run Vulncheck (Preview)`
271-
272-
Run vulnerability check. See https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck for more details about the analysis.

docs/features.md

Lines changed: 87 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This document describes the features supported by this extension.
1616
* [Document outline](#document-outline)
1717
* [Toggle between code and tests](#toggle-between-code-and-tests)
1818
* [Syntax Highlighting](#syntax-highlighting)
19+
* [Inlay Hints](#inlay-hints)
1920
* [Code Editing](#code-editing)
2021
* [Snippets](#snippets)
2122
* [Format and organize imports](#format-and-organize-imports)
@@ -29,8 +30,10 @@ This document describes the features supported by this extension.
2930
* [Fill struct literals](#fill-struct-literals)
3031
* [Diagnostics](#diagnostics)
3132
* [Build errors](#build-errors)
32-
* [Vet errors](#vet-errors)
33+
* [Vet and extra analyses](#vet-and-extra-analyses)
3334
* [Lint errors](#lint-errors)
35+
* [Vulnerabilities in dependencies](#analyze-vulnerabilities-in-dependencies)
36+
* [Code Lenses](#code-lenses)
3437
* [Run and test in the editor](#run-and-test-in-the-editor)
3538
* [Run your code](#run-your-code)
3639
* [Test and benchmark](#test-and-benchmark)
@@ -105,7 +108,6 @@ Quickly toggle between a file and its corresponding test file by using the [`Go:
105108

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

108-
109111
## Syntax Highlighting
110112

111113
The default syntax highlighting for Go files is implemented in Visual Studio Code using TextMate grammar, not by this extension.
@@ -118,6 +120,55 @@ When `gopls`'s semantic tokens feature is enabled, `gopls` also provides semanti
118120

119121
<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>
120122

123+
## Inlay Hints
124+
125+
Inlay hints render additional inline information to source code to help you understand what the code does.
126+
They can be enabled/disabled with the `editor.inlayHints.enabled` setting in combination with settings to enable inlay hints types.
127+
128+
### Variable types in assign statements
129+
130+
```go
131+
i/* int*/, j/* int*/ := 0, len(r)-1
132+
```
133+
134+
### Variable types in range statements
135+
```go
136+
for k/* int*/, v/* string*/ := range []string{} {
137+
fmt.Println(k, v)
138+
}
139+
```
140+
### Composite literal field names
141+
```go
142+
{/*in: */"Hello, world", /*want: */"dlrow ,olleH"}
143+
```
144+
145+
### Composite literal types
146+
```go
147+
for _, c := range []struct {
148+
in, want string
149+
}{
150+
/*struct{ in string; want string }*/{"Hello, world", "dlrow ,olleH"},
151+
}
152+
```
153+
### Constant values
154+
```go
155+
const (
156+
KindNone Kind = iota/* = 0*/
157+
KindPrint/* = 1*/
158+
KindPrintf/* = 2*/
159+
KindErrorf/* = 3*/
160+
)
161+
```
162+
### Function type parameters
163+
```go
164+
myFoo/*[int, string]*/(1, "hello")
165+
```
166+
167+
### Parameter names
168+
```go
169+
parseInt(/* str: */ "123", /* radix: */ 8)
170+
```
171+
121172
## Code Editing
122173

123174
### [Snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets)
@@ -140,6 +191,11 @@ The extension organizes imports automatically and can add missing imports if the
140191

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

194+
#### Custom formatter
195+
196+
In addition to the default `gofmt`-style formatter, the Go language server supports `gofumpt`-style formatting. You can enable `gofumpt` formatting by setting `"gopls.formatting.gofumpt"`.
197+
You can also configure to use other custom formatter by using the `"go.formatTool"` setting. The custom formatter must operate on file contents from STDIN, and output the formatted result to STDOUT.
198+
143199
### [Rename symbol](https://code.visualstudio.com/docs/editor/refactoring#_rename-symbol)
144200

145201
Rename all occurrences of a symbol in your workspace.
@@ -185,29 +241,47 @@ Use the [`Go: Fill struct`](commands.md#fill-struct) command to automatically fi
185241

186242
<div style="text-align: center;"><img src="images/fillstructliterals.gif" alt="Fill struct literals" style="width: 75%"> </div>
187243

188-
## Diagnostics
244+
## Diagnostics
189245

190-
Learn more about [diagnostic errors](tools.md#diagnostics).
246+
The extension, powered by the Go language server (`gopls`), offers various diagnostics and analyses features,
247+
and often with quick fixes to address detected issues.
191248

192249
### Build errors
193250

194-
Build errors can be shown as you type or on save. Configure this behavior through the [`"go.buildOnSave"`](settings.md#go.buildOnSave) setting.
251+
Compile and type errors are shown as you type by default. This works not only Go source code, but also `go.mod`, `go.work`, and Go template files.
195252

196-
By default, code is compiled using the `go` command (`go build`), but build errors as you type are provided by the [`gotype-live`](tools.md#diagnostics) tool.
253+
### Vet and extra analyses
197254

198-
### Vet errors
255+
The Go language server (`gopls`) reports [`vet`](https://pkg.go.dev/cmd/vet) errors and runs many useful analyzers as you type. A full list of analyzers that `gopls` uses can be found in the [analyses settings section](https://github.com/golang/vscode-go/wiki/settings#uidiagnosticanalyses).
199256

200-
Vet errors can be shown on save. The vet-on-save behavior can also be configured through the [`"go.vetOnSave"`](settings.md#go.vetOnSave) setting.
257+
### Lint errors
201258

202-
The vet tool used is the one provided by the `go` command: [`go vet`](https://golang.org/cmd/vet/).
259+
You can configure an extra linter to run on file save. This behavior is configurable through the [`"go.lintOnSave"`](settings.md#go.lintOnSave) setting.
203260

204-
### Lint errors
261+
The default lint tool is [`staticcheck`]. Popular alternative linters such as [`golint`], [`golangci-lint`] and [`revive`] can be used instead by configuring the [`"go.lintTool"`](settings.md#go.lintTool) setting. For a complete overview of linter options, see the [documentation for diagnostic tools](tools.md#diagnostics).
262+
263+
### Analyze vulnerabilities in dependencies
264+
265+
The extension checks the 3rd party dependencies in your code and surfaces vulnerabilities known to the [Go vulnerability database](https://vuln.go.dev). There are two modes that complement each other.
266+
267+
* Import-based analysis: this can be enabled using the [`"go.diagnostic.vulncheck": "Imports"`](settings.md#go.diagnostic.vulncheck) setting. You can turn on and off this analysis conveniently with the ["Go: Toggle Vulncheck"](commands.md#go-toggle-vulncheck) command. In this mode, `gopls` reports vulnerabilities that affect packages directly and indirectly used by your code. The diagnostics are reported in the `go.mod` file along with quick fixes to help upgrading vulnerable modules.
268+
269+
* `Govulncheck` analysis: this is based on the [`golang.org/x/vuln/cmd/govulncheck`](https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck) tool, which is embedded in `gopls`. This provides a low-noise, reliable way to inspect known vulnerabilities. This only surfaces vulnerabilities that actually affect your code, based on which functions in your code are transitively calling vulnerable functions. This can be accessible by the `gopls` [`run_govulncheck`](settings.md#uicodelenses) code lens. The import-based analysis result also provides the `"Run govulncheck to verify"` option as a quick fix.
270+
271+
<div style="text-align: center;"><img src="images/vulncheck.gif" alt="Vulncheck">
272+
<em>Go: Toggle Vulncheck</em> <a href="https://user-images.githubusercontent.com/4999471/206977512-a821107d-9ffb-4456-9b27-6a6a4f900ba6.mp4">(vulncheck.mp4)</a> </div>
273+
274+
These features require _`gopls` v0.11.0 or newer_.
205275

206-
Much like vet errors, lint errors can also be shown on save. This behavior is configurable through the [`"go.lintOnSave"`](settings.md#go.lintOnSave) setting.
276+
Please share your feedback at https://go.dev/s/vsc-vulncheck-feedback.
277+
Report a bug and feature request in [our issue tracker](https://github.com/golang/vscode-go/issues/new).
207278

208-
The default lint tool is [`staticcheck`]. However, custom lint tools can be easily used instead by configuring the [`"go.lintTool"`](settings.md#go.lintTool) setting. [`golint`], [`golangci-lint`], and [`revive`] are also supported.
279+
**Notes and Caveats**
209280

210-
For a complete overview of linter options, see the [documentation for diagnostic tools](tools.md#diagnostics).
281+
- The import-based analysis uses the list of packages in the workspace modules, which may be different from what you see from `go.mod` files if `go.work` or module `replace`/`exclude` is used.
282+
- The govulncheck analysis result can become stale as you modify code or the Go vulnerability database is updated. In order to invalidate the analysis results manually, use the [`"Reset go.mod diagnostics"`] codelens shown on the top of the `go.mod` file. Otherwise, the result will be automatically invalidated after an hour.
283+
- These features currently don't report vulnerabilities in the standard libraries or tool chains. We are still investigating UX on where to surface the findings and how to help users handle the issues.
284+
- The extension does not scan private packages nor send any information on private modules. All the analysis is done by pulling a list of known vulnerable modules from the Go vulnerability database and then computing the intersection locally.
211285

212286
## Run and test in the editor
213287

docs/images/vulncheck.gif

1.62 MB
Loading

0 commit comments

Comments
 (0)