Skip to content

Commit

Permalink
src/goInstallTools: unpin dlv-dap version, and pick master
Browse files Browse the repository at this point in the history
This partially reverts commit d1d61bc.
Pinning made it difficult for users to use newer versions with bug fixes.

Use the stable version as the latestVersion for now.

Updates golang#1687

Change-Id: Ifa6b425bcafac9eea473e6a5ba4bc5a449ed1b9d
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/344789
Trust: Hyang-Ah Hana Kim <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
TryBot-Result: kokoro <[email protected]>
Reviewed-by: Polina Sokolova <[email protected]>
  • Loading branch information
hyangah committed Aug 26, 2021
1 parent 2ff7ead commit a1cc5e5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 31 deletions.
1 change: 1 addition & 0 deletions src/goInstallTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export async function installTools(
const toInstall: Promise<{ tool: Tool; reason: string }>[] = [];
for (const tool of missing) {
const modulesOffForTool = modulesOff;

const reason = installTool(tool, goVersion, envForTools, !modulesOffForTool);
toInstall.push(Promise.resolve({ tool, reason: await reason }));
}
Expand Down
6 changes: 3 additions & 3 deletions src/goToolsInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ export const allToolsInformation: { [key: string]: Tool } = {
replacedByGopls: false,
isImportant: true,
description: 'Go debugger & debug adapter (Delve DAP)',
defaultVersion: 'f95340ae1bf9', // pinned version
defaultVersion: 'master', // Always build from the master.
minimumGoVersion: semver.coerce('1.12'), // dlv requires 1.12+ for build
latestVersion: semver.parse('v1.7.1-0.20210804080032-f95340ae1bf9'),
latestVersionTimestamp: moment('2021-08-04', 'YYYY-MM-DD')
latestVersion: semver.parse('v1.7.1'),
latestVersionTimestamp: moment('2021-08-18', 'YYYY-MM-DD')
},
'fillstruct': {
name: 'fillstruct',
Expand Down
4 changes: 2 additions & 2 deletions test/integration/install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ suite('Installation Tests', function () {
{ name: 'guru', versions: ['v1.0.0'], wantVersion: 'v1.0.0' },
{
name: 'dlv-dap',
versions: ['v1.0.0', getTool('dlv-dap').defaultVersion!],
versions: ['v1.0.0', 'master'],
wantVersion: 'v' + getTool('dlv-dap').latestVersion!.toString()
}
],
Expand All @@ -175,7 +175,7 @@ suite('Installation Tests', function () {
{ name: 'guru', versions: ['v1.0.0'], wantVersion: 'v1.0.0' },
{
name: 'dlv-dap',
versions: ['v1.0.0', getTool('dlv-dap').defaultVersion!],
versions: ['v1.0.0', 'master'],
wantVersion: 'v' + getTool('dlv-dap').latestVersion!.toString()
}
],
Expand Down
2 changes: 1 addition & 1 deletion tools/allTools.ts.in
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const allToolsInformation: { [key: string]: Tool } = {
replacedByGopls: false,
isImportant: true,
description: 'Go debugger & debug adapter (Delve DAP)',
defaultVersion: '%s', // pinned version
defaultVersion: 'master', // Always build from the master.
minimumGoVersion: semver.coerce('1.12'), // dlv requires 1.12+ for build
latestVersion: semver.parse('%s'),
latestVersionTimestamp: moment('%s', 'YYYY-MM-DD')
Expand Down
26 changes: 1 addition & 25 deletions tools/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package main
import (
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
Expand All @@ -24,7 +23,6 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strings"

Expand Down Expand Up @@ -237,12 +235,6 @@ func main() {
if err != nil {
log.Fatal(err)
}
// Due to https://github.com/golang/vscode-go/issues/1682, we cannot use
// pseudo-version as the pinned version reliably.
dlvRevOrStable := dlvVersion.Version
if rev, err := pseudoVersionRev(dlvVersion.Version); err == nil { // pseudo-version
dlvRevOrStable = rev
}

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

// TODO(suzmue): change input to json and avoid magic string printing.
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")])
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")])

// Write tools section.
b.WriteString(toolsString)
Expand Down Expand Up @@ -693,19 +685,3 @@ func describeDebugProperty(p *Property) string {
}
return b.String()
}

// pseudoVersionRev extracts the revision info if the given version is pseudo version.
// We wanted to use golang.org/x/mod/module.PseudoVersionRev, but couldn't due to
// an error in the CI. This is a workaround.
//
// It assumes the version string came from the proxy, so a valid, canonical version
// string. Thus, the check for pseudoversion is not as robust as golang.org/x/mod/module
// offers.
func pseudoVersionRev(ver string) (rev string, _ error) {
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-]+)*)?$`)
if strings.Count(ver, "-") < 2 || !pseudoVersionRE.MatchString(ver) {
return "", errors.New("not a pseudo version")
}
j := strings.LastIndex(ver, "-")
return ver[j+1:], nil
}

0 comments on commit a1cc5e5

Please sign in to comment.