loud-nightfall-4213
10/24/2023, 12:29 AMgo.mod
(odd because it was working before)
packages.Load error: err: exit status 1: stderr: go: updates to go.mod needed, disabled by -mod=readonly; to update it:
go mod tidy
When I try and run go mod tidy
as suggested, I get the error:
go: finding module for package github.com/myorg/models.v1
The <http://github.com/myorg/models.v1|github.com/myorg/models.v1>
is a path to our protobuf definitions within the repo. Thoughts? Note, I can run pants cmds, etc outside of VSCode just fine, no issues. I feel like I’ve tried everything but no luck.wide-midnight-78598
10/24/2023, 12:35 AMloud-nightfall-4213
10/24/2023, 4:49 PMgo mod tidy
(see screenshot below); the path to my go.mod
file is known within the IDE. But, running tidy
on the go.mod
is really not possible. That is, when I run:
go mod tidy
go: finding module for package github.com/astro/o11y/models.v1
It tries to fetch the module <http://github.com/astro/o11y/model.v1|github.com/astro/o11y/model.v1>
which is defined within the monorepo under src/proto/o11y/v1
(I did generate the protobuf locally using pants export-codegen src/proto::
).loud-nightfall-4213
10/25/2023, 9:53 PMwide-midnight-78598
10/25/2023, 9:56 PMloud-nightfall-4213
10/25/2023, 10:44 PMloud-nightfall-4213
10/25/2023, 10:54 PMwide-midnight-78598
10/26/2023, 5:43 AMloud-nightfall-4213
10/26/2023, 11:06 PMgo mod tidy
to work with my go.mod
file and the generated proto
classes using pants within VSCode (outside all worked great). So yeah, it was IDE related (as you pointed out) but also had to make some minor adjustments to allow for code completion, remove errors etc. This might be helpful for others using pants + go + proto with VSCode. I can write down my steps on how I got this all working?wide-midnight-78598
10/27/2023, 12:50 AMloud-nightfall-4213
10/27/2023, 7:02 PMloud-nightfall-4213
01/09/2024, 12:11 AMpackages.Load
error (as mentioned above):
1. In our go.mod
file within our go module, we added:
require github.com/astro/o11y/models.v1 v0.0.0-00010101000000-000000000000
replace github.com/astro/o11y/models.v1 v0.0.0-00010101000000-000000000000 => path/to/o11y/dist/codegen/src/proto/o11y/v1
2. Under path/to/o11y/dist/codegen/src/proto/o11y/v1
, we added the following go.mod
module github.com/astro/o11y/models.v1
go 1.21.2
3. Then, we were able to run go mod tidy
successfullyloud-nightfall-4213
01/09/2024, 12:13 AMloud-nightfall-4213
01/09/2024, 12:14 AMwide-midnight-78598
01/09/2024, 12:25 AM