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

cue get k8s.io/api/core/v1 creates an empty directory #95

Closed
cueckoo opened this issue Jul 3, 2021 · 10 comments
Closed

cue get k8s.io/api/core/v1 creates an empty directory #95

cueckoo opened this issue Jul 3, 2021 · 10 comments
Labels
Documentation get go issues related to cue get go Thinking

Comments

@cueckoo
Copy link
Collaborator

cueckoo commented Jul 3, 2021

Originally opened by @gregwebs in cuelang/cue#95

cue get go k8s.io/api/core/v1

I see a directory pkg/k8s.io/api/core/v1/, but not files in it. I was expecting to see some cue files.
The command exited with status 0.

cue version 0.0.8 linux/amd64
@cueckoo cueckoo added Documentation get go issues related to cue get go Thinking labels Jul 3, 2021
@cueckoo cueckoo closed this as completed Jul 3, 2021
@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @gregwebs in cuelang/cue#95 (comment)

I copy and pasted the get command from here: https://cuelang.org/docs/integrations/go/#download-cue-definitions-from-go

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @mpvl in cuelang/cue#95 (comment)

I believe the issue is that these respective packages need to be already locally available. So you will have to run go get <pkgs> first if this is not the case.

This is not intended behavior and it should be fixed. As far as I can tell, though, the code I would need is currently internal. I'll see with the Go team if there are any solutions. I prefer not to rely on a go binary being installed.

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @gregwebs in cuelang/cue#95 (comment)

Yes, if I go get first it does download them. We could fix this in the docs right now then.
With respect to not needing the go binary, that would be better. However, I think you are trying to take advantage of cue being written in go. If this feature were ever developed for another language you would need access to its package importer tool. So it might be a reasonable expectation.
This kind of issue can also be solved in a docker distribution version.

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @mpvl in cuelang/cue#95 (comment)

Yes, should be documented.

Note that there is a distinction between the language and the tooling. Often when a language is ported, it is only the language, and not the tooling itself. The go get functionality is part of the tooling, so I'm less worried relying on it being in Go. But good point.

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @mpvl in cuelang/cue#95 (comment)

Asked the resident expert in th Go team and there is currently no good way to do this. So we should detect the error and better document it.

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @wtgtybhertgeghgtwtg in cuelang/cue#95 (comment)

I'm seeing it working alright if GO111MODULE=on is set.

sudo rm -rf ~/go/pkg/mod/istio.io
rm -rf cue.mod/gen
GO111MODULE=on cue get go istio.io/istio/operator/pkg/apis/istio/v1alpha1
ls cue.mod/gen # Prints, among its dependencies, istio.io

Can't find a way to get it to work with specific versions, though.

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @anarcher in cuelang/cue#95 (comment)

I did go get k8s.io/api/core/v1 first, but cue get go still makes an empty directory.

$go get k8s.io/api/core/v1
go: found k8s.io/api/core/v1 in k8s.io/api v0.18.6
$cue get go k8s.io/api/core/v1
$tree
.
├── gen
│   └── k8s.io
│       └── api
│           └── core
│               └── v1
├── module.cue
├── pkg
└── usr

7 directories, 1 file

$cue version
cue version 0.3.0-alpha1 darwin/amd64

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @anarcher in cuelang/cue#95 (comment)

If go get k8s.io/api/.. with GO111MODULE=off, it works.

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @jbdalido in cuelang/cue#95 (comment)

If go get k8s.io/api/.. with GO111MODULE=off, it works.

Confirmed

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @myitcv in cuelang/cue#95 (comment)

This issue generally feels like a symptom of the the various issues I summarised in
#621 (comment). On the basis we have a clear path forward via #621 (comment), I'm going to close this issue effectively as a duplicate of #621 (preferring that issue because of the more complete commentary)

Please feel free to raise any further questions/issues over there, or in a separate issue if you think it a separate issue.

Thanks to everyone for reporting the variations that failed/succeeded - that definitely helped in diagnosing the underlying issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation get go issues related to cue get go Thinking
Projects
None yet
Development

No branches or pull requests

1 participant