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

Doesn't work with non-root go.mod #10

Open
Zaba505 opened this issue Apr 16, 2020 · 6 comments
Open

Doesn't work with non-root go.mod #10

Zaba505 opened this issue Apr 16, 2020 · 6 comments

Comments

@Zaba505
Copy link

Zaba505 commented Apr 16, 2020

First, I'd like to say thanks for putting this together! I really enjoy using it for all my Go projects but I have discovered an issue when I have a non-root go.mod. For example, let's say the given structure of a project is:

/my-project
  /cmd
    /my-awesome-tool
      go.mod
      main.go

Currently, if I open on the main.go file inside my-awesome-tool the following message appears:

You are neither in a module nor in your GOPATH. Please see https://github.com/golang/go/wiki/Modules for information on how to set up your Go project.

Go (gopls) /my-project/

Not sure if this is an issue with ide-gopls or gopls itself but I figured I'd start here and see if anyone else has ran into the same problem.

@stamblerre
Copy link

Thanks for the report! This is a gopls issue that we're working to resolve for gopls/v0.5.0.

@Zaba505
Copy link
Author

Zaba505 commented Apr 22, 2020

@stamblerre Thanks for replying so fast and sorry the late response. I was glancing through the issues for gopls and I couldn't find anything that mentions this explicitly. Just wondering if you have a issue to link to in order to watch its progress?

@stamblerre
Copy link

stamblerre commented Apr 22, 2020

No problem! The issue for the warning is golang/go#37279, and a number of the issues related to the workspace management are actually now in the gopls/v0.6.0 milestone: https://github.com/golang/go/milestone/139.

@Zaba505
Copy link
Author

Zaba505 commented Apr 22, 2020

Looking at golang/go#32394 I came across this your comment about adding a Workspace folder for each module. I think this is a good band-aid till gopls handles multiple modules automatically. Unfortunatelly, I can't find anything about configuring workspaces through ide-gopls. Do you think it's worth implementing this in ide-gopls or waiting for gopls/v0.6.0?

@stamblerre
Copy link

The workspace folders are typically handled at the level of the editor (for example, in VS Code, you can add a folder to a workspace via File -> Add Folder to Workspace). I am not sure if Atom has this same support (https://blog.atom.io/2015/04/15/multi-folder-projects.html looks promising), so it may just work out of the box. Otherwise, I'd say that if it's easy to implement in ide-gopls, it may be worth it, but if it's a significant undertaking, it'd probably be best to wait for gopls/v0.6.0.

@Zaba505
Copy link
Author

Zaba505 commented Apr 22, 2020

Thanks for the feedback! I'm gonna look into implementing it later this week when I have some time. I broke workspace configuration into its own issue, #11

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

No branches or pull requests

2 participants