Open cvvz opened 3 years ago
Logs of gopls(server) with -rpc.trace
[Trace - 14:43:49.478 PM] Sending request 'textDocument/hover - (16)'.
Params: {"textDocument":{"uri":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod"},"position":{"line":4,"character":33}}
[Trace - 14:43:49.478 PM] Received response 'textDocument/hover - (16)' in 0ms.
Result: null
[Trace - 14:43:49.632 PM] Sending request 'textDocument/codeAction - (17)'.
Params: {"textDocument":{"uri":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod"},"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":39}},"context":{"diagnostics":[{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":39}},"message":"go.sum is out of sync with go.mod. Please update it by applying the quick fix.","severity":1,"source":"go list"}],"only":["quickfix"]}}
[Trace - 14:43:49.632 PM] Received response 'textDocument/codeAction - (17)' in 0ms.
Result: [{"title":"Run go mod tidy","kind":"quickfix","diagnostics":[{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":39}},"severity":1,"source":"go list","message":"go.sum is out of sync with go.mod. Please update it by applying the quick fix."}],"edit":{},"command":{"title":"Run go mod tidy","command":"gopls.tidy","arguments":[{"URIs":["file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod","file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/hack/tools/go.mod"]}]}},{"title":"Update go.sum","kind":"quickfix","diagnostics":[{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":39}},"severity":1,"source":"go list","message":"go.sum is out of sync with go.mod. Please update it by applying the quick fix."}],"edit":{},"command":{"title":"Update go.sum","command":"gopls.update_go_sum","arguments":[{"URIs":["file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod","file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/hack/tools/go.mod"]}]}}]
[Trace - 14:43:49.632 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2021/05/09 14:43:49 diagnosing go.mod: err: exit status 1: stderr: warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-cluster\nwarning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-operator\nwarning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/manifests/gke\nwarning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-cluster\nwarning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-operator\nwarning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/manifests/gke\ngo: updates to go.sum needed, disabled by -mod=readonly\n: packages.Load error\n"}
[Error - 2:43:49 PM] 2021/05/09 14:43:49 diagnosing go.mod: err: exit status 1: stderr: warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-cluster
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-operator
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/manifests/gke
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-cluster
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-operator
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/manifests/gke
go: updates to go.sum needed, disabled by -mod=readonly
: packages.Load error
[Trace - 14:43:52.084 PM] Sending request 'textDocument/codeLens - (18)'.
Params: {"textDocument":{"uri":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod"}}
[Trace - 14:43:52.084 PM] Received response 'textDocument/codeLens - (18)' in 0ms.
Result: [{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":39}},"command":{"title":"Run go mod tidy","command":"gopls.tidy","arguments":[{"URIs":["file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod"]}]}},{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":39}},"command":{"title":"Create vendor directory","command":"gopls.vendor","arguments":[{"URI":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod"}]}},{"range":{"start":{"line":8,"character":0},"end":{"line":99,"character":1}},"command":{"title":"Check for upgrades","command":"gopls.check_upgrades","arguments":[{"URI":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod","Modules":["github.com/Azure/go-autorest/autorest/mocks","github.com/BurntSushi/toml","github.com/MakeNowJust/heredoc","github.com/Masterminds/semver","github.com/Microsoft/go-winio","github.com/NYTimes/gziphandler","github.com/aws/aws-sdk-go","github.com/chai2010/gettext-go","github.com/codahale/hdrhistogram","github.com/coreos/etcd","github.com/docker/docker","github.com/docker/go-connections","github.com/docker/spdystream","github.com/dsnet/compress","github.com/dustin/go-humanize","github.com/elazarl/goproxy","github.com/elazarl/goproxy/ext","github.com/emicklei/go-restful","github.com/fatih/color","github.com/ghodss/yaml","github.com/go-openapi/spec","github.com/go-sql-driver/mysql","github.com/gogo/protobuf","github.com/golang/groupcache","github.com/golang/snappy","github.com/google/go-cmp","github.com/google/gofuzz","github.com/gophercloud/gophercloud","github.com/gregjones/httpcache","github.com/grpc-ecosystem/go-grpc-middleware","github.com/grpc-ecosystem/grpc-gateway","github.com/imdario/mergo","github.com/juju/errors","github.com/juju/loggo","github.com/juju/testing","github.com/mholt/archiver","github.com/minio/minio-go/v6","github.com/mohae/deepcopy","github.com/nwaples/rardecode","github.com/onsi/ginkgo","github.com/onsi/gomega","github.com/openshift/generic-admission-server","github.com/opentracing/opentracing-go","github.com/pierrec/lz4","github.com/pingcap/advanced-statefulset/client","github.com/pingcap/check","github.com/pingcap/errors","github.com/pingcap/kvproto","github.com/pingcap/tidb","github.com/prometheus/client_golang","github.com/prometheus/client_model","github.com/prometheus/common","github.com/prometheus/prom2json","github.com/prometheus/prometheus","github.com/robfig/cron","github.com/sirupsen/logrus","github.com/soheilhy/cmux","github.com/spf13/cobra","github.com/spf13/pflag","github.com/tikv/pd","github.com/tmc/grpc-websocket-proxy","github.com/uber-go/atomic","github.com/uber/jaeger-client-go","github.com/uber/jaeger-lib","github.com/xi2/xz","github.com/xiang90/probing","github.com/yisaer/crd-validation","gocloud.dev","golang.org/x/sync","golang.org/x/time","gomodules.xyz/jsonpatch/v2","gopkg.in/mgo.v2","gopkg.in/yaml.v2","k8s.io/api","k8s.io/apiextensions-apiserver","k8s.io/apimachinery","k8s.io/apiserver","k8s.io/cli-runtime","k8s.io/client-go","k8s.io/code-generator","k8s.io/component-base","k8s.io/klog","k8s.io/kube-aggregator","k8s.io/kube-openapi","k8s.io/kubectl","k8s.io/kubernetes","k8s.io/utils","sigs.k8s.io/apiserver-builder-alpha/cmd","sigs.k8s.io/controller-runtime","sigs.k8s.io/yaml"]}]}},{"range":{"start":{"line":8,"character":0},"end":{"line":99,"character":1}},"command":{"title":"Upgrade transitive dependencies","command":"gopls.upgrade_dependency","arguments":[{"URI":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod","GoCmdArgs":["-d","-u","-t","./..."],"AddRequire":false}]}},{"range":{"start":{"line":8,"character":0},"end":{"line":99,"character":1}},"command":{"title":"Upgrade direct dependencies","command":"gopls.upgrade_dependency","arguments":[{"URI":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod","GoCmdArgs":["-d","github.com/Azure/go-autorest/autorest/mocks","github.com/BurntSushi/toml","github.com/MakeNowJust/heredoc","github.com/Masterminds/semver","github.com/Microsoft/go-winio","github.com/NYTimes/gziphandler","github.com/aws/aws-sdk-go","github.com/chai2010/gettext-go","github.com/codahale/hdrhistogram","github.com/coreos/etcd","github.com/docker/docker","github.com/docker/go-connections","github.com/docker/spdystream","github.com/dsnet/compress","github.com/dustin/go-humanize","github.com/elazarl/goproxy","github.com/elazarl/goproxy/ext","github.com/emicklei/go-restful","github.com/fatih/color","github.com/ghodss/yaml","github.com/go-openapi/spec","github.com/go-sql-driver/mysql","github.com/gogo/protobuf","github.com/golang/groupcache","github.com/golang/snappy","github.com/google/go-cmp","github.com/google/gofuzz","github.com/gophercloud/gophercloud","github.com/gregjones/httpcache","github.com/grpc-ecosystem/go-grpc-middleware","github.com/grpc-ecosystem/grpc-gateway","github.com/imdario/mergo","github.com/juju/errors","github.com/juju/loggo","github.com/juju/testing","github.com/mholt/archiver","github.com/minio/minio-go/v6","github.com/mohae/deepcopy","github.com/nwaples/rardecode","github.com/onsi/ginkgo","github.com/onsi/gomega","github.com/openshift/generic-admission-server","github.com/opentracing/opentracing-go","github.com/pierrec/lz4","github.com/pingcap/advanced-statefulset/client","github.com/pingcap/check","github.com/pingcap/errors","github.com/pingcap/kvproto","github.com/pingcap/tidb","github.com/prometheus/client_golang","github.com/prometheus/client_model","github.com/prometheus/common","github.com/prometheus/prom2json","github.com/prometheus/prometheus","github.com/robfig/cron","github.com/sirupsen/logrus","github.com/soheilhy/cmux","github.com/spf13/cobra","github.com/spf13/pflag","github.com/tikv/pd","github.com/tmc/grpc-websocket-proxy","github.com/uber-go/atomic","github.com/uber/jaeger-client-go","github.com/uber/jaeger-lib","github.com/xi2/xz","github.com/xiang90/probing","github.com/yisaer/crd-validation","gocloud.dev","golang.org/x/sync","golang.org/x/time","gomodules.xyz/jsonpatch/v2","gopkg.in/mgo.v2","gopkg.in/yaml.v2","k8s.io/api","k8s.io/apiextensions-apiserver","k8s.io/apimachinery","k8s.io/apiserver","k8s.io/cli-runtime","k8s.io/client-go","k8s.io/code-generator","k8s.io/component-base","k8s.io/klog","k8s.io/kube-aggregator","k8s.io/kube-openapi","k8s.io/kubectl","k8s.io/kubernetes","k8s.io/utils","sigs.k8s.io/apiserver-builder-alpha/cmd","sigs.k8s.io/controller-runtime","sigs.k8s.io/yaml"],"AddRequire":false}]}}]
[Trace - 14:43:54.868 PM] Sending request 'workspace/executeCommand - (19)'.
Params: {"command":"gopls.update_go_sum","arguments":[{"URIs":["file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod","file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/hack/tools/go.mod"]}]}
[Trace - 14:43:54.869 PM] Received request 'window/workDoneProgress/create - (6)'.
Params: {"token":"6129484611666145821"}
[Trace - 14:43:54.869 PM] Sending response 'window/workDoneProgress/create - (6)' in 0ms.
Result:
[Trace - 14:43:54.869 PM] Received notification '$/progress'.
Params: {"token":"6129484611666145821","value":{"kind":"begin","title":"Updating go.sum","cancellable":true,"message":"Running..."}}
[Trace - 14:43:55.116 PM] Sending request 'textDocument/codeLens - (20)'.
Params: {"textDocument":{"uri":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod"}}
[Trace - 14:43:56.212 PM] Received notification '$/progress'.
Params: {"token":"6129484611666145821","value":{"kind":"end","message":"completed"}}
[Trace - 14:43:56.212 PM] Received response 'workspace/executeCommand - (19)' in 1344ms.
Result: null
[Trace - 14:43:56.213 PM] Received response 'textDocument/codeLens - (20)' in 1096ms.
Result: [{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":39}},"command":{"title":"Run go mod tidy","command":"gopls.tidy","arguments":[{"URIs":["file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod"]}]}},{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":39}},"command":{"title":"Create vendor directory","command":"gopls.vendor","arguments":[{"URI":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod"}]}},{"range":{"start":{"line":8,"character":0},"end":{"line":99,"character":1}},"command":{"title":"Check for upgrades","command":"gopls.check_upgrades","arguments":[{"URI":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod","Modules":["github.com/Azure/go-autorest/autorest/mocks","github.com/BurntSushi/toml","github.com/MakeNowJust/heredoc","github.com/Masterminds/semver","github.com/Microsoft/go-winio","github.com/NYTimes/gziphandler","github.com/aws/aws-sdk-go","github.com/chai2010/gettext-go","github.com/codahale/hdrhistogram","github.com/coreos/etcd","github.com/docker/docker","github.com/docker/go-connections","github.com/docker/spdystream","github.com/dsnet/compress","github.com/dustin/go-humanize","github.com/elazarl/goproxy","github.com/elazarl/goproxy/ext","github.com/emicklei/go-restful","github.com/fatih/color","github.com/ghodss/yaml","github.com/go-openapi/spec","github.com/go-sql-driver/mysql","github.com/gogo/protobuf","github.com/golang/groupcache","github.com/golang/snappy","github.com/google/go-cmp","github.com/google/gofuzz","github.com/gophercloud/gophercloud","github.com/gregjones/httpcache","github.com/grpc-ecosystem/go-grpc-middleware","github.com/grpc-ecosystem/grpc-gateway","github.com/imdario/mergo","github.com/juju/errors","github.com/juju/loggo","github.com/juju/testing","github.com/mholt/archiver","github.com/minio/minio-go/v6","github.com/mohae/deepcopy","github.com/nwaples/rardecode","github.com/onsi/ginkgo","github.com/onsi/gomega","github.com/openshift/generic-admission-server","github.com/opentracing/opentracing-go","github.com/pierrec/lz4","github.com/pingcap/advanced-statefulset/client","github.com/pingcap/check","github.com/pingcap/errors","github.com/pingcap/kvproto","github.com/pingcap/tidb","github.com/prometheus/client_golang","github.com/prometheus/client_model","github.com/prometheus/common","github.com/prometheus/prom2json","github.com/prometheus/prometheus","github.com/robfig/cron","github.com/sirupsen/logrus","github.com/soheilhy/cmux","github.com/spf13/cobra","github.com/spf13/pflag","github.com/tikv/pd","github.com/tmc/grpc-websocket-proxy","github.com/uber-go/atomic","github.com/uber/jaeger-client-go","github.com/uber/jaeger-lib","github.com/xi2/xz","github.com/xiang90/probing","github.com/yisaer/crd-validation","gocloud.dev","golang.org/x/sync","golang.org/x/time","gomodules.xyz/jsonpatch/v2","gopkg.in/mgo.v2","gopkg.in/yaml.v2","k8s.io/api","k8s.io/apiextensions-apiserver","k8s.io/apimachinery","k8s.io/apiserver","k8s.io/cli-runtime","k8s.io/client-go","k8s.io/code-generator","k8s.io/component-base","k8s.io/klog","k8s.io/kube-aggregator","k8s.io/kube-openapi","k8s.io/kubectl","k8s.io/kubernetes","k8s.io/utils","sigs.k8s.io/apiserver-builder-alpha/cmd","sigs.k8s.io/controller-runtime","sigs.k8s.io/yaml"]}]}},{"range":{"start":{"line":8,"character":0},"end":{"line":99,"character":1}},"command":{"title":"Upgrade transitive dependencies","command":"gopls.upgrade_dependency","arguments":[{"URI":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod","GoCmdArgs":["-d","-u","-t","./..."],"AddRequire":false}]}},{"range":{"start":{"line":8,"character":0},"end":{"line":99,"character":1}},"command":{"title":"Upgrade direct dependencies","command":"gopls.upgrade_dependency","arguments":[{"URI":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod","GoCmdArgs":["-d","github.com/Azure/go-autorest/autorest/mocks","github.com/BurntSushi/toml","github.com/MakeNowJust/heredoc","github.com/Masterminds/semver","github.com/Microsoft/go-winio","github.com/NYTimes/gziphandler","github.com/aws/aws-sdk-go","github.com/chai2010/gettext-go","github.com/codahale/hdrhistogram","github.com/coreos/etcd","github.com/docker/docker","github.com/docker/go-connections","github.com/docker/spdystream","github.com/dsnet/compress","github.com/dustin/go-humanize","github.com/elazarl/goproxy","github.com/elazarl/goproxy/ext","github.com/emicklei/go-restful","github.com/fatih/color","github.com/ghodss/yaml","github.com/go-openapi/spec","github.com/go-sql-driver/mysql","github.com/gogo/protobuf","github.com/golang/groupcache","github.com/golang/snappy","github.com/google/go-cmp","github.com/google/gofuzz","github.com/gophercloud/gophercloud","github.com/gregjones/httpcache","github.com/grpc-ecosystem/go-grpc-middleware","github.com/grpc-ecosystem/grpc-gateway","github.com/imdario/mergo","github.com/juju/errors","github.com/juju/loggo","github.com/juju/testing","github.com/mholt/archiver","github.com/minio/minio-go/v6","github.com/mohae/deepcopy","github.com/nwaples/rardecode","github.com/onsi/ginkgo","github.com/onsi/gomega","github.com/openshift/generic-admission-server","github.com/opentracing/opentracing-go","github.com/pierrec/lz4","github.com/pingcap/advanced-statefulset/client","github.com/pingcap/check","github.com/pingcap/errors","github.com/pingcap/kvproto","github.com/pingcap/tidb","github.com/prometheus/client_golang","github.com/prometheus/client_model","github.com/prometheus/common","github.com/prometheus/prom2json","github.com/prometheus/prometheus","github.com/robfig/cron","github.com/sirupsen/logrus","github.com/soheilhy/cmux","github.com/spf13/cobra","github.com/spf13/pflag","github.com/tikv/pd","github.com/tmc/grpc-websocket-proxy","github.com/uber-go/atomic","github.com/uber/jaeger-client-go","github.com/uber/jaeger-lib","github.com/xi2/xz","github.com/xiang90/probing","github.com/yisaer/crd-validation","gocloud.dev","golang.org/x/sync","golang.org/x/time","gomodules.xyz/jsonpatch/v2","gopkg.in/mgo.v2","gopkg.in/yaml.v2","k8s.io/api","k8s.io/apiextensions-apiserver","k8s.io/apimachinery","k8s.io/apiserver","k8s.io/cli-runtime","k8s.io/client-go","k8s.io/code-generator","k8s.io/component-base","k8s.io/klog","k8s.io/kube-aggregator","k8s.io/kube-openapi","k8s.io/kubectl","k8s.io/kubernetes","k8s.io/utils","sigs.k8s.io/apiserver-builder-alpha/cmd","sigs.k8s.io/controller-runtime","sigs.k8s.io/yaml"],"AddRequire":false}]}}]
[Trace - 14:43:56.216 PM] Sending request 'textDocument/codeAction - (21)'.
Params: {"textDocument":{"uri":"file:///Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/go.mod"},"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"context":{"diagnostics":[]}}
[Trace - 14:43:56.216 PM] Received response 'textDocument/codeAction - (21)' in 0ms.
Result: null
Thank you for the report. I agree that this is probably a dupe of #44097, but the resolution there was to improve the quick fix. Perhaps it needs more refinement, so let's keep this open.
but I can't fix it unless I delete one of the them.
It should be possible to fix this error without deleting one of the modules. Do you get a quick fix on the module
directive of either go.mod
file; if so, does running it resolve the error? Does running go mod tidy
in both modules resolve the error?
Do you get a quick fix on the
module
directive of eithergo.mod
file; if so, does running it resolve the error? Does runninggo mod tidy
in both modules resolve the error?
I do see a quick fix
prompt in go.mod
, which indicates me to Update go.sum
or Run go mod tidy
to fix. But they doesn't work. Both meet the error below:
Error loading workspace: err: exit status 1: stderr:
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-cluster
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-operator
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/manifests/gke
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-cluster
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/charts/tidb-operator
warning: ignoring symlink /Users/chenweizhi/go/src/github.com/pingcap/tidb-operator/deploy/gcp/manifests/gke
go: updates to go.sum needed, disabled by -mod=readonly : packages.Load error
I do see a quick fix prompt in go.mod, which indicates me to Update go.sum or Run go mod tidy to fix. But they doesn't work. Both meet the error below:
For what it's worth, that's not the error from the tidy command. The code lenses to fix the error should still work. I see from your logs that you ran the gopls.update_go_sum
command, and that it didn't generate any edits. This does indeed look like a bug. We'll try to reproduce and fix, but this code is likely to change significantly soon anyway, with various proposals to support multi-module workspaces from the go command.
For completeness, did you try running the Run go mod tidy
lens as well?
And what about tidying your modules manually from the command line (i.e. running go mod tidy
from each module). Does that fix your workspace?
For completeness, did you try running the Run go mod tidy lens as well?
Yep, I tried but didn't work.
And what about tidying your modules manually from the command line (i.e. running go mod tidy from each module). Does that fix your workspace?
Also didn't work.
This does indeed look like a bug. We'll try to reproduce and fix, but this code is likely to change significantly soon anyway, with various proposals to support multi-module workspaces from the go command.
I really look forward to it! Currently, this bug can be reproduced in any project including mutiple go modules, such as Kubernetes.
I was able to reproduce this using the repository in the logs above (it is public): https://github.com/pingcap/tidb-operator. The go.mod
file has a lot of replace directives, and it's possible we made a mistake in generating the gopls.mod
or something conflicts with the other go.mod
file: https://github.com/pingcap/tidb-operator/blob/master/hack/tools/go.mod.
I've spent some time investigating this and haven't fully understood it yet. I've been running some go list
commands from the "workspace directory" to understand what could be going wrong. See https://gist.github.com/stamblerre/35fbb9653fba64c872e79f7ace8ef717. I would guess that we are making some mistake when generating the go.sum
file, but I can't understand what it is.
A good next step would be to reproduce this with the go.work
proposal. Let's revisit this issue if that proposal is accepted--unassigning myself for now.
I would expect this to be resolved now when using go.work.
how to fix it? I have same problem
@strugglehonor are you using experimentalWorkspaceModule
? Can you please disable it and try using a go.work
file with go 1.18, following the guide here?
https://github.com/golang/tools/blob/master/gopls/doc/workspace.md#go-workspaces-go-118
@strugglehonor @findleyr go.work is almost the perfect solution for multiple modules and I've used it with gopls and VSCode for about 1 month, although sometimes packages with different version may conflict which is acceptable for me.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
The issue I encountered may be the same as https://github.com/golang/go/issues/44097. VSCode settings for gopls:
There are 2 go modules in my project, and VS Code prompt that
go.sum is out of sync with go.mod. Please update it by applying the quick fix.
, but I can't fix it unless I delete one of the them.What did you expect to see?
Figure it out and fix this problem in a graceful way.