You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+23-1Lines changed: 23 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff 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))
-`"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
2
24
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).
Copy file name to clipboardExpand all lines: docs/features.md
+87-13Lines changed: 87 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ This document describes the features supported by this extension.
16
16
*[Document outline](#document-outline)
17
17
*[Toggle between code and tests](#toggle-between-code-and-tests)
18
18
*[Syntax Highlighting](#syntax-highlighting)
19
+
*[Inlay Hints](#inlay-hints)
19
20
*[Code Editing](#code-editing)
20
21
*[Snippets](#snippets)
21
22
*[Format and organize imports](#format-and-organize-imports)
@@ -29,8 +30,10 @@ This document describes the features supported by this extension.
29
30
*[Fill struct literals](#fill-struct-literals)
30
31
*[Diagnostics](#diagnostics)
31
32
*[Build errors](#build-errors)
32
-
*[Vet errors](#vet-errors)
33
+
*[Vet and extra analyses](#vet-and-extra-analyses)
33
34
*[Lint errors](#lint-errors)
35
+
*[Vulnerabilities in dependencies](#analyze-vulnerabilities-in-dependencies)
36
+
*[Code Lenses](#code-lenses)
34
37
*[Run and test in the editor](#run-and-test-in-the-editor)
35
38
*[Run your code](#run-your-code)
36
39
*[Test and benchmark](#test-and-benchmark)
@@ -105,7 +108,6 @@ Quickly toggle between a file and its corresponding test file by using the [`Go:
105
108
106
109
<divstyle="text-align: center;"><imgsrc="images/toggletestfile.gif"alt="Toggle between reverse.go and reverse_test.go"style="width: 75%"> </div>
107
110
108
-
109
111
## Syntax Highlighting
110
112
111
113
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
118
120
119
121
<divstyle="text-align: center;"><imgsrc="images/gotmpl.gif"alt="Enable Go template language support by changing the language ID"style="width: 75%"> </div>
120
122
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.
@@ -140,6 +191,11 @@ The extension organizes imports automatically and can add missing imports if the
140
191
141
192
<divstyle="text-align: center;"><imgsrc="images/addimport.gif"alt="Add byte import to Go file"style="width: 75%"> </div>
142
193
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.
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.
191
248
192
249
### Build errors
193
250
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.
195
252
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
197
254
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).
199
256
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
201
258
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.
203
260
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.
These features require _`gopls` v0.11.0 or newer_.
205
275
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).
207
278
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**
209
280
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.
0 commit comments