Open douglascamata opened 6 months ago
Hmm, I think go install
also fails if the module being installed has replace/exclude directives,
$ go install github.com/prometheus-operator/prometheus-operator/cmd/po-lint@latest
go: downloading github.com/prometheus-operator/prometheus-operator v0.70.0
go: github.com/prometheus-operator/prometheus-operator/cmd/po-lint@latest (in github.com/prometheus-operator/prometheus-operator@v0.70.0):
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.
So then isn't it expected that bingo would also not be able to install it either? Or am I missing something? 🤔
@saswatamcode Bingo's README says it doesn't care about these directives:
Works with all buildable Go projects, including pre Go modules and complex projects with complex directives like replace, retract or exclude statements. (e.g Prometheus)
Ack, you're right! I guess there is some bug with local replace directives then!
Can you add those replace directives in po-lint.mod
after failed bingo get? I think they should be done automatically, but that might have failed for some reason?
bingo version
output:v0.9
go version
output:go version go1.21.5 darwin/arm64
What happened:
Tried to install the latest
po-lint
package withbingo get -v -l github.com/prometheus-operator/prometheus-operator/cmd/po-lint@latest
.What you expected to happen:
To have
po-lint
installable, even though it has a few replace clauses.How to reproduce it (as minimally and precisely as possible):
bingo get -v -l github.com/prometheus-operator/prometheus-operator/cmd/po-lint@latest
Logs (use
bingo get -v <thing you do>
for verbose output):Click to see lots of logs!
``` getting target github.com/prometheus-operator/prometheus-operator/cmd/po-lint@latest (module ) exec 'go mod init -modfile=/Users/doolivei/code/obsctl-reloader-rules-checker/.bingo/po-lint-e.tmp.mod _' exec 'go get -modfile=/Users/doolivei/code/obsctl-reloader-rules-checker/.bingo/po-lint-e.tmp.mod -d github.com/prometheus-operator/prometheus-operator/cmd/po-lint@latest' exec 'go env GOMODCACHE' resolveInGoModCache: /Users/doolivei/go/pkg/mod/cache/download/github.com/prometheus-operator/prometheus-operator/cmd/po-lint/@v directory does not exists resolveInGoModCache: /Users/doolivei/go/pkg/mod/cache/download/github.com/prometheus-operator/prometheus-operator/cmd/@v directory does not exists resolveInGoModCache: Found /Users/doolivei/go/pkg/mod/cache/download/github.com/prometheus-operator/prometheus-operator/@v directory exec 'go env GOPATH' exec 'go mod init -modfile=/Users/doolivei/code/obsctl-reloader-rules-checker/.bingo/po-lint.tmp.mod _' exec 'go list -modfile=/Users/doolivei/code/obsctl-reloader-rules-checker/.bingo/po-lint.tmp.mod -mod=mod -f={{.Name}} github.com/prometheus-operator/prometheus-operator/cmd/po-lint' Error: get: po-lint.mod: getting github.com/prometheus-operator/prometheus-operator/cmd/po-lint@latest: install: : go: github.com/prometheus-operator/prometheus-operator/cmd/po-lint imports github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1: github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring@v0.70.0: replacement directory ./pkg/apis/monitoring does not exist go: github.com/prometheus-operator/prometheus-operator/cmd/po-lint imports github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1: github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring@v0.70.0: replacement directory ./pkg/apis/monitoring does not exist go: github.com/prometheus-operator/prometheus-operator/cmd/po-lint imports github.com/prometheus-operator/prometheus-operator/pkg/admission imports github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1: github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring@v0.70.0: replacement directory ./pkg/apis/monitoring does not exist go: github.com/prometheus-operator/prometheus-operator/cmd/po-lint imports github.com/prometheus-operator/prometheus-operator/pkg/admission imports github.com/prometheus-operator/prometheus-operator/pkg/operator imports github.com/prometheus-operator/prometheus-operator/pkg/informers imports github.com/prometheus-operator/prometheus-operator/pkg/client/informers/externalversions: github.com/prometheus-operator/prometheus-operator/pkg/client@v0.70.0: replacement directory ./pkg/client does not exist go: github.com/prometheus-operator/prometheus-operator/cmd/po-lint imports github.com/prometheus-operator/prometheus-operator/pkg/admission imports github.com/prometheus-operator/prometheus-operator/pkg/operator imports github.com/prometheus-operator/prometheus-operator/pkg/informers imports github.com/prometheus-operator/prometheus-operator/pkg/client/versioned: github.com/prometheus-operator/prometheus-operator/pkg/client@v0.70.0: replacement directory ./pkg/client does not exist : error while running command 'go get -modfile=/Users/doolivei/code/obsctl-reloader-rules-checker/.bingo/po-lint.tmp.mod -d github.com/prometheus-operator/prometheus-operator/cmd/po-lint@v0.70.0'; err: exit status 1 Usage: bingo get [flags] [Anything else we need to know:
The replace clauses in
po-lint
are replacing external packages with ones that are local to thepo-lint
repo. These packages are within other Go modules that live in the same repo (github.com/prometheus-operator/prometheus-operator/pkg/client
andgithub.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring
).