Skip to content

Commit 27bcdca

Browse files
committed
src/goInstallTools: pin dlv-dap version @2f136727
This reverts commit a1cc5e5 (https://go-review.googlesource.com/c/vscode-go/+/344789) and pins dlv-dap at go-delve/delve@2f13672 We removed pinning in a1cc5e5 because we were still actively developing Delve DAP and the pinning made it difficult for users to pick up the latest bug fixes. Now Delve DAP is stable and most critical features are ready. Let's pin the version again and prevent breakages. We don't update the latestVersion in this change - currently dlv-dap uses this as the minimum required version. Updates #1850 Updates #1661 Change-Id: Ib8af635f3ee431bffa1fc505f85c9a87604f8323 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/370414 Trust: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Polina Sokolova <[email protected]>
1 parent bf2ce37 commit 27bcdca

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

src/goToolsInformation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export const allToolsInformation: { [key: string]: Tool } = {
223223
replacedByGopls: false,
224224
isImportant: true,
225225
description: 'Go debugger & debug adapter (Delve DAP)',
226-
defaultVersion: 'master', // Always build from the master.
226+
defaultVersion: '2f13672765fe', // pinned version
227227
minimumGoVersion: semver.coerce('1.12'), // dlv requires 1.12+ for build
228228
latestVersion: semver.parse('v1.7.3-0.20211026171155-b48ceec161d5'),
229229
latestVersionTimestamp: moment('2021-10-26', 'YYYY-MM-DD')

test/integration/install.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ suite('Installation Tests', function () {
160160
{ name: 'guru', versions: ['v1.0.0'], wantVersion: 'v1.0.0' },
161161
{
162162
name: 'dlv-dap',
163-
versions: ['v1.0.0', 'master'],
163+
versions: ['v1.0.0', getTool('dlv-dap').defaultVersion!],
164164
wantVersion: 'v' + getTool('dlv-dap').latestVersion!.toString()
165165
}
166166
],
@@ -175,7 +175,7 @@ suite('Installation Tests', function () {
175175
{ name: 'guru', versions: ['v1.0.0'], wantVersion: 'v1.0.0' },
176176
{
177177
name: 'dlv-dap',
178-
versions: ['v1.0.0', 'master'],
178+
versions: ['v1.0.0', getTool('dlv-dap').defaultVersion!],
179179
wantVersion: 'v' + getTool('dlv-dap').latestVersion!.toString()
180180
}
181181
],

tools/allTools.ts.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export const allToolsInformation: { [key: string]: Tool } = {
221221
replacedByGopls: false,
222222
isImportant: true,
223223
description: 'Go debugger & debug adapter (Delve DAP)',
224-
defaultVersion: 'master', // Always build from the master.
224+
defaultVersion: '%s', // pinned version
225225
minimumGoVersion: semver.coerce('1.12'), // dlv requires 1.12+ for build
226226
latestVersion: semver.parse('%s'),
227227
latestVersionTimestamp: moment('%s', 'YYYY-MM-DD')

tools/generate.go

+25-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ package main
1515
import (
1616
"bytes"
1717
"encoding/json"
18+
"errors"
1819
"flag"
1920
"fmt"
2021
"io"
@@ -23,6 +24,7 @@ import (
2324
"os"
2425
"os/exec"
2526
"path/filepath"
27+
"regexp"
2628
"sort"
2729
"strings"
2830

@@ -235,6 +237,12 @@ func main() {
235237
if err != nil {
236238
log.Fatal(err)
237239
}
240+
// Due to https://github.com/golang/vscode-go/issues/1682, we cannot use
241+
// pseudo-version as the pinned version reliably.
242+
dlvRevOrStable := dlvVersion.Version
243+
if rev, err := pseudoVersionRev(dlvVersion.Version); err == nil { // pseudo-version
244+
dlvRevOrStable = rev
245+
}
238246

239247
// Check for the latest gopls version.
240248
versions, err := listAllModuleVersions("golang.org/x/tools/gopls")
@@ -269,7 +277,7 @@ func main() {
269277
}
270278

271279
// TODO(suzmue): change input to json and avoid magic string printing.
272-
toolsString := fmt.Sprintf(string(data), goplsVersion.Version, goplsVersion.Time[:len("YYYY-MM-DD")], goplsVersionPre.Version, goplsVersionPre.Time[:len("YYYY-MM-DD")], dlvVersion.Version, dlvVersion.Time[:len("YYYY-MM-DD")])
280+
toolsString := fmt.Sprintf(string(data), goplsVersion.Version, goplsVersion.Time[:len("YYYY-MM-DD")], goplsVersionPre.Version, goplsVersionPre.Time[:len("YYYY-MM-DD")], dlvRevOrStable, dlvVersion.Version, dlvVersion.Time[:len("YYYY-MM-DD")])
273281

274282
// Write tools section.
275283
b.WriteString(toolsString)
@@ -685,3 +693,19 @@ func describeDebugProperty(p *Property) string {
685693
}
686694
return b.String()
687695
}
696+
697+
// pseudoVersionRev extracts the revision info if the given version is pseudo version.
698+
// We wanted to use golang.org/x/mod/module.PseudoVersionRev, but couldn't due to
699+
// an error in the CI. This is a workaround.
700+
//
701+
// It assumes the version string came from the proxy, so a valid, canonical version
702+
// string. Thus, the check for pseudoversion is not as robust as golang.org/x/mod/module
703+
// offers.
704+
func pseudoVersionRev(ver string) (rev string, _ error) {
705+
var pseudoVersionRE = regexp.MustCompile(`^v[0-9]+\.(0\.0-|\d+\.\d+-([^+]*\.)?0\.)\d{14}-[A-Za-z0-9]+(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$`)
706+
if strings.Count(ver, "-") < 2 || !pseudoVersionRE.MatchString(ver) {
707+
return "", errors.New("not a pseudo version")
708+
}
709+
j := strings.LastIndex(ver, "-")
710+
return ver[j+1:], nil
711+
}

0 commit comments

Comments
 (0)