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

x/tools/gopls: inconsistent vendoring issue #37734

Closed
kindywu opened this issue Mar 7, 2020 · 9 comments
Closed

x/tools/gopls: inconsistent vendoring issue #37734

kindywu opened this issue Mar 7, 2020 · 9 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@kindywu
Copy link

kindywu commented Mar 7, 2020

module demo7

go 1.14

require (
github.com/go-sql-driver/mysql v1.5.0
github.com/go-xorm/xorm v0.7.9
github.com/tencentcloud/tencentcloud-sdk-go v3.0.126+incompatible
)

Your workspace is misconfigured: go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -modfile=C:\Users\kindy\AppData\Local\Temp\go.demo7.645362371.mod -- demo7/tests]: exit status 1: go: inconsistent vendoring in C:\WS\golang\demo7:
github.com/kr/pretty@v0.2.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt

run 'go mod vendor' to sync, or use -mod=mod or -mod=readonly to ignore the vendor directory
. Please see https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md for more information or file an issue (https://github.com/golang/go/issues/new) if you believe this is a mistake.

@kindywu
Copy link
Author

kindywu commented Mar 7, 2020

try 'go mod vendor' but not use

@kindywu
Copy link
Author

kindywu commented Mar 7, 2020

github.com/go-sql-driver/mysql v1.5.0

explicit

github.com/go-sql-driver/mysql

github.com/go-xorm/xorm v0.7.9

explicit

github.com/go-xorm/xorm

github.com/tencentcloud/tencentcloud-sdk-go v3.0.126+incompatible

explicit

github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/regions
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/faceid/v20180301

xorm.io/builder v0.3.6

xorm.io/builder

xorm.io/core v0.7.2-0.20190928055935-90aeac8d08eb

xorm.io/core

@kindywu kindywu changed the title vscode go plugin cash vscode go plugin cash Inconsistent Vendoring Mar 7, 2020
@stamblerre stamblerre changed the title vscode go plugin cash Inconsistent Vendoring x/tools/gopls: inconsistent vendoring issue Mar 7, 2020
@stamblerre stamblerre added this to the gopls/v0.4.0 milestone Mar 7, 2020
@gopherbot gopherbot modified the milestones: gopls/v0.4.0, Unreleased Mar 7, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Mar 7, 2020
@gopherbot
Copy link
Contributor

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@stamblerre
Copy link
Contributor

Thanks for reporting this issue! A related issue might be #34657. Can you share the output of go env and gopls -rpc.trace -v check path/to/file.go?

@jayconrod or @bcmills: Do you have any insight on this error / how to avoid it? Thanks!

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Mar 9, 2020
@jayconrod
Copy link
Contributor

jayconrod commented Mar 9, 2020

cc @matloob

@kindywu Could you try running go mod tidy, then go mod vendor, then restarting your editor? If that doesn't work, could you post an example project that reproduces this issue? Or alternatively, post the output of the command below:

go list -mod=mod -f '{{range .Imports}}{{.}}
{{end}}{{range .TestImports}}{{.}}
{{end}}{{range .XTestImports}}{{.}}
{{end}}' ./...

This error is reported when automatic vendoring is enabled and go.mod is not consistent with vendor/modules.txt. Automatic vendoring is enabled if the go.mod file has go version 1.14 or later and a vendor directory is present. go mod tidy ensures that every necessary requirement appears in go.mod. go mod vendor copies imported packages into vendor/ and updates vendor/modules.txt.

@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 9, 2020
@kindywu
Copy link
Author

kindywu commented Mar 10, 2020

sorry,i have rollback to go1.12。the env is gone

@kindywu kindywu closed this as completed Mar 10, 2020
@shudipta
Copy link

In my case, without rollback to prev. Go version, the followings worked for me:

  • run $ go mod vendor; go build
  • run $ go build -mod=mod
  • run $ go build -mod=readonly

@kunto-zuro
Copy link

@kindywu i have problem when i install package mysql.
when I wrote this code
go get -u github.com/go-sql-driver/mysql

go: inconsistent vendoring in C:\Go\src:

    github.com/go-sql-driver/mysql@v1.5.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
    golang.org/x/crypto@v0.0.0-20200510223506-06a226fb4e37: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
    golang.org/x/net@v0.0.0-20200528225125-3c3fba18258b: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
    golang.org/x/sys@v0.0.0-20200523222454-059865788121: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
    golang.org/x/crypto@v0.0.0-20200128174031-69ecbb4d6d5d: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    golang.org/x/net@v0.0.0-20191126235420-ef20fe5d7933: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    golang.org/x/sys@v0.0.0-20200201011859-915c9c3d4ccf: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod

run 'go mod vendor' to sync, or use -mod=mod or -mod=readonly to ignore the vendor directory

I get an error like that and I can't run all of my .go files. Do you know how to solve this?

@stamblerre
Copy link
Contributor

@aditya-09: You can follow along with #39100.

appilon added a commit to hashicorp/terraform-provider-vsphere that referenced this issue Mar 16, 2021
@golang golang locked and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants