-
Notifications
You must be signed in to change notification settings - Fork 645
Support Go modules #1532
Comments
I read the blog and I like vgo, too. But I don't know if vgo should be supported soon. |
There's a bit of a chicken and egg problem here. To be honest I'd be using vgo today on my projects if I had support for it in vscode, just so much clearer and faster than |
@nicpottier I've found that I can use vscode with vgo by placing my code at the proper |
Looks like vgo is more serious now https://blog.golang.org/versioning-proposal |
What would be needed to move forward on this? How does vscode-go map dependencies and how can we add that path matching on to this extension? Would love to help out. |
The vgo proposal was accepted earlier. |
I dont have the expertise to work on this, but I can help anyone who wants to give it a shot. @nicpottier, @illegalnumbers The Go extension does not maintain any maps of dependencies. It uses |
As far as I can tell the error format won't change with vgo, but what will is code navigation.. IE the path to find a specific package is no longer just |
vgo uses its own algorithm to determine the version, and the modules are extracted to $GOPATH/src/v/modulepath@version. You can see all of the currently-resolved modules and versions with |
Ah, right you are.. a sample:
So the right version of pq is found in:
|
Note that modules can encompass multiple packages, so the Perhaps vgo should gain a way to query for just the resolved module, version, and perhaps even source directory of any arbitrary package. This would making integration with editors and IDEs simpler. |
Agreed, might be useful to know from the vscode folks where the current code is for resolving these. Would make sure that whatever is added to vgo would satisfy that requirement. |
For code navigation we use tools like The only place the extension explicitly deals with vendors is to provide the |
Hey there @ramya-rao-a - long time no see :-)
I'm no expert, but I believe the vendoring stuff will be affected by vgo, as vgo does away with vendor directories and instead caches versioned dependencies outside the project. |
Awesome, thanks that's clear with respect to For @zmb3 I think vgo still supports vendoring.. at least the latest vgo has a |
vgo vendor exists for backwards compatibility, producing a “legacy” project with a vendor directory that must be built within GOPATH. In day to day operation a project that uses vgo will not have a vendor directory. At least that’s my understanding based on the backwards compatibility section of the tour here: https://research.swtch.com/vgo-tour |
@zmb3 Ah, right you are! |
Ya... haven't look into details about
For brief:
@zmb3 @nicpottier feel free to hac gopkgs |
Hello, @ramya-rao-a @uudashr have there been any updates with regards to this issue? |
In that case @ramya-rao-a would it be worth having a checklist in the OP or a milestone to track which dependencies have support? |
@RichyHBM Yes, definitely. If anyone can make a such a list, that would be greatly appreciated. |
I'll start it up here: VGO tools support
|
Maybe a good first step would be to allow specifying a custom Go binary to use (that way you could point it at the vgo binary) |
Support for modules was merged into Go and will be released as an experimental part of Go 1.11. This message sums it up quite nicely: https://groups.google.com/d/msg/golang-dev/a5PqQuBljF4/61QK4JdtBgAJ. I don't see the reason to support golang.org/x/vgo tool separately. |
You are correct, I had the compare syntax in reverse... uudashr/gopkgs@master...ikgo:master |
Maybe append this configuration to your setting:
|
Folks, I have an update. golang/go#24661 is the issue used by the Go tools team to track the update of Go modules support in various Go tools. While that is in progress, the currently available beta version of this extension has fixes for the below features when using Go modules
Features that were not affected when using modules in the first place:
Features that are broken, but we are in the process of fixing:
Please do try the beta versions and share any feedback/bugs you have. |
Another update:
|
Hi,
Thanks for this Ramya and everyone!
If I have GO111MODULE=auto and I'm inside GOPATH (meaning modules are off,
though my repo has go.mod), the Auto completion doesn't work. I know you
mentioned Auto-completion is not working for go modules but is the regular
auto completion for GOPATH also not working if we opt in to beta?
Best,
…On Sun, Sep 23, 2018 at 3:53 AM Ramya Rao ***@***.***> wrote:
Another update:
- Support for the Go to definition, symbol info on hover and Signature
Help features are now available if you are using the gogetdoc tool.
- There is a new beta version
<https://github.com/Microsoft/vscode-go/wiki/Use-the-beta-version-of-the-latest-Go-extension>
of this extension.
- Install the new beta version => add the setting "go.docsTool":
"gogetdoc" => run the command Go: Install/Update tools => choose
gogetdoc and gopkgs => Press Ok to update. Both these tools support Go
modules.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1532 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APihdSKiMTPF6TZgsWd4CDVWX_ZJShDjks5udz37gaJpZM4SNton>
.
--
Marwan Sulaiman
Software Developer
Mobile: 203-722-5772
|
I just installed @stamblerre's Beta (https://github.com/stamblerre/gocode), per mdempsky/gocode#46, as follows:
This has restored auto-completion for me (cc: @ramya-rao-a). I haven't tested it in great depth yet, but it's great to have it back! @marwan-at-work, this is working inside GOPATH as well. |
@marwan-at-work The beta version hasn't changed anything in the auto-completion of symbols themselves, only auto-completion of unimported packages. So your issue must be due to something else. @asw101 Yes, we do intend to use @stamblerre's fork of gocode. But since that is still work in progress, we intend to ship it in such a way that the fork is used only when you use Go modules, otherwise it falls back to the mdempsky's fork. Also, the results from it are not consistent. Once it is consistent, I'll ship the support for the same |
I think the issue still persists. Maybe I'm doing something wrong but here's what I'm looking at:
func PackPrint(){fmt.Println("PackTest Called")`
(go.autocompleteUnimportedPackages": true) |
@dreamheld Can you log a new issue for that please? |
I have all my 3 related projects referencing each other in go.mod and building on command line in go build CLI. However, in Visual Studio I get red errors on the package main main.go first lines.. After restarting vscode I'm still getting this error in my Go 1.11 go.mod based project.... can't load package: package /Users/ben/dev/company1/project1/chat_service: cannot find package "/Users/ben/dev/company1/project1/chat_service" in any of: Visually its showing a red line under my package main declaration at top of main.go. Its weird like looking for itself or my source code in the GOPATH, which I dont want to use GOPATH at all anymore and specifically go get still putting vendor packages there, but not my source code. Any ideas? |
Done! |
-i flag should be removed from go build command
…On Tue, Sep 25, 2018, 19:20 dreamheld ***@***.***> wrote:
@dreamheld <https://github.com/dreamheld> Can you log a new issue for
that please?
Done!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1532 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AiAFmSXPPShuinLmq2QWQr5qHjw7tvSFks5uelfIgaJpZM4SNton>
.
|
Can we customize the go build flags using.. |
@bjm88 See #1532 (comment), you can use |
I tried that, did not help. Still getting weird error. Also weird is I have 3 projects, 2 services and 1 shared common project for db/logging that the 2 reference. The 2 services seem to have this red line on the package main, but the common one never does. Perhaps some bug when go.mod has a location reference ) replace company1/product1/go_common => ../go_common Is this go.mod setup causing this? It seems so b/c the go_common lib doesn't actually have the issue. |
@bjm88 Open the output panel and select "Go" from the drop down on the top right. You can see the build, lint, and vet calls being made. Copy the build call and run it in the terminal. If you see the same errors in the terminal, then it is not related to the Go extension to VS Code, but is related to Go and your code setup. |
Looks like they're going to make the |
Thanks for letting us know about that @treeder! |
Thanks @ramya-rao-a for the hint to isolate. I can confirm I see this error output in the output panel for Go. However I can also confirm if I just manually run go build from my command prompt/shell I do NOT see the error. I only see one special flag -o, so I tried setting that also and it didn't make a different. No build issues manually, only within visual studio. The only thing I can see that is different is some issue with assuming source is in GOPATH and my source code is NOT in GOPATH its a workspace outside of GOPATH as its a monolithic repo with other projects non-go. It looks like visual studio code inject the fully qualified path to do a build, which would start at /Users as I'm on a mac, but the actual error is showing it is injecting this "_" underscore in front of the path. Is that some normal convention?? /Users/ben/dev/company/project>Finished running tool: /usr/local/bin/go build -o /var/folders/8_/b0g1vb392ws98pthb2vcf5nr0000gn/T/vscode-godAaLjI/go-code-check-4 Is it related to how vs code is launching on mac and calcuing full path that happens to be outside GOPATH? Just FYI To try and eliminate the error I did put this workspace path into GOPATH but it didn't help, same error. |
Using Can you add the below in your settings, reload VS Code and try again?
|
Thank you @ramya-rao-a adding this config Also if anyone else running into this and also finding it hard to test. I thought it was another issue with VS code, but actually my build feedback on errors was just really delayed b/c of this other issue where replace commands in go.mod were ignored by go run/go build/go get so it still does an HTTP call to try and get local package and times out and only then continues to finish actual build. This makes it really slow and delayed to find/test these issues on 1.11 right now if u using replace. Its a core go issue not VS code issue. |
Another update: The Go tools team have forks of the Please install this beta version, follow through the prompts to install/update the tools and let us know how the The sooner I get some feedback here, the sooner I can release an update with these changes :) |
@dreamheld I'll respond to the issue you created for the same yesterday #1942 and we can take it from there. |
All, Now that we have some progress on the features when using Go modules, I am closing this issue and locking the conversation. This is because this issue is already way too long for any new-comer to make any sense of. Here are some tips to continue this conversation:
Thank you for understanding. |
Now that vgo is available (https://research.swtch.com/vgo-tour), vscode-go will
remove importsflag errors because it doesn't understand the module (go.mod) concept, assuming you've configured golint to do that.Other issues will come up as well and the only workaround I can think of is disable lint modules (possibly).
I'm putting this out there since this is something we will definitely require .
The text was updated successfully, but these errors were encountered: