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

fix go install CLI #38

Closed
lkingland opened this issue Jul 16, 2020 · 1 comment
Closed

fix go install CLI #38

lkingland opened this issue Jul 16, 2020 · 1 comment
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@lkingland
Copy link
Member

go install of the CLI currently fails when run from outside the project directory:

$ go install github.com/boson-project/faas/cmd/faas
src/github.com/boson-project/faas/knative/deployer.go:11:2: cannot find package "knative.dev/client/pkg/kn/core" in any of:
        /usr/lib/go/src/knative.dev/client/pkg/kn/core (from $GOROOT)
        /home/drekar/go/src/knative.dev/client/pkg/kn/core (from $GOPATH)
src/github.com/boson-project/faas/knative/describer.go:9:2: cannot find package "knative.dev/eventing/pkg/apis/eventing/v1alpha1" in any of:
        /usr/lib/go/src/knative.dev/eventing/pkg/apis/eventing/v1alpha1 (from $GOROOT)
        /home/drekar/go/src/knative.dev/eventing/pkg/apis/eventing/v1alpha1 (from $GOPATH)
src/github.com/boson-project/faas/knative/describer.go:10:2: cannot find package "knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1alpha1" in any of:
        /usr/lib/go/src/knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1alpha1 (from $GOROOT)
        /home/drekar/go/src/knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1alpha1 (from $GOPATH

This is likely due to the knative.dev dependency therein not being based on go modules, but may be a different cause. One way to solve this may be to update the knative client dependency to the latest, which I believe are now go modules.

This does not affect standard builds from the repo root (where the go.mod and go.sum files are used

@lkingland lkingland added the kind/bug Categorizes issue or PR as related to a bug. label Aug 6, 2020
@lkingland
Copy link
Member Author

lkingland commented Sep 4, 2020

My expected behavior of the command go install command is currently an active proposal in the Go community. The design document is also available. tl;dr go install does not behave as expected after the introduciton of go modules. It will soon install a package globally into a user's PATH, ignoring any locally-available go module, with go get remaining locally module-aware.

From the issue that spawned the discussion, the workaround is:

# From outside a go module, one can run:
GO111MODULE=on go get foo.com/cmd/bar

This is only a partial solution, because running go get from within a go module adds the dependencies of the referenced module to the local .go.mod.

The purpose of this issue was to fix a problem which precluded adding go install github.com/boson-project/faas/cmd/faas as a valid installation option to our documentation.

Since this above workaround of using go get exhibits potentially unexpected behavior depending on whether or or not it is run from within a go module, we should simply wait for the proposed change to the go install behavior referenced above, and avoid adding this installation method to our documentation.

@lkingland lkingland self-assigned this Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

1 participant