Skip to content
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

[BUG] replace directive prevents installation of [email protected] from source #862

Closed
shanduur opened this issue Nov 6, 2024 · 3 comments

Comments

@shanduur
Copy link

shanduur commented Nov 6, 2024

System info:

  • OS: Linux

Describe the bug
Replace directive prevents installation of [email protected] from source. Caused by #840, noticed via registry-operator/registry-operator#43

To Reproduce

go mod init example.com/foo

go get golang.stackrox.io/[email protected]
go get sigs.k8s.io/[email protected]

mkdir -p hack
cat > hack/tools.go <<EOF
package tools

import _ "golang.stackrox.io/kube-linter/cmd/kube-linter"
EOF

cat > main.go <<EOF
package main

import _ "sigs.k8s.io/controller-runtime/pkg/client"
EOF

go mod tidy

GOBIN=$(pwd)/bin go install golang.stackrox.io/kube-linter/cmd/[email protected]

Output:

go: golang.stackrox.io/kube-linter/cmd/[email protected] (in golang.stackrox.io/[email protected]):
	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.

Sample YAML input
N/A

Expected behavior
No errors.

Screenshots
N/A

Additional context
N/A

@shanduur shanduur changed the title [BUG] replace directive prevents installation of kube-linter from source [BUG] replace directive prevents installation of [email protected] from source Nov 6, 2024
@mtovino-cloudflare
Copy link

I am seeing this as well from both macOS and Linux. Temporarily worked around by pinning to v0.6.8

@mtovino-cloudflare
Copy link

JQMY6NK065:magic-cloud mtovino$ GOOS= GOARCH= go install golang.stackrox.io/kube-linter/cmd/[email protected]
JQMY6NK065:magic-cloud mtovino$ echo $?
0
JQMY6NK065:magic-cloud mtovino$ GOOS= GOARCH= go install golang.stackrox.io/kube-linter/cmd/kube-linter@latest
go: downloading golang.stackrox.io/kube-linter v0.7.0
go: golang.stackrox.io/kube-linter/cmd/kube-linter@latest (in golang.stackrox.io/[email protected]):
	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.
JQMY6NK065:magic-cloud mtovino$ GOOS= GOARCH= go install golang.stackrox.io/kube-linter/cmd/[email protected]
go: golang.stackrox.io/kube-linter/cmd/[email protected] (in golang.stackrox.io/[email protected]):
	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.
JQMY6NK065:magic-cloud mtovino$ 

@rhybrillou
Copy link
Contributor

The replace directive was removed from go.mod, and v0.7.1 was released with the fix.

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