Skip to content
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

Enable go.mod support #34

Merged
merged 4 commits into from
May 25, 2020

Conversation

randallmlough
Copy link
Contributor

@randallmlough randallmlough commented May 23, 2020

Enables go mod support and works outside of GOPATH directory. I left a few TODO comments in the funcs for review and more tests should be created, but this worked in my local testing both in GOPATH and outside using modules.

addresses issue #29

The approach I took:
Since a go.mod file and processes works inside and outside of the GOPATH (as of 1.13 or 1.14 golang/go#31857), I figured we could easily check whether or not a go.mod file exists in the working directory. If it does, we can open and read the file, retrieve the module path and move on. if not, use original method of getting import path from go/src

@randallmlough
Copy link
Contributor Author

I realized that getGoImportFromFile() was being called for each import path, which either searches and opens a potential file (go.mod) or strips from a regex each time. In my opinion this is probably unnecessary since the import path isn't dynamic. It should be set on instantiation and the methods then refer to a field.

@RichardLindhout RichardLindhout merged commit 5fb5ca2 into web-ridge:master May 25, 2020
@RichardLindhout
Copy link
Member

Thanks again for a high quality PR!

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 this pull request may close these issues.

2 participants