Skip to content

Commit 961683c

Browse files
committed
[release] prepare v0.34.0 release
8032cf1 src/goToolsInformation: update hardcoded latest version of gopls for release 6e5058c chore: Set permissions for GitHub actions caee58d docs: update "debug a program as root" to work with snap and package tests 450ffa7 CHANGELOG.md: prepare for v0.33.1 1cd7544 build/all.bash: rearrange test order 27ca045 package.json: sync doc with [email protected] 150c57f src/goVulncheck: show the vulncheck result in vulncheck.view 0d481b8 src/goMain: register VulncheckResultViewProvider dd2efbc test/gopls/vulncheck: increase 'populate webview' test timeout 69e5534 src/goVulncheck: add VulncheckResultViewProvider 84ac6ba docs/debugging.md: instruction for `console` and debugging as root c9cc7b4 test/integration/codelens: fix type error cdd8871 codelens: skip run-test and debug-test links and explorer entry for TestMain(*testing.M) 5c2db73 src/language: remove deep-equal dependency 70500e7 vscode-go: update to LSP 3.17 and vscode-languageclient v8.0.0 1660a85 vscode-go: update @types/vscode and engines.vscode 7c79ef4 vscode-go: unify tsconfig for build and test 3b44015 test: fix type errors 924ca36 src/goVulncheck: rename VulncheckResult to VulncheckReport 070d2fa src/goExplorer.ts: add handler registrations to disposables b75abf0 test/integration: increase test timeout 5a9bc67 vscode-go: make all context properties optional ff8fb94 src/goMain.ts: move setGOROOTEnvVar to goEnv 1ea929e src/goMain.ts: move tools update logic to goInstallTools 47b1555 src/goMain.ts: cleanup activate function a1303d3 src/goMain.ts: remove goCtx export 41cf6d4 src/goMain.ts: move diagnostic collections to context 7854360 src/goMain.ts: move runBuilds to commands 4eef175 vscode-go: refactor various commands to factory pattern 74c0476 src/goTest.ts: refactor goTest to factory pattern 044fec8 vscode-go: refactor goDoctor, goFillStruct, and goImpl to factory pattern b8c8806 src/goModifyTags.ts: refactor goModifyTags to factory pattern 934fcc8 src/goMain.ts: refactor debugger factory activation b0d0c71 src/goMain.ts: refactor codelens activation 4ba68e0 src/goMain.ts: refactor welcome panel activation d9980fd src/goVulncheck: replace gopls custom command with `gopls vulncheck` 68e1355 src/goDocumentSymbols: refactor DocumentSymbolProvider to remove fallback code 43bc5f9 src/goDeveloperSurvey: prepare 2022 mid dev survey 29bdea3 build/all.bash: disable packages.json setting test eea25f4 src/goMain.ts: remove unused imports c0f7791 src/commands: separate command logic from goMain.ts cf8170e src/goMain.ts: simplify command registration b83469b src/goFillStruct.ts: fix type error 750ae4a src/context.ts: remove mutex from context 71a933a src/commands: create startLanguageServer command 5897ed5 src/language: create go extension context 7c02b7d test/gopls: fix strict type errors 8519776 test/gopls/testdata: update workspace testdata configuration 4ad096e src/goVulncheck.ts: only run vulncheck for active editors of go files 8abfcaa vscode-go: add strict typecheck step to CI 01cc238 package.json: update typescript 398f8dd src/debugAdapter: fix strict type errors 492f2fc src/misc: fix strict type errors in various commands and data providers 8de5e1f src/misc: fix strict type errors in util files 8d8695b src/language: fix strict type errors 1f5edd0 src/goTest: fix strict type errors f08030f vscode-go: create separate tsconfig for builds 5d06597 package.json: change version to v0.34.0-dev 9227019 src/goLanguageServer: timeout LanguageClient.stop call 27e8258 src/util.ts: throw error when getGoVersion fails Change-Id: I835bc5799682c8d2df889dd3eabda8fc37100d9e
2 parents 797474c + 8032cf1 commit 961683c

File tree

113 files changed

+3680
-3362
lines changed

Some content is hidden

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

113 files changed

+3680
-3362
lines changed

.github/workflows/wiki.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ on:
88
- 'docs/**'
99

1010
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
# This workflow contains a single job called "build"
1316
publish:
1417
# The type of runner that the job will run on
18+
permissions:
19+
contents: write # for Git to git push
1520
runs-on: ubuntu-latest
1621

1722
# Steps represent a sequence of tasks that will be executed as part of the job

.vscode/tasks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"tasks": [
3434
{
3535
"type": "typescript",
36-
"tsconfig": "tsconfig.json",
36+
"tsconfig": "./tsconfig.build.json",
3737
"problemMatcher": [
3838
"$tsc"
3939
]
@@ -49,7 +49,7 @@
4949
"group": {
5050
"kind": "build",
5151
"isDefault": true
52-
}
52+
},
5353
},
5454
{
5555
"type": "npm",

build/Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
ARG GOVERSION=1
33
FROM golang:${GOVERSION} AS gobuilder
44

5-
ENV GO111MODULE on
65
ENV GOBIN /gobin
76

87
# Install other Go tools tests depend on
@@ -12,22 +11,19 @@ RUN go run /scratch/installtools/main.go
1211

1312
FROM node:latest
1413

15-
# Prepare a home directory under workspace.
16-
RUN mkdir -p /workspace/vscodego
17-
ENV HOME=/workspace/vscodego
18-
1914
# GO111MODULE=auto
2015
RUN mkdir /go
2116
COPY --from=gobuilder /gobin /go/bin
2217
COPY --from=gobuilder /usr/local/go /usr/local/go
2318

2419
# Add the default GOPATH/bin to the PATH.
2520
# Add the directories of the go tool chains to PATH.
26-
ENV PATH /workspace/vscodego/go/bin:/go/bin:/usr/local/go/bin:${PATH}
21+
ENV PATH /go/bin:/usr/local/go/bin:${PATH}
2722
ENV DEBIAN_FRONTEND noninteractive
2823

2924
RUN apt-get -qq update && apt-get install -qq -y libnss3 libgtk-3-dev libxss1 libasound2 xvfb libsecret-1-0 jq > /dev/null
3025
RUN npm install -g typescript vsce
3126

27+
USER node
3228
WORKDIR /workspace
3329
ENTRYPOINT ["build/all.bash"]

build/all.bash

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,26 @@ go_binaries_info() {
4242
}
4343

4444
run_test() {
45-
echo "**** Run test ****"
4645
df -h | grep shm
46+
47+
echo "**** Run settings generator ****"
48+
go run ./tools/generate.go -w=false -gopls=true
49+
50+
echo "**** Run Go tests ****"
51+
go test ./...
52+
53+
echo "**** Test build ****"
4754
npm ci
4855
npm run compile
56+
57+
echo "**** Run test ****"
4958
npm run unit-test
5059
npm test --silent
51-
npm run lint
52-
53-
# BUG(github.com/golang/vscode-go/issues/2230): Disable test temporarily.
54-
# echo "**** Run settings generator ****"
55-
# go run tools/generate.go -w=false -gopls=true
5660

57-
echo "**** Check if vsce works ****"
58-
vsce package
59-
60-
echo "**** Run Go tests ****"
61-
go test ./...
62-
# TODO(hyangah): see if go clean -modcache makes kokoro builder happy
63-
go clean -modcache
61+
npm run lint
6462
}
6563

64+
6665
run_test_in_docker() {
6766
echo "**** Building the docker image ***"
6867
docker build -t vscode-test-env ${GOVERSION:+ --build-arg GOVERSION="${GOVERSION}"} -f ./build/Dockerfile .

docs/debugging.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,148 @@ VS Code implements a generic, language-agnostic debugger UI based on [Debug Adap
343343

344344
For information on debugging using the legacy debug adapter, please see the old [Debugging Documentation](https://github.com/golang/vscode-go/blob/master/docs/debugging.md). Note that many new or enhanced features discussed in this document may not be available with the legacy debug adapter.
345345

346+
### Handling STDIN
347+
348+
The Go extension and `dlv` started as a subprocess of the extension do not have access to `tty`. The Go extension captures and forwards STDOUT/STDERR of the debug program to VS Code, so they can appear in `DEBUG OUTPUT` panel. But this arrangement does not handle STDIN.
349+
350+
When the target program needs to read from STDIN or access terminals (`tty`), use the `"console"` launch option that controls where the `dlv` debugger and the target process run:
351+
352+
* `integratedTerminal` for the terminal inside VS Code
353+
* `externalTerminal` for the terminal outside VS Code
354+
355+
The Go extension delegates interaction with terminals to VS Code [using Debug Adapter Protocol's `RunInTerminal` functionality](https://github.com/golang/vscode-go/discussions/1626). For configuring VS Code's terminal related behavior, see VS Code's [documentation](https://code.visualstudio.com/docs/editor/integrated-terminal).
356+
357+
### Debugging programs and tests as root
358+
359+
In order to run and debug a program or a package test running as root, the debugger (`dlv`) must run with root privilege, too. You can start the debug session with root privilege utilizing the `"asRoot"` AND `"console"` launch options. This is currently supported only on Linux and Mac.
360+
361+
When `asRoot` is true, the Go extension will use the `sudo` command to run `dlv`. Since `sudo` may ask you to enter password, the debug session needs [terminal access](#handling-stdin) so set `"console": "integratedTerminal"` or `"console": "externalTerminal"` in the launch configuration.
362+
363+
#### Debug a program as root
364+
365+
For example, the following launch configuration will start `myprogram` and debug it by running `sudo dlv dap` command in the integrated terminal.
366+
367+
```json
368+
{
369+
"name": "Launch as Root",
370+
"request": "launch",
371+
"mode": "exec",
372+
"asRoot": true,
373+
"program": "${workspaceRoot}/myprogram",
374+
"console": "integratedTerminal",
375+
...
376+
}
377+
```
378+
379+
The `asRoot` setting can be used with `auto`/`test`/`debug` launch modes that **build** the target binary to debug. That means the `go` command will be invoked as root to compile the binary, too. This can cause issues:
380+
381+
* by default, `sudo` does not preserve the user's current environment variables (see documentations about sudo's `--preserve-env` option). For example, `PATH` or library paths required for build may be different.
382+
* Go environment variable settings usually associated in the home directory are different.
383+
* Module/build caches used during build as root may be different from the caches used in your normal build. If they are the same, you may encounter permission errors due to cache data written to the caches as root.
384+
385+
Instead, you can arrange the `exec` launch mode to work with a pre-launch [task](https://code.visualstudio.com/docs/editor/tasks).
386+
387+
First, configure a debug build task to compile the target binary.
388+
389+
In `.vscode/tasks.json`:
390+
```json
391+
{
392+
...
393+
"tasks": [
394+
{
395+
"label": "go: build (debug)",
396+
"type": "shell",
397+
"command": "go",
398+
"args": [
399+
"build",
400+
"-gcflags=all=-N -l",
401+
"-o",
402+
"${fileDirname}/__debug_bin"
403+
],
404+
"options": {
405+
"cwd": "${fileDirname}"
406+
},
407+
...
408+
}
409+
]
410+
}
411+
```
412+
413+
The `-gcflags=all=-N -l` flag tells the `go build` command to preserve the debug information. The `-o` flag causes the compiled binary to be placed in `"${fileDirname}/__debug_bin"`. Extra build flags and environment variables *used for build* should be configured here as `args` or `options`'s `env` settings.
414+
415+
It might be useful to add `__debug_bin` to your `.gitignore` to avoid debugging binaries getting checked-in into your repository.
416+
417+
Then, configure the launch config to run the task before starting debugging.
418+
419+
In `.vscode/launch.json`:
420+
```json
421+
...
422+
"configurations": [
423+
{
424+
"name": "Launch Package as root",
425+
"type": "go",
426+
"request": "launch",
427+
"mode": "exec",
428+
"asRoot": true,
429+
"console": "integratedTerminal",
430+
"program": "${fileDirname}/__debug_bin",
431+
"preLaunchTask": "go: build (debug)",
432+
}
433+
]
434+
```
435+
436+
Settings (`args`, `cwd`, `env`, ...) configured in the above `launch.json` will only apply when *running* the compiled binary, not when building the binary.
437+
438+
#### Debug a package test as root
439+
440+
To debug package tests as root add the following launch and task configurations.
441+
442+
In `.vscode/tasks.json`:
443+
```json
444+
...
445+
"tasks": [
446+
{
447+
...
448+
},
449+
{
450+
"label": "go test (debug)",
451+
"type": "shell",
452+
"command": "go",
453+
"args": [
454+
"test",
455+
"-c",
456+
"-o",
457+
"${fileDirname}/__debug_bin"
458+
],
459+
"options": {
460+
"cwd": "${fileDirname}",
461+
},
462+
...
463+
}
464+
]
465+
```
466+
467+
In `.vscode/launch.json`:
468+
```json
469+
...
470+
"configurations": [
471+
{
472+
...
473+
},
474+
{
475+
"name": "Debug Package Test as root",
476+
"type": "go",
477+
"request": "launch",
478+
"mode": "exec",
479+
"asRoot": true,
480+
"program": "${fileDirname}/__debug_bin",
481+
"cwd": "${fileDirname}",
482+
"console": "integratedTerminal",
483+
"preLaunchTask": "go test (debug)"
484+
}
485+
]
486+
```
487+
346488
### Manually installing `dlv`
347489

348490
On rare occasions, you may want to install `dlv` by yourself instead of letting the extension handle its installation.

media/reset.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*---------------------------------------------------------
2+
* Copyright 2022 The Go Authors. All rights reserved.
3+
* Licensed under the MIT License. See LICENSE in the project root for license information.
4+
*--------------------------------------------------------*/
5+
6+
html {
7+
box-sizing: border-box;
8+
font-size: 13px;
9+
}
10+
11+
*,
12+
*:before,
13+
*:after {
14+
box-sizing: inherit;
15+
}
16+
17+
body,
18+
h1,
19+
h2,
20+
h3,
21+
h4,
22+
h5,
23+
h6,
24+
p,
25+
ol,
26+
ul {
27+
margin: 0;
28+
padding: 0;
29+
font-weight: normal;
30+
}

media/vscode.css

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*---------------------------------------------------------
2+
* Copyright 2022 The Go Authors. All rights reserved.
3+
* Licensed under the MIT License. See LICENSE in the project root for license information.
4+
*--------------------------------------------------------*/
5+
6+
:root {
7+
--container-paddding: 20px;
8+
--input-padding-vertical: 6px;
9+
--input-padding-horizontal: 4px;
10+
--input-margin-vertical: 4px;
11+
--input-margin-horizontal: 0;
12+
}
13+
14+
body {
15+
padding: 0 var(--container-paddding);
16+
color: var(--vscode-foreground);
17+
font-size: var(--vscode-font-size);
18+
font-weight: var(--vscode-font-weight);
19+
font-family: var(--vscode-font-family);
20+
background-color: var(--vscode-editor-background);
21+
}
22+
23+
body>*,
24+
form>* {
25+
margin-block-start: var(--input-margin-vertical);
26+
margin-block-end: var(--input-margin-vertical);
27+
}
28+
29+
*:focus {
30+
outline-color: var(--vscode-focusBorder) !important;
31+
}
32+
33+
a {
34+
color: var(--vscode-textLink-foreground);
35+
}
36+
37+
a:hover,
38+
a:active {
39+
color: var(--vscode-textLink-activeForeground);
40+
}
41+
42+
code {
43+
font-size: var(--vscode-editor-font-size);
44+
font-family: var(--vscode-editor-font-family);
45+
}

media/vulncheckView.css

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*---------------------------------------------------------
2+
* Copyright 2022 The Go Authors. All rights reserved.
3+
* Licensed under the MIT License. See LICENSE in the project root for license information.
4+
*--------------------------------------------------------*/
5+
6+
.log {
7+
font-weight: lighter;
8+
}
9+
10+
.vuln {
11+
text-align: left;
12+
padding-bottom: 1em;
13+
}
14+
15+
.vuln-desc {
16+
padding-top: 0.5em;
17+
padding-bottom: 0.5em;
18+
}
19+
20+
.vuln-details {
21+
padding-bottom: 0.5em;
22+
}
23+
24+
details summary {
25+
cursor: pointer;
26+
position: relative;
27+
}
28+
29+
details summary>* {
30+
display: inline;
31+
position: relative;
32+
}
33+
34+
.stacks {
35+
padding: 1em;
36+
}
37+
38+
.stack {
39+
padding: 1em;
40+
font-size: var(--vscode-editor-font-size);
41+
font-family: var(--vscode-editor-font-family);
42+
}

0 commit comments

Comments
 (0)