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

Map remote goroot to local goroot #1179

Merged
merged 3 commits into from
Sep 1, 2017
Merged

Map remote goroot to local goroot #1179

merged 3 commits into from
Sep 1, 2017

Conversation

ramya-rao-a
Copy link
Contributor

@ramya-rao-a ramya-rao-a commented Aug 31, 2017

Fix for #1178

See #1178 (comment)

@ramya-rao-a ramya-rao-a changed the title Map remote goroot to local grout Map remote goroot to local goroot Aug 31, 2017
// Fix for https://github.com/Microsoft/vscode-go/issues/1178
// When the pathToConvert is under GOROOT, replace the remote GOROOT with local GOROOT
if (!pathToConvert.startsWith(this.delve.remotePath)) {
let index = pathToConvert.indexOf('src');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is supposed to be /src/ in the goroot, right? It could match a different src, like /Users/src/goroot/src/...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to match /src/

return path.join(goroot, ...pathToConvert.substr(index).split(this.remotePathSeparator));
}
}
return pathToConvert.replace(this.delve.remotePath, this.delve.program).split(this.remotePathSeparator).join(this.localPathSeparator);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use path.join above and .join(this.localPathSeparator); here, should it be the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.join uses the path separator for the local machine so it would be the same localPathSeparator
additionally it also takes care of trailing / at the end of goroot if there is any.

So if I do a split on the goroot, remove trailing / if it exists, then I can use .join(this.localPathSeparator)

@ramya-rao-a ramya-rao-a merged commit 11aaef9 into master Sep 1, 2017
@ramya-rao-a ramya-rao-a deleted the remote-debug branch January 9, 2018 03:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants