8000 gohack does not allow relative directories in GOHACK env var. · Issue #44 · rogpeppe/gohack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gohack does not allow relative directories in GOHACK env var. #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
davidovich opened this issue Jan 25, 2019 · 2 comments · Fixed by #45
Closed

gohack does not allow relative directories in GOHACK env var. #44

davidovich opened this issue Jan 25, 2019 · 2 comments · Fixed by #45

Comments

@davidovich
Copy link
Contributor

We want to be able to set GOHACK to a relative dir, say ./. But this is not possible at the moment as the initial ./ is removed in the replace directive, creating a broken replacement line for go:

replacement module without version must be directory path (rooted or starting with ./ or ../)

We can work around the problem by manually prefixing the replacement with ./.

We like the relative path use-case, because it allows enhanced interop in WSL, when the path is on a shared Windows mount (/mnt/c/...), Windows go tools can interpret the same (relative) path as the WSL go tools. With absolute paths, Windows tools obviously cannot interpret the /mnt/c/... mount.

This is somewhat related to #27.

@davidovich
Copy link
Contributor Author

Friendly ping; any news on this @rogpeppe ? Are you open to a PR for this issue ?

@myitcv
Copy link
Collaborator
myitcv commented Mar 26, 2019

Are you open to a PR for this issue ?

Yes, very much so :)

davidovich pushed a commit to davidovich/gohack that referenced this issue Mar 27, 2019
Prior to this change, we were using filepath.Join to derive a
replacement for the module dir. But this is not enough to
support relative directories as Join() cleans the resulting path,
removing any "./" prefix (which is needed by the replace drective when
using a local directory).

This change adds the "./" prefix if the user specified it in the GOHACK
env var.

Note that relative parent directory ("..") is not cleaned by
filepath.Join, so we do not need to cater to this case.

fixes rogpeppe#44
davidovich pushed a commit to davidovich/gohack that referenced this issue Mar 27, 2019
 Prior to this change, we were using `filepath.Join()` to derive a
 replacement for the module dir. But this is not enough to
 support relative directories, as `Join()` cleans the resulting path,
 removing any `"./"` prefix (which is needed by the replace drective when
 using a local directory).

 This change adds the `"./"` prefix if the user specified it in the GOHACK
 env var.

 Note that relative parent directory `".."` is not cleaned by
 `filepath.Join()`, so we do not need to cater to this case, and an added
 test proves that this works.

 fixes rogpeppe#44
davidovich pushed a commit to davidovich/gohack that referenced this issue Mar 29, 2019
 Prior to this change, we were using `filepath.Join()` to derive a
 replacement for the module dir. But this is not enough to
 support relative directories, as `Join()` cleans the resulting path,
 removing any `"./"` prefix (which is needed by the replace drective when
 using a local directory).

 This change adds the `"./"` prefix if the user specified it in the GOHACK
 env var.

 Note that relative parent directory `".."` is not cleaned by
 `filepath.Join()`, so we do not need to cater to this case, and an added
 test proves that this works.

 fixes rogpeppe#44
myitcv pushed a commit that referenced this issue Mar 29, 2019
Prior to this change, we were using `filepath.Join()` to derive a
 replacement for the module dir. But this is not enough to
 support relative directories, as `Join()` cleans the resulting path,
 removing any `"./"` prefix (which is needed by the replace drective when
 using a local directory).

 This change adds the `"./"` prefix if the user specified it in the GOHACK
 env var.

 Note that relative parent directory `".."` is not cleaned by
 `filepath.Join()`, so we do not need to cater to this case, and an added
 test proves that this works.

 fixes #44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0