Module "..." found, but does not contain package "..."

Hello i am trying to create new metricbeat module for my self improvement. This is my pr. As you can see i get trouble with all at of tests. Some of them are mage check errors.

Error: ../../../../go/pkg/mod/github.com/docker/docker@v25.0.4+incompatible/pkg/ioutils/readers.go:14:2: no required module provides package github.com/containerd/log; to add it:
	go get github.com/containerd/log
# github.com/elastic/elastic-agent-autodiscover/kubernetes
Error: ../../../../go/pkg/mod/github.com/elastic/elastic-agent-autodiscover@v0.6.8/kubernetes/types.go:114:40: undefined: policyv1beta1.PodSecurityPolicy
Error: ../../../../go/pkg/mod/github.com/elastic/elastic-agent-autodiscover@v0.6.8/kubernetes/informer.go:289:33: client.PolicyV1beta1().PodSecurityPolicies undefined (type "k8s.io/client-go/kubernetes/typed/policy/v1beta1".PolicyV1beta1Interface has no field or method PodSecurityPolicies)
Error: failed running go vet, please fix the issues reported: running "go vet ./..." failed with exit code 1
make[1]: *** [scripts/Makefile:153: check] Error 1
make[1]: Leaving directory '/home/runner/work/beats/beats/libbeat'
make: *** [Makefile:94: check] Error 1
Error: Process completed with exit code 2.

This is one of my code's error. When i trying to solve this problem first i type go get github.com/containerd/log
Then i run mage check.

Error parsing magefiles: error running "go list -f {{.Dir}}||{{.Name}} github.com/elastic/beats/v7/dev-tools/mage/target/common": exit status 1
no required module provides package github.com/elastic/beats/v7/dev-tools/mage/target/common; to add it:
	go get github.com/elastic/beats/v7/dev-tools/mage/target/common

This is the new error that i get. This time i run go get github.com/elastic/beats/v7/dev-tools/mage/target/common
Then again run mage check. This time i get following error:

Error parsing magefiles: error running "go list -f {{.Dir}}||{{.Name}} github.com/elastic/beats/v7/dev-tools/mage/target/integtest/docker": exit status 1
no required module provides package github.com/elastic/beats/v7/dev-tools/mage/target/integtest/docker; to add it:
	go get github.com/elastic/beats/v7/dev-tools/mage/target/integtest/docker

If i run go get github.com/elastic/beats/v7/dev-tools/mage/target/integtest/docker command. This is the error that i get.

go: module github.com/elastic/beats/v7@upgrade found (v7.17.18), but does not contain package github.com/elastic/beats/v7/dev-tools/mage/target/integtest/docker

I tried to add this module manual in go.mod file but when i did this i get this error

Error determining list of magefiles: listing mage files: failed to list gofiles tagged with "mage": exit status 1: go: errors parsing go.mod:
go.mod:21:2: require github.com/elastic/beats/v7/dev-tools/mage/target/integtest/docker: version "v7.17.18" invalid: should be v0 or v1, not v7

I really don't know how to solve this problem can you please help with some of steps?

I also researching this topic and stuck here,
I look up the package not found in new version from:
pkg.go.dev/github.com/elastic/beats/v7

I guess maybe need mapping correct version to get module and now I was keep find it.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.