-
Notifications
You must be signed in to change notification settings - Fork 646
'Add import' action fails in module mode with "-mod=vendor" flag #2800
Comments
Guess I'll also ping @uudashr since he's the author of |
From what I can see, this happens:
I guess, there're two possible solutions:
I've created an issue uudashr/gopkgs#15 and made a PR uudashr/gopkgs#16 with a possible fix. WDYT? |
same issue but without -mod=vendor
reload vscode and try to run
|
@Vstural if you press |
@nezorflame
and run gopkgs in bash
in powershell
|
@Vstural did you also set up vendor by |
@nezorflame
|
Hey @nezorflame Thats some great investigations! @stamblerre Can you provide your thoughts on the scenario here or the issue uudashr/gopkgs#15? @Vstural Your case looks very different to me where |
I should also mention that even though my fix works, when you add new import and some func from it, if you use action |
@stamblerre @ramya-rao-a @uudashr the more I look into this, the more confused I get. Let's take some test project, e.g. Now we download some package to be used in our project later, e.g. to refactor our code and move to Go1.13-like errors with As expected, it downloads the latest version of that module and inserts it into our Now we do Now we want to list the packages with If we were in a plain modules mode without
All seems well, we did download these modules so the output is as expected.
And here we are - Is that working as expected? I think that the main issue is here, not in the |
From what I've been told over Gophers Slack, using |
To sum it up, I think that
|
This makes me wonder if we should disable the feature |
@ramya-rao-a I'm also against disabling this feature since it's the only way to actually add new import in module mode right now. Otherwise you have to do it manually since |
In any case, if everyone agrees to #2800 (comment), I've already changed the PR to reflect this behaviour: uudashr/gopkgs#16 |
@uudashr and I agreed to use the |
The |
I've tested this solution more thoroughly. While |
@ramya-rao-a after another discussion with @uudashr it seems that the current The last issue being supporting I think that this issue can be closed now, if the current behavior suits everyone. |
Thanks for all the work here and follow up @nezorflame and @uudashr Happy Coding! |
Description
While using Go modules in vendor mode (
GOFLAGS="-mod=vendor"
) in a project with some indirect dependencies, actionGo: Add imports
fails to execute with error:go env
outputSteps to reproduce
Let's assume that we have a project
/my/home/Go/src/my-service
with a dependency ingo.mod
:go mod tidy
andgo mod vendor
were run successfully,go build -mod=vendor
runs fine.If you enable
Developer Tools
and runGo: Add imports
again, you can see a more elaborate error:It seems that
go mod vendor
ignores indirect dependencies, thus they're not present in thevendor
folder, butgopkgs
tries to get them anyway.The text was updated successfully, but these errors were encountered: