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

go get or go build does not work for repo #195

Closed
rhnvrm opened this issue Apr 2, 2019 · 8 comments
Closed

go get or go build does not work for repo #195

rhnvrm opened this issue Apr 2, 2019 · 8 comments

Comments

@rhnvrm
Copy link
Contributor

rhnvrm commented Apr 2, 2019

Describe the bug
As mentioned in https://github.com/google/cel-go#install

go mod init <my-cel-app>
go build ./...

or

go get -u github.com/google/cel-go/...

Does not work and results in the following error:

go build -o myproj.bin -v
go: finding github.com/google/cel-go/interpreter/functions latest
go: finding github.com/google/cel-go/common/types latest
go: finding github.com/google/cel-go/cel latest
go: finding github.com/google/cel-go/common/types/ref latest
go: finding github.com/google/cel-go/checker/decls latest
go: finding github.com/google/cel-go/interpreter latest
go: finding github.com/google/cel-go/common latest
Fetching https://github.com?go-get=1
go: finding github.com/google/cel-go/checker latest
Parsing meta tags from https://github.com?go-get=1 (status code 200)
build company.tech/rhnvrm/myproj cannot load github.com/google/cel-go/cel: cannot find module providing package github.com/google/cel-go/cel
go get -u github.com/google/cel-go/...
...
go: github.com/golang/lint@v0.0.0-20190313153728-d0100b6bd8b3: parsing go.mod: unexpected module path "golang.org/x/lint"

To fix this for now, I have done a git clone and added a replace directive

This is my go.mod

module company.tech/rhnvrm/myproj

go 1.12

require (
	github.com/golang/protobuf v1.3.0
	github.com/google/cel-go v0.2.0
	google.golang.org/genproto v0.0.0-20190227213309-4f5b463f9597
)

replace github.com/google/cel-go v0.2.0 => ./celgo
@TristonianJones
Copy link
Collaborator

Interesting, I tried this yesterday. Will give it a look. Thanks for the report.

@lopezator
Copy link
Contributor

I think the issue isn't in cel-go itself but in:

golang/lint#436

See:

https://github.com/ory/hydra/blob/master/go.mod#L86-L87

lopezator added a commit to lopezator/cel-go that referenced this issue Apr 2, 2019
fix golang/lint issue adding a replace stanza until it gets fixed. closes google#195
@TristonianJones
Copy link
Collaborator

I did notice that the lack of a go.mod in the cel-spec repo was causing both a pinned and latest version of the deps for cel-go to be included in the go get -u ... command. I'll see pinning the deps on cel-spec helps later today.

@lopezator
Copy link
Contributor

lopezator commented Apr 2, 2019

@TristonianJones I think that installing via go get -u isn't a good practice in go modules aware project, see:

https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies

go get github.com/google/cel-go@latest or go get github.com/google/cel-go would fetch latest tag (v0.2.0).

go get github.com/google/cel-go@master would fetch latest commit.

I think that simply removing the -u flag would suffice and is the safest.

@TristonianJones
Copy link
Collaborator

Thanks for the tip. I'll update the README

@lopezator
Copy link
Contributor

If you want to add intructions for a modules install I would do:

  1. go mod init my-cel-project to initialize a go.mod file.
  2. go get github.com/google/cel-go to track the latest cel-go tag (v0.2.0) into your go.mod file.
  3. go install github.com/google/cel-go/... to install it.

@lopezator
Copy link
Contributor

lopezator commented Apr 2, 2019

Install instructions are still confusing, supposing, for example:

  1. mkdir test
  2. cd test
  3. go mod init test

a) go build ./... after go mod init test does nothing.

go: warning: "./..." matched no packages

b) go get github.com/google/cel-go/... also doesn't.

go get github.com/google/cel-go/...: no matching versions for query "latest"

@rhnvrm
Copy link
Contributor Author

rhnvrm commented Apr 3, 2019

@TristonianJones, @lopezator, thanks for solving this issue :)

Just tested it, although I think a minor release will be needed, until then in case anyone has the same problem and reaches this page, go get github.com/google/cel-go@master needs to be done to use cel-go.

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

Successfully merging a pull request may close this issue.

3 participants