cue
cue copied to clipboard
cmd/cue: JSONMarshaler fields are ignored by `cue get go`
What version of CUE are you using (cue version)?
Tried with the latest cue master.
$ cue version
cue version v0.0.0-20241010210945-0dd7f6977d97
go version go1.23.2
-buildmode exe
-compiler gc
DefaultGODEBUG asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
CGO_ENABLED 1
GOARCH amd64
GOOS linux
GOAMD64 v1
vcs git
vcs.revision 0dd7f6977d97591ddb165b56005d98cc75d49e93
vcs.time 2024-10-10T21:09:45Z
vcs.modified false
cue.lang.version v0.11.0
Does this issue reproduce with the latest stable release?
Yes
What did you do?
exec cue get go --local .
grep field1 x_go_gen.cue
-- cue.mod/module.cue --
module: "example.test"
language: version: "v0.10.0"
-- go.mod --
module test
-- x.go --
package x
type X struct {
Field1 *Y `json:"field1"`
Field2 int `json:"field2"`
}
type Y struct {
a int
//B int
}
func (y *Y) UnmarshalJSON(data []byte) error {
return nil
}
func (y *Y) MarshalJSON() ([]byte, error) {
return []byte("true"), nil
}
What did you expect to see?
PASS
What did you see instead?
FAIL: /tmp/testscript2616510834/-/script.txtar:2: no match for `field1` found in x_go_gen.cue
Additional notes
If I uncomment the //B int line, the test passes.