-
Notifications
You must be signed in to change notification settings - Fork 298
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
cmd/cue: get go panics #668
Comments
Original reply by @myitcv in cuelang/cue#668 (comment) Welcome to the CUE project, @nwidger! You have, unfortunately, hit a bit of a rough edge. And there is some history associated with The short version however is:
Which brings us on to the specifics of your case. As you are the author of this module, I will assume you actually want to provide CUE definitions alongside your Go code, so read on. If you truly intended to work with your module as a dependency, per your example above, see the heading "Using Providing CUE definitions alongside your Go codeAs you are the author of this module, you probably want to have the CUE definitions exist alongside your Go code. In which case you want to do something slightly different to the steps about (we should improve the docs here). For the record I'm using Looking at your project:
The first thing to say is that your module is not tidy:
I'd suggest that for release versions it should be, otherwise users of your module will find "extra" dependencies added to their For what follows, I've run The next thing to note is that not all of your packages compile:
This might well not be a problem in practice, but I point it out because it's a factor that is contributing to the behaviour you are seeing. Moving on to
Notice however we still get a panic. That's because of a bug described in #621 which means that error messages encountered by The invalid package in this case is the So what needs to be done here:
We are addressing the first of these two points for the next release because a number of people are being caught by this bug. We might also include a fix for the second point. In the interim, you can run With the first of those two bugs fixed, there is actually yet another bug that your example trips over that I'm still in the process of debugging. This error will also be fixed as part of the next release. So unfortunately for now I can't even provide you with a work around. Using
|
Original reply by @nwidger in cuelang/cue#668 (comment) @myitcv Thank you so much for the very detailed reply! I feel a little sheepish as while I'm grateful for your very helpful reply, to be honest I never had any real intention to use CUE with my That being said, thank you for pointing out the issues in my package. That package is basically "done" as it has essentially served it's purpose (getting data out of an old issue tracker and into a new one) and hasn't been worked on in a number of years. It seems the It looks like CUE still panics even with the
Anyway, I'm happy to try running any other experiments or to try out any fixes that might eventually surface. Just please know that I'm only playing around and not trying to get any real work done with CUE. :) |
Original reply by @myitcv in cuelang/cue#668 (comment)
Very kind of you to raise this issue. A fix for #621 is going to land shortly, but we are going to leave solving this issue until a later commit. Reason being, we need to slightly rework the way in which Go standard library packages are handled by The bug you are ultimately running into here is that With a fix for #648 we can address this trivially. |
Original reply by @vikstrous2 in cuelang/cue#668 (comment) I think I'm seeing the same issue with |
Original reply by @myitcv in cuelang/cue#668 (comment) Note to self: another good test case here is goreleaser/goreleaser#2065 |
Original reply by @PierreR in cuelang/cue#668 (comment) I believe I'm seeing the same issue with |
Confirmed that this is still an issue as of v0.4.3. |
Dropping the now-defunct v0.4.x milestone from this issue, but leaving the |
Note that I think this may be a duplicate of #2046, which was filed later, but has more recent activity. It's likely that both should be fixed by the same commit. |
Confirming as a duplicate of #2046, which got fixed by https://review.gerrithub.io/c/cue-lang/cue/+/1173100. I no longer see the panic on master. Thanks @uhthomas! |
Originally opened by @nwidger in cuelang/cue#668
What version of CUE are you using (
cue version
)?I can also reproduce the issue building from source using
master
at 9c5489f.Does this issue reproduce with the latest release?
Yes
What did you do?
I am a complete CUE newbie. I listened to the recent Go Time podcast about CUE and thought I would try seeing whether
cue get
could generate stubs from one of my own Go packages. I barely know what I'm doing, I've scanned some of the CUE documentation but otherwise have never used CUE before. It might be that I'm doing something wrong, but I figured havingcue
panic with a nil pointer dereference wasn't expected.What did you expect to see?
Successfully generate cue files based on the Go packages in
github.com/nwidger/lighthouse/...
.What did you see instead?
From what I can tell,
extractPkg
get passed anil
*packages.Package
, perhaps related to thenet/http
package. Despitecue
exploding, I do see that it generates some files:However,
github.com/nwidger/lighthouse
contains a number of sub-packages, so it looks likecue
blows up before it gets to generating .cue files for them.Please let me know if I can provide any other information!
The text was updated successfully, but these errors were encountered: