-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/gopls: go directive added to go.mod with tempModfile = true #36247
Comments
I'll start looking into this. |
Change https://golang.org/cl/212477 mentions this issue: |
@ridersofrohan yes, that matches my understanding of But this is not expected behaviour when running with |
Ahh I see what you mean, the above CL should fix this issue when it gets merged in. |
@myitcv let me know if this is working as you expect it to now and I will close the issue. |
Thanks @ridersofrohan Per #36463 (comment) it's a little tricky for us to test this right now because your fix landed after https://go-review.googlesource.com/c/tools/+/212102 which introduced the problems described in #36463 I'll see whether I can cherry-pick this commit and test. |
@ridersofrohan I just tested with 53017a3 plus 11e9d9c and acbc0e3 cherry-picked on top. Following the exact same test as before, I am now seeing Is there a test on the It might well be my cherry-picking has failed... |
@myitcv while working on a different issue, I found a potential problem with the previous CL. This should be addressed in commit/f270e23f which just got merged in. Let me know if this fixes that issue, I will also look into adding a test in gopls to check for this. |
Thanks - checked against 700ee26 and all seems to be sorted now.
Thanks - otherwise it's really impossible to know if/when this gets broken. |
Change https://golang.org/cl/214260 mentions this issue: |
This change adds a test to ensure that your go.mod file remains unchanged when the tempModfile flag is activated. Specifically, it adds a test to ensure that a go directive does not get added to a user's go.mod file when there was not one included before. Updates golang/go#36247 Change-Id: If8db5508ace5b7222112408255ffa66e4d38797f Reviewed-on: https://go-review.googlesource.com/c/tools/+/214260 Reviewed-by: Rebecca Stambler <[email protected]> Run-TryBot: Rebecca Stambler <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
@ridersofrohan we're seeing an issue here again against Repro via
gives:
|
@myitcv I'm looking into it now. |
Change https://golang.org/cl/215978 mentions this issue: |
This change adds a buildflags variable to the ProcessEnv inside internal/imports. When you run go list with GO111MODULE=on to get information about the package you are in, it will add a go directive to your go.mod file if there is not one. With the tempModfile=on flag, there should be no changes to a user's go.mod file. Updates golang/go#36247 Change-Id: I817e4c46b4f433d0665fcb7585fcdf4f87049a38 Reviewed-on: https://go-review.googlesource.com/c/tools/+/215978 Run-TryBot: Rohan Challa <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
@myitcv ^ the above CL should have fixed this issue. Sorry for missing this the first time, let me know if it works or still shows up. |
@ridersofrohan. No problems. Did the repro above work for you? |
Sorry, that was unclear. Did the test in the repro above pass with the changes? |
I'm not sure how to run that test. I just manually tested it using VSCode. |
@myitcv, I tried to repro with your example, but how do I pass it my local version of |
With gopls from master and Go 1.14, the test gets past the cmp and fails later:
Dunno what that means but I would think this bug, at least, is fixed. |
It is. Thanks all |
Not currently possible, but will be once govim/govim#720 lands |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
govim/govim#634 adds support to
govim
for thetempModfile
option ingopls
.As part of that PR we have added a test, only run for Go 1.14, to verify that setting
tempModfile = true
leaves ago.mod
untouched.However we are seeing that despite this option setting, a
go
language directive is being added to thego.mod
.The test setup is as follows:
We:
main.go
main.go
main.go
(with no changes)What did you expect to see?
go.mod
to be unchanged, with nogo
directive and norequire
directive (forexample.com/blah
) added.What did you see instead?
The
go.mod
file changed with ago
directive added, meaning we end up with ago.mod
file that looks like:cc @stamblerre @ridersofrohan
The text was updated successfully, but these errors were encountered: