Skip to content

Commit

Permalink
tools/generate.go: update gopls and dlv-dap versions in generate
Browse files Browse the repository at this point in the history
Both gopls and dlv-dap have frequent updates, so we frequently need
to change the latest versions to keep our users up to date.

This updates the generate script to also update the versions in
src/goTools.ts.

Updates golang#1403

Change-Id: Ic6de1ce8cbe9c97d89f48c4b689271d75be5bb17
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/319029
Trust: Suzy Mueller <[email protected]>
Run-TryBot: Suzy Mueller <[email protected]>
TryBot-Result: kokoro <[email protected]>
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
  • Loading branch information
suzmue committed May 17, 2021
1 parent 39445e1 commit 0f4b38f
Show file tree
Hide file tree
Showing 6 changed files with 613 additions and 262 deletions.
2 changes: 1 addition & 1 deletion src/goStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from './goLanguageServer';
import { isGoFile } from './goMode';
import { getModFolderPath, isModSupported } from './goModules';
import { allToolsInformation } from './goTools';
import { allToolsInformation } from './goToolsInformation';
import { getGoVersion } from './util';

export const outputChannel = vscode.window.createOutputChannel('Go');
Expand Down
268 changes: 15 additions & 253 deletions src/goTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import semver = require('semver');
import util = require('util');
import { getFormatTool, usingCustomFormatTool } from './goFormat';
import { goLiveErrorsEnabled } from './goLiveErrors';
import { allToolsInformation } from './goToolsInformation';
import { getBinPath, GoVersion } from './util';

export interface Tool {
Expand Down Expand Up @@ -214,259 +215,20 @@ export function goplsStaticcheckEnabled(
return !features || features['diagnostics'] === true;
}

export const allToolsInformation: { [key: string]: Tool } = {
'gocode': {
name: 'gocode',
importPath: 'github.com/mdempsky/gocode',
modulePath: 'github.com/mdempsky/gocode',
isImportant: true,
replacedByGopls: true,
description: 'Auto-completion, does not work with modules',
close: async (env: NodeJS.Dict<string>): Promise<string> => {
const toolBinPath = getBinPath('gocode');
if (!path.isAbsolute(toolBinPath)) {
return '';
}
try {
const execFile = util.promisify(cp.execFile);
const { stderr } = await execFile(toolBinPath, ['close'], { env, timeout: 10000 }); // give 10sec.
if (stderr.indexOf("rpc: can't find service Server.") > -1) {
return 'Installing gocode aborted as existing process cannot be closed. Please kill the running process for gocode and try again.';
}
} catch (err) {
// This may fail if gocode isn't already running.
console.log(`gocode close failed: ${err}`);
}
return '';
export const gocodeClose = async (env: NodeJS.Dict<string>): Promise<string> => {
const toolBinPath = getBinPath('gocode');
if (!path.isAbsolute(toolBinPath)) {
return '';
}
try {
const execFile = util.promisify(cp.execFile);
const { stderr } = await execFile(toolBinPath, ['close'], { env, timeout: 10000 }); // give 10sec.
if (stderr.indexOf("rpc: can't find service Server.") > -1) {
return 'Installing gocode aborted as existing process cannot be closed. Please kill the running process for gocode and try again.';
}
},
'gocode-gomod': {
name: 'gocode-gomod',
importPath: 'github.com/stamblerre/gocode',
modulePath: 'github.com/stamblerre/gocode',
isImportant: true,
replacedByGopls: true,
description: 'Auto-completion, works with modules',
minimumGoVersion: semver.coerce('1.11')
},
'gopkgs': {
name: 'gopkgs',
importPath: 'github.com/uudashr/gopkgs/v2/cmd/gopkgs',
modulePath: 'github.com/uudashr/gopkgs/v2',
replacedByGopls: false, // TODO(github.com/golang/vscode-go/issues/258): disable Add Import command.
isImportant: true,
description: 'Auto-completion of unimported packages & Add Import feature'
},
'go-outline': {
name: 'go-outline',
importPath: 'github.com/ramya-rao-a/go-outline',
modulePath: 'github.com/ramya-rao-a/go-outline',
replacedByGopls: false, // TODO(github.com/golang/vscode-go/issues/1020): replace with Gopls.
isImportant: true,
description: 'Go to symbol in file' // GoDocumentSymbolProvider, used by 'run test' codelens
},
'go-symbols': {
name: 'go-symbols',
importPath: 'github.com/acroca/go-symbols',
modulePath: 'github.com/acroca/go-symbols',
replacedByGopls: true,
isImportant: false,
description: 'Go to symbol in workspace'
},
'guru': {
name: 'guru',
importPath: 'golang.org/x/tools/cmd/guru',
modulePath: 'golang.org/x/tools',
replacedByGopls: true,
isImportant: false,
description: 'Find all references and Go to implementation of symbols'
},
'gorename': {
name: 'gorename',
importPath: 'golang.org/x/tools/cmd/gorename',
modulePath: 'golang.org/x/tools',
replacedByGopls: true,
isImportant: false,
description: 'Rename symbols'
},
'gomodifytags': {
name: 'gomodifytags',
importPath: 'github.com/fatih/gomodifytags',
modulePath: 'github.com/fatih/gomodifytags',
replacedByGopls: false,
isImportant: false,
description: 'Modify tags on structs'
},
'goplay': {
name: 'goplay',
importPath: 'github.com/haya14busa/goplay/cmd/goplay',
modulePath: 'github.com/haya14busa/goplay',
replacedByGopls: false,
isImportant: false,
description: 'The Go playground'
},
'impl': {
name: 'impl',
importPath: 'github.com/josharian/impl',
modulePath: 'github.com/josharian/impl',
replacedByGopls: false,
isImportant: false,
description: 'Stubs for interfaces'
},
'gotype-live': {
name: 'gotype-live',
importPath: 'github.com/tylerb/gotype-live',
modulePath: 'github.com/tylerb/gotype-live',
replacedByGopls: true, // TODO(github.com/golang/vscode-go/issues/1021): recommend users to turn off.
isImportant: false,
description: 'Show errors as you type'
},
'godef': {
name: 'godef',
importPath: 'github.com/rogpeppe/godef',
modulePath: 'github.com/rogpeppe/godef',
replacedByGopls: true,
isImportant: true,
description: 'Go to definition'
},
'gogetdoc': {
name: 'gogetdoc',
importPath: 'github.com/zmb3/gogetdoc',
modulePath: 'github.com/zmb3/gogetdoc',
replacedByGopls: true,
isImportant: true,
description: 'Go to definition & text shown on hover'
},
'gofumports': {
name: 'gofumports',
importPath: 'mvdan.cc/gofumpt/gofumports',
modulePath: 'mvdan.cc/gofumpt',
replacedByGopls: true,
isImportant: false,
description: 'Formatter'
},
'gofumpt': {
name: 'gofumpt',
importPath: 'mvdan.cc/gofumpt',
modulePath: 'mvdan.cc/gofumpt',
replacedByGopls: true,
isImportant: false,
description: 'Formatter'
},
'goimports': {
name: 'goimports',
importPath: 'golang.org/x/tools/cmd/goimports',
modulePath: 'golang.org/x/tools',
replacedByGopls: true,
isImportant: true,
description: 'Formatter'
},
'goreturns': {
name: 'goreturns',
importPath: 'github.com/sqs/goreturns',
modulePath: 'github.com/sqs/goreturns',
replacedByGopls: true,
isImportant: true,
description: 'Formatter'
},
'goformat': {
name: 'goformat',
importPath: 'winterdrache.de/goformat/goformat',
modulePath: 'winterdrache.de/goformat/goformat',
replacedByGopls: true,
isImportant: false,
description: 'Formatter'
},
'gotests': {
name: 'gotests',
importPath: 'github.com/cweill/gotests/gotests',
modulePath: 'github.com/cweill/gotests',
replacedByGopls: false,
isImportant: false,
description: 'Generate unit tests',
minimumGoVersion: semver.coerce('1.9')
},
// TODO(github.com/golang/vscode-go/issues/189): consider disabling lint when gopls is turned on.
'golint': {
name: 'golint',
importPath: 'golang.org/x/lint/golint',
modulePath: 'golang.org/x/lint',
replacedByGopls: false,
isImportant: false,
description: 'Linter',
minimumGoVersion: semver.coerce('1.9')
},
'staticcheck': {
name: 'staticcheck',
importPath: 'honnef.co/go/tools/cmd/staticcheck',
modulePath: 'honnef.co/go/tools',
replacedByGopls: false,
isImportant: true,
description: 'Linter'
},
'golangci-lint': {
name: 'golangci-lint',
importPath: 'github.com/golangci/golangci-lint/cmd/golangci-lint',
modulePath: 'github.com/golangci/golangci-lint',
replacedByGopls: false,
isImportant: true,
description: 'Linter'
},
'revive': {
name: 'revive',
importPath: 'github.com/mgechev/revive',
modulePath: 'github.com/mgechev/revive',
isImportant: true,
description: 'Linter'
},
'gopls': {
name: 'gopls',
importPath: 'golang.org/x/tools/gopls',
modulePath: 'golang.org/x/tools/gopls',
replacedByGopls: false, // lol
isImportant: true,
description: 'Language Server from Google',
usePrereleaseInPreviewMode: true,
minimumGoVersion: semver.coerce('1.12'),
latestVersion: semver.coerce('0.6.8'),
latestVersionTimestamp: moment('2021-03-17', 'YYYY-MM-DD'),
latestPrereleaseVersion: semver.coerce('0.6.8'),
latestPrereleaseVersionTimestamp: moment('2021-03-17', 'YYYY-MM-DD')
},
'dlv': {
name: 'dlv',
importPath: 'github.com/go-delve/delve/cmd/dlv',
modulePath: 'github.com/go-delve/delve',
replacedByGopls: false,
isImportant: true,
description: 'Go debugger (Delve)'
},
'dlv-dap': {
name: 'dlv-dap',
importPath: 'github.com/go-delve/delve/cmd/dlv',
modulePath: 'github.com/go-delve/delve',
replacedByGopls: false,
isImportant: false,
description: 'Go debugger (Delve built for DAP experiment)',
defaultVersion: 'master', // Always build from the master.
minimumGoVersion: semver.coerce('1.14'), // last 3 versions per delve policy
latestVersion: semver.parse('1.6.1-0.20210504195617-c5d58f494a26'),
latestVersionTimestamp: moment('2021-05-04', 'YYYY-MM-DD')
},
'fillstruct': {
name: 'fillstruct',
importPath: 'github.com/davidrjenni/reftools/cmd/fillstruct',
modulePath: 'github.com/davidrjenni/reftools',
replacedByGopls: true,
isImportant: false,
description: 'Fill structs with defaults'
},
'godoctor': {
name: 'godoctor',
importPath: 'github.com/godoctor/godoctor',
modulePath: 'github.com/godoctor/godoctor',
replacedByGopls: true,
isImportant: false,
description: 'Extract to functions and variables'
} catch (err) {
// This may fail if gocode isn't already running.
console.log(`gocode close failed: ${err}`);
}
return '';
};
Loading

0 comments on commit 0f4b38f

Please sign in to comment.