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

Commit

Permalink
Pass pkg to go test
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Oct 2, 2017
1 parent 47c8b54 commit 7259f77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,12 @@ export function goTest(testconfig: TestConfig): Thenable<boolean> {
}

// Append the package name to args to enable running tests in symlinked directories
// We'll do this only when testing complete pkg as running a `go test package` stops the log.Println and fmt.Println outputs
if (!testconfig.includeSubDirectories && (!testconfig.functions || testconfig.functions.length > 1)) {
let currentGoWorkspace = getCurrentGoWorkspaceFromGOPATH(getCurrentGoPath(), testconfig.dir);
if (currentGoWorkspace) {
args.push(testconfig.dir.substr(currentGoWorkspace.length + 1));
}
let currentGoWorkspace = getCurrentGoWorkspaceFromGOPATH(getCurrentGoPath(), testconfig.dir);
if (currentGoWorkspace && !testconfig.includeSubDirectories) {
args.push(testconfig.dir.substr(currentGoWorkspace.length + 1));
}


targetArgs(testconfig).then(targets => {
let outTargets = args.slice(0);
if (targets.length > 2) {
Expand Down
6 changes: 5 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,11 @@ export function getCurrentGoPath(workspaceUri?: vscode.Uri): string {
workspaceUri = vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri).uri;
}
const config = vscode.workspace.getConfiguration('go', workspaceUri);
const currentRoot = workspaceUri ? workspaceUri.fsPath : vscode.workspace.rootPath;
let currentRoot = workspaceUri ? workspaceUri.fsPath : vscode.workspace.rootPath;
// Workaround for issue in https://github.com/Microsoft/vscode/issues/9448#issuecomment-244804026
if (process.platform === 'win32') {
currentRoot = currentRoot.substr(0, 1).toUpperCase() + currentRoot.substr(1);
}
const configGopath = config['gopath'] ? resolvePath(config['gopath'], currentRoot) : '';
const inferredGopath = config['inferGopath'] === true ? getInferredGopath(currentRoot) : '';

Expand Down

0 comments on commit 7259f77

Please sign in to comment.