src/goInstallTools: unpin dlv-dap version, and pick master

This partially reverts commit d1d61bc5e6f1d577e11a893eaeee49e88933e461.
Pinning made it difficult for users to use newer versions with bug fixes.

Use the stable version as the latestVersion for now.

Updates golang/vscode-go#1687

Change-Id: Ifa6b425bcafac9eea473e6a5ba4bc5a449ed1b9d
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/344789
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Polina Sokolova <polina@google.com>
diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts
index bc8dead..e27b16b 100644
--- a/src/goInstallTools.ts
+++ b/src/goInstallTools.ts
@@ -161,6 +161,7 @@
 	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 }));
 	}
diff --git a/src/goToolsInformation.ts b/src/goToolsInformation.ts
index 1785726..f7b621f 100644
--- a/src/goToolsInformation.ts
+++ b/src/goToolsInformation.ts
@@ -223,10 +223,10 @@
 		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',
diff --git a/test/integration/install.test.ts b/test/integration/install.test.ts
index ed8f0f6..8d514e7 100644
--- a/test/integration/install.test.ts
+++ b/test/integration/install.test.ts
@@ -160,7 +160,7 @@
 				{ 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()
 				}
 			],
@@ -175,7 +175,7 @@
 				{ 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()
 				}
 			],
diff --git a/tools/allTools.ts.in b/tools/allTools.ts.in
index ee85474..0c31e4d 100644
--- a/tools/allTools.ts.in
+++ b/tools/allTools.ts.in
@@ -221,7 +221,7 @@
 		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')
diff --git a/tools/generate.go b/tools/generate.go
index e3169d1..4f0948e 100644
--- a/tools/generate.go
+++ b/tools/generate.go
@@ -15,7 +15,6 @@
 import (
 	"bytes"
 	"encoding/json"
-	"errors"
 	"flag"
 	"fmt"
 	"io"
@@ -24,7 +23,6 @@
 	"os"
 	"os/exec"
 	"path/filepath"
-	"regexp"
 	"sort"
 	"strings"
 
@@ -237,12 +235,6 @@
 	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")
@@ -277,7 +269,7 @@
 	}
 
 	// 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)
@@ -693,19 +685,3 @@
 	}
 	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
-}