Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Notify user in console when gopkgs returns no packages (#1528)
Browse files Browse the repository at this point in the history
* Notify user in console when gopkgs returns no packages. Fixes #1471

* Revert "Notify user in console when gopkgs returns no packages. Fixes #1471"

This reverts commit 801ac6f.

* Notify user in console when gopkgs returns no packages. Fixes #1471
  • Loading branch information
mkorejo authored and ramya-rao-a committed Feb 20, 2018
1 parent d5e35fb commit affa171
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/goPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type GopkgsDone = (res: Map<string, string>) => void;
let allPkgsCache: Map<string, string>;
let allPkgsLastHit: number;
let gopkgsRunning: boolean = false;
let gopkgsNotified: boolean = false;
let gopkgsSubscriptions: GopkgsDone[] = [];
let cacheTimeout: number = 5000;

Expand Down Expand Up @@ -102,6 +103,10 @@ export function getAllPackages(): Promise<Map<string, string>> {
return getAllPackagesNoCache().then((pkgs) => {
if (!pkgs || pkgs.size === 0) {
console.log('Could not find packages. Ensure `gopkgs -format {{.Name}};{{.ImportPath}}` runs successfully.');
if (!gopkgsNotified) {
vscode.window.showInformationMessage('Could not find packages. Ensure `gopkgs -format {{.Name}};{{.ImportPath}}` runs successfully.');
gopkgsNotified = true;
}
}
allPkgsLastHit = new Date().getTime();
return allPkgsCache = pkgs;
Expand Down

0 comments on commit affa171

Please sign in to comment.