Skip to content

Fails to install package with local replace directives and multiple modules #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
douglascamata opened this issue Jan 4, 2024 · 4 comments

Comments

@douglascamata
Copy link

douglascamata commented Jan 4, 2024

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 with bingo 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] [<package or binary>[@version1 or none,version2,version3...]]

Examples:
bingo get github.com/fatih/faillint
bingo get github.com/fatih/faillint@latest
bingo get github.com/fatih/faillint@v1.5.0
bingo get github.com/fatih/faillint@v1.1.0,v1.5.0
bingo get github.com/fatih/faillint@none // this will be deleted 

Options:
      --go string       Path to the go command. (default "go")
  -h, --help            help for get
      --insecure        Use -insecure flag when using 'go get'
  -l, --link            If enabled, bingo will also create soft link called <tool> that links to the current <tool>-<version> binary.
                        Use Variables.mk and variables.env if you want to be sure that what you are invoking is what is pinned.
  -n, --name string     The -n flag instructs to get binary and name it with given name instead of default,
                        so the last element of package directory. Allowed characters [A-z0-9._-]. If -n is used and no package/binary is specified,
                        bingo get will return error. If -n is used with existing binary name, copy of this binary will be done. Cannot be used with -r
  -r, --rename string   The -r flag instructs to get existing binary and rename it with given name. Allowed characters [A-z0-9._-]. 
                        If -r is used and no package/binary is specified or non existing binary name is used, bingo will return error. Cannot be used with -n.
  -t, --timeout uint    The maximum time (in minutes) to wait for each go command before killing it.
                        Set this flag to 0 to indefinitely wait on them. (default 5)

Global Flags:
  -m, --moddir string   Directory where separate modules for each binary will be maintained. 
                        Feel free to commit this directory to your VCS to bond binary versions to your project code. 
                        If the directory does not exist bingo logs and assumes a fresh project. (default ".bingo")
  -v, --verbose         Print more

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

Anything else we need to know:

The replace clauses in po-lint are replacing external packages with ones that are local to the po-lint repo. These packages are within other Go modules that live in the same repo (github.com/prometheus-operator/prometheus-operator/pkg/client and github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring).

@douglascamata douglascamata changed the title Fails to install package with local replace directives Fails to install package with local replace directives and multiple modules Jan 4, 2024
@saswatamcode
Copy link
Collaborator

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? 🤔

@douglascamata
Copy link
Author

@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)

@saswatamcode
Copy link
Collaborator

saswatamcode commented Jan 4, 2024

Ack, you're right! I guess there is some bug with local replace directives then!

@bwplotka
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants