Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

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

Closed
gregwebs opened this issue Sep 4, 2019 · 11 comments
Closed

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

gregwebs opened this issue Sep 4, 2019 · 11 comments
Labels
Documentation get go issues related to cue get go Thinking

Comments

@gregwebs
Copy link

gregwebs commented Sep 4, 2019

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
@gregwebs
Copy link
Author

gregwebs commented Sep 4, 2019

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

@mpvl
Copy link
Contributor

mpvl commented Sep 4, 2019

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.

@mpvl mpvl added the Thinking label Sep 4, 2019
@gregwebs
Copy link
Author

gregwebs commented Sep 4, 2019

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.

@mpvl
Copy link
Contributor

mpvl commented Sep 6, 2019

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.

@mpvl
Copy link
Contributor

mpvl commented Oct 8, 2019

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.

mpvl pushed a commit that referenced this issue Nov 22, 2019
see #95.  Still needs to be done for the docs in cuelang.org website.

Closes #180
#180

GitOrigin-RevId: a3cb341
Change-Id: Ib57b868660239807a6944a133e79f2e92eaab53a
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4080
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
@wtgtybhertgeghgtwtg
Copy link

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.

@anarcher
Copy link

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

@anarcher
Copy link

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

@jbdalido
Copy link

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

Confirmed

@mpvl mpvl added the get go issues related to cue get go label Jan 19, 2021
@myitcv
Copy link
Contributor

myitcv commented Jan 19, 2021

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.

@cueckoo
Copy link

cueckoo commented Jul 3, 2021

This issue has been migrated to cue-lang/cue#95.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

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

No branches or pull requests

7 participants