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

0.14 generates invalid cue (block quotes) #173

Closed
gregwebs opened this issue Nov 13, 2019 · 15 comments
Closed

0.14 generates invalid cue (block quotes) #173

gregwebs opened this issue Nov 13, 2019 · 15 comments

Comments

@gregwebs
Copy link

In my cue file

import (
    appsv1 "k8s.io/api/apps/v1"
    corev1 "k8s.io/api/core/v1"
)

Cue vet says

block quotes deprecated as of v0.0.11: try running `cue fmt` on the file to upgrade.:
    ./cue.mod/gen/k8s.io/api/apps/v1/generated.pb_go_gen.cue:5:1
block quotes deprecated as of v0.0.11: try running `cue fmt` on the file to upgrade.:
    ./cue.mod/gen/k8s.io/api/core/v1/generated.pb_go_gen.cue:5:1
block quotes deprecated as of v0.0.11: try running `cue fmt` on the file to upgrade.:
    ./cue.mod/gen/k8s.io/apimachinery/pkg/api/resource/generated.pb_go_gen.cue:5:1

I tried rm -r cue.mod/gen. I also tried to cue go get the packages.
If I cue fmt the code that seems to temporarily fix the problem, but eventually the formatting gets reverted.

@gregwebs
Copy link
Author

Perhaps related to the re-formatting: cue 0.14 is massively slower than 0.11 for running vet and eval. Something that completed quickly previously now takes over a minute!

@gregwebs
Copy link
Author

Actually, even my dump-yaml command is slow. My dry-run went from a few seconds to a few minutes.

@gregwebs
Copy link
Author

I down-graded to 0.12 and things are fast again.

@mpvl
Copy link
Contributor

mpvl commented Nov 13, 2019

Do you have a file with which I could reproduce the slowness so I can profile it?

@gregwebs
Copy link
Author

I can create one. Have you compared the execution speed of the new release to the old one?
BTW, I don't know if 0.13 was slow. I couldn't use it because it spat out tons of errors about the imported code.

@mpvl
Copy link
Contributor

mpvl commented Nov 14, 2019

I don't see noteworthy differences myself between the two. So it would be useful to have something that would cause this problem.

@mpvl
Copy link
Contributor

mpvl commented Nov 14, 2019

I'm a bit surprised the comments are generated back. Pre-1.14 cue get go would not convert block quotes, but that should have been addressed in 1.14. Could it be that the reversal is caused by running cue get go using an older version?

@gregwebs
Copy link
Author

I can't reproduce the slowness now, but the difference may be that I am not creating a cue.mod directory anymore, but just have a cue.mod file (which seems to be working on 0.14)

Can you reproduce the block quote issue? I am installing cue and the libs as per https://gist.github.com/gregwebs/0fe911ac02d06bf65c66b88c4293b85e

@mpvl
Copy link
Contributor

mpvl commented Nov 18, 2019

I'm at KubeCon now with intermittent availability, but will try asap.

Regarding the slowness. I would really like to find the slowness issue before the next release. Does any of your parent directories have a lot of files in them (of any type), by any chance? If that's the case it may be a regression.

@gregwebs
Copy link
Author

It is a lot easier for me to try to reproduce the slowness issue if I can get over the block quotes issue first and actually upgrade to 0.14 (but not switch to the new cue.mod directory format until this issue is properly tested).

@mpvl
Copy link
Contributor

mpvl commented Nov 22, 2019

Now KubeCon is over I'll try to give this some attention hopefully today. (I did try quickly before but didn't succeed).

@mpvl
Copy link
Contributor

mpvl commented Nov 24, 2019

I could not reproduce it with the script. I noticed that K8s recently removed some block comments in package docs, so figured that maybe we are importing different versions of k8s (e.g. if this is run in the context of a go.mod). I've indeed found that package docs were in a different code path in cue get go and were not converted yet.
I'll send out a fix imminently.

mpvl added a commit that referenced this issue Nov 24, 2019
Pass package comments through writeDoc.

Issue #173

Change-Id: Ib0438ed38012bcb15128d1315b654111285753d9
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4140
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
@mpvl
Copy link
Contributor

mpvl commented Nov 25, 2019

So to fix this you can fetch the latest K8s files or sync to tip for CUE.

@mpvl
Copy link
Contributor

mpvl commented Dec 5, 2019

The bug reported by this has been fixed.
I don' t know about the slowness issue. I have a vague suspicion about what it could have been. I have made package handling a bit more defensive as to avoid the error I think might have happened. Feel free to file a new bug for the slowness issue if it reappears.

@cueckoo
Copy link

cueckoo commented Jul 3, 2021

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

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
None yet
Projects
None yet
Development

No branches or pull requests

3 participants