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

Cannot install via go install #9327

Open
bagnaram opened this issue Feb 28, 2024 · 2 comments
Open

Cannot install via go install #9327

bagnaram opened this issue Feb 28, 2024 · 2 comments

Comments

@bagnaram
Copy link

Expected behavior

I expect to be able to install this program using go install github.com/GoogleContainerTools/skaffold/[email protected] or any version

Actual behavior

Go fails to fetch the package from the module because it is not found within a v2 directory. Everything is in a flat filesystem.

go: github.com/GoogleContainerTools/skaffold/[email protected]: module github.com/GoogleContainerTools/skaffold/[email protected] found, but does not contain package github.com/GoogleContainerTools/skaffold/v2

I expect them to be following the pattern in https://go.dev/blog/v2-go-modules

Information

  • Skaffold version: v2.10.1
  • Operating system: Linux fedora 6.7.5-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Feb 17 17:20:08 UTC 2024 x86_64 GNU/Linux
  • Installed via: go install
  • Contents of skaffold.yaml: N/A

Steps to reproduce the behavior

  1. go install github.com/GoogleContainerTools/skaffold/[email protected]
@nathanperkins
Copy link

nathanperkins commented Nov 28, 2024

I believe the command you've given is incorrect but the correct one also fails:

[hi on] nathanperkins@nathanperkins:~$ go install github.com/GoogleContainerTools/skaffold/v2/cmd/skaffold@latest
go: github.com/GoogleContainerTools/skaffold/v2/cmd/skaffold@latest (in github.com/GoogleContainerTools/skaffold/[email protected]):
        The go.mod file for the module providing named packages contains one or
        more exclude directives. It must not contain directives that would cause
        it to be interpreted differently than if it were the main module.

It seems like these exclude directives are preventing go install and go run from working correctly:

// these require code change may remove these later
exclude (
	github.com/opencontainers/image-spec v1.1.0-rc3
	github.com/opencontainers/image-spec v1.1.0-rc4
)

// Unit tests fail due to a breaking change in reference.Parse() from this version.
exclude github.com/docker/distribution v2.8.3+incompatible

// this version requires code change may remove these later
exclude go.opentelemetry.io/otel/metric v0.37.0

// doesn't work well with windows
exclude github.com/karrick/godirwalk v1.17.0

According to golang/go#44840 (comment) (comment by @rsc), directives like replace (and exclude probably) prevent go install from working correctly. Healthy go versioning ecosystem should not use them.

@nathanperkins
Copy link

For anybody who needs a quick workaround to install:

SKAFFOLD_TAG=v2.13.2
cd "$(mktemp -d)"
git clone [email protected]:GoogleContainerTools/skaffold.git --depth=1 --branch="$SKAFFOLD_TAG" .
go install ./cmd/skaffold

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

2 participants