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/[email protected]: 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.
try 'go mod vendor' but not use
github.com/go-sql-driver/mysql
github.com/go-xorm/xorm
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
xorm.io/core
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.
Thanks for reporting this issue! A related issue might be https://github.com/golang/go/issues/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!
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.
sorry锛宨 have rollback to go1.12銆倀he env is gone
In my case, without rollback to prev. Go version, the followings worked for me:
$ go mod vendor; go build$ go build -mod=mod$ go build -mod=readonly@kindywu i have problem when i install package mysql.
when I wrote this code
go get -u github.com/go-sql-driver/mysql
github.com/go-sql-driver/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
golang.org/x/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
golang.org/x/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
golang.org/x/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
golang.org/x/[email protected]: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
golang.org/x/[email protected]: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
golang.org/x/[email protected]: 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?
@aditya-09: You can follow along with https://github.com/golang/go/issues/39100.
Most helpful comment
cc @matloob
@kindywu Could you try running
go mod tidy, thengo 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:This error is reported when automatic vendoring is enabled and
go.modis not consistent withvendor/modules.txt. Automatic vendoring is enabled if thego.modfile hasgoversion1.14or later and avendordirectory is present.go mod tidyensures that every necessary requirement appears ingo.mod.go mod vendorcopies imported packages intovendor/and updatesvendor/modules.txt.