You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
I have a Go+CUE project, the Go import root is github.com/isovalent/foo/operator (i.e. repo is github.com/isovalent/foo, and code is in operator subdirectory, I shall refer to any files using paths relative to the operator subdirectory).
I have created subdirectory cue.mod and cue.mod/module.cue contains the following line:
module: "github.com/isovalent/foo/operator"
I have created Go types defined in subdirectory api/v1alpha1, and I generated CUE schema for these types using the following command:
cue get go github.com/isovalent/foo/operator/api/v1alpha1
I created a CUE file pkg/template/testassets/template.cue, which contains:
Next, I tried to modify cue.mod/module.cue and append a string to the path:
module: "github.com/isovalent/foo/operator/cue"
No I got it working as expected, but it's still quite odd and very confusing. If Go source directories are used during import resolution, why is go.mod needed? I suppose this is just a bug.
The text was updated successfully, but these errors were encountered:
One thing to test is whether it is the name pkg. This used to have special meaning when we didn't have the cue.mod system yet. And it still does, but should be ignored when it finds a cue.mod directory.
It is a bit hard to piece out what your setup from the text though. Easier would be to have a txtar reproducer (can use txtar-c to create it) and/or have a tree output of your directory structure.
I have a Go+CUE project, the Go import root is
github.com/isovalent/foo/operator
(i.e. repo isgithub.com/isovalent/foo
, and code is inoperator
subdirectory, I shall refer to any files using paths relative to theoperator
subdirectory).I have created subdirectory
cue.mod
andcue.mod/module.cue
contains the following line:I have created Go types defined in subdirectory
api/v1alpha1
, and I generated CUE schema for these types using the following command:I created a CUE file
pkg/template/testassets/template.cue
, which contains:And this is what I am seeing:
I was not able to tell what is really going on, according to the docs it should find the following directory:
Having made a few guesses, I realised that it's looking in the same directory where Go types are, and there no CUE files in that directory.
I was able to confirm this by placing a dummy file
api/v1alpha1/touch.cue
:And running:
Next, I tried to modify
cue.mod/module.cue
and append a string to the path:No I got it working as expected, but it's still quite odd and very confusing. If Go source directories are used during import resolution, why is
go.mod
needed? I suppose this is just a bug.The text was updated successfully, but these errors were encountered: