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

Commit

Permalink
Dont infer GOPATH when debugging if one is provided #1196
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Sep 6, 2017
1 parent 1037473 commit e929b16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Binary file modified Go-latest.vsix
Binary file not shown.
14 changes: 8 additions & 6 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,15 @@ class Delve {

let env = Object.assign({}, process.env, fileEnv, launchArgs.env);

// If file/package to debug is not under env['GOPATH'], then infer it from the file/package path
// Not applicable to exec mode in which case `program` need not point to source code under GOPATH
let programNotUnderGopath = !env['GOPATH'] || !getCurrentGoWorkspaceFromGOPATH(env['GOPATH'], isProgramDirectory ? program : path.dirname(program));
if (programNotUnderGopath && (mode === 'debug' || mode === 'test')) {
env['GOPATH'] = getInferredGopath(isProgramDirectory ? program : path.dirname(program)) || env['GOPATH'];
if (!fileEnv['GOPATH'] && !launchArgs.env['GOPATH'] && (mode === 'debug' || mode === 'test')) {
// If user hasnt specified GOPATH & file/package to debug is not under env['GOPATH'], then infer it from the file/package path
// Not applicable to exec mode in which case `program` need not point to source code under GOPATH
let programNotUnderGopath = !env['GOPATH'] || !getCurrentGoWorkspaceFromGOPATH(env['GOPATH'], isProgramDirectory ? program : path.dirname(program));
if (programNotUnderGopath ) {
env['GOPATH'] = getInferredGopath(isProgramDirectory ? program : path.dirname(program)) || env['GOPATH'];
}
}

verbose(`Using GOPATH: ${env['GOPATH']}`);

if (!!launchArgs.noDebug) {
Expand Down

0 comments on commit e929b16

Please sign in to comment.