@@ -44,13 +44,19 @@ import { allToolsInformation } from './goToolsInformation';
4444
4545const STATUS_BAR_ITEM_NAME = 'Go Tools' ;
4646
47- // minimum go version required for tools installation.
47+ /**
48+ * Minimum go version required for tools installation.
49+ */
4850const MINIMUM_GO_VERSION = '1.21.0' ;
4951
50- // declinedUpdates tracks the tools that the user has declined to update.
52+ /**
53+ * Tracks the tools that the user has declined to update.
54+ */
5155const declinedUpdates : Tool [ ] = [ ] ;
5256
53- // declinedUpdates tracks the tools that the user has declined to install.
57+ /**
58+ * Tracks the tools that the user has declined to install.
59+ */
5460const declinedInstalls : Tool [ ] = [ ] ;
5561
5662export interface IToolsManager {
@@ -107,10 +113,11 @@ export async function installAllTools(updateExistingToolsOnly = false) {
107113 goVersion
108114 ) ;
109115}
110-
111- // Returns the go version to be used for tools installation.
112- // If `go.toolsManagement.go` is set, it is preferred. Otherwise, the provided
113- // goVersion or the default version returned by getGoVersion is returned.
116+ /**
117+ * Returns the go version to be used for tools installation.
118+ * If `go.toolsManagement.go` is set, it is preferred. Otherwise, the provided
119+ * goVersion or the default version returned by getGoVersion is returned.
120+ */
114121export const getGoVersionForInstall = _getGoVersionForInstall ;
115122async function _getGoVersionForInstall ( goVersion ?: GoVersion ) : Promise < GoVersion | undefined > {
116123 let configuredGoForInstall = getGoConfig ( ) . get < string > ( 'toolsManagement.go' ) ;
@@ -282,8 +289,10 @@ async function tmpDirForToolInstallation() {
282289 return toolsTmpDir ;
283290}
284291
285- // installTool is used by goEnvironmentStatus.ts.
286- // TODO(hyangah): replace the callsite to use defaultToolsManager and remove this.
292+ /**
293+ * installTool is used by goEnvironmentStatus.ts.
294+ * TODO(hyangah): replace the callsite to use defaultToolsManager and remove this.
295+ */
287296export async function installTool ( tool : ToolAtVersion ) : Promise < string | undefined > {
288297 const goVersionForInstall = await getGoVersionForInstall ( ) ;
289298 if ( ! goVersionForInstall ) {
@@ -553,9 +562,11 @@ export function updateGoVarsFromConfig(goCtx: GoExtensionContext): Promise<void>
553562 } ) ;
554563}
555564
556- // maybeInstallImportantTools checks whether important tools are installed
557- // and they meet the version requirement.
558- // Then it tries to auto-install them if missing.
565+ /**
566+ * Checks whether important tools are installed and they meet the version
567+ * requirement.
568+ * Then it tries to auto-install them if missing.
569+ */
559570export async function maybeInstallImportantTools (
560571 alternateTools : { [ key : string ] : string } | undefined ,
561572 tm : IToolsManager = defaultToolsManager
@@ -648,8 +659,10 @@ async function updateImportantToolsStatus(tm: IToolsManager = defaultToolsManage
648659 }
649660}
650661
651- // getMissingTools returns missing tools.
652- // If matcher is provided, only the tools that match the filter will be checked.
662+ /**
663+ * Returns missing tools.
664+ * If matcher is provided, only the tools that match the filter will be checked.
665+ */
653666function getMissingTools ( matcher ?: ( value : Tool ) => boolean ) : Promise < Tool [ ] > {
654667 let keys = getConfiguredTools ( getGoConfig ( ) , getGoplsConfig ( ) ) ;
655668 if ( matcher ) {
@@ -688,13 +701,17 @@ async function suggestDownloadGo() {
688701 suggestedDownloadGo = true ;
689702}
690703
691- // ListVersionsOutput is the output of `go list -m -versions -json`.
704+ /**
705+ * The output of `go list -m -versions -json`.
706+ */
692707interface ListVersionsOutput {
693708 Version : string ; // module version
694709 Versions ?: string [ ] ; // available module versions (with -versions)
695710}
696711
697- // latestToolVersion returns the latest version of the tool.
712+ /**
713+ * Returns the latest version of the tool.
714+ */
698715export async function latestToolVersion ( tool : Tool , includePrerelease ?: boolean ) : Promise < semver . SemVer | null > {
699716 const goCmd = getBinPath ( 'go' ) ;
700717 const tmpDir = await tmpDirForToolInstallation ( ) ;
@@ -729,8 +746,10 @@ export async function latestToolVersion(tool: Tool, includePrerelease?: boolean)
729746 return ret ;
730747}
731748
732- // inspectGoToolVersion reads the go version and module version
733- // of the given go tool using `go version -m` command.
749+ /**
750+ * Reads the go version and module version of the given go tool using
751+ * `go version -m` command.
752+ */
734753export const inspectGoToolVersion = defaultInspectGoToolVersion ;
735754async function defaultInspectGoToolVersion (
736755 binPath : string
@@ -803,6 +822,10 @@ export async function shouldUpdateTool(tool: Tool, toolPath: string): Promise<bo
803822 // tool.latestVersion is released when checkForUpdates === 'proxy'
804823}
805824
825+ /**
826+ * Updates outdated Go tools, prompting for approval if user setting
827+ * `go.toolsManagement.autoUpdate` is unset or disabled.
828+ */
806829export async function suggestUpdates ( ) {
807830 const configuredGoVersion = await getGoVersionForInstall ( ) ;
808831 if ( ! configuredGoVersion || configuredGoVersion . lt ( MINIMUM_GO_VERSION ) ) {
@@ -895,9 +918,11 @@ export async function listOutdatedTools(configuredGoVersion: GoVersion | undefin
895918 return oldTools . filter ( ( tool ) : tool is Tool => ! ! tool ) ;
896919}
897920
898- // maybeInstallVSCGO is a special program released and installed with the Go extension.
899- // Unlike other tools, it is installed under the extension path (which is cleared
900- // when a new version is installed).
921+ /**
922+ * VSCGO is a special program released and installed with the Go extension.
923+ * Unlike other tools, it is installed under the extension path
924+ * (which is cleared when a new version is installed).
925+ */
901926export async function maybeInstallVSCGO (
902927 extensionMode : vscode . ExtensionMode ,
903928 extensionId : string ,
0 commit comments