cuelang / cue

CUE has moved to https://github.com/cue-lang/cue
https://cuelang.org
Apache License 2.0
3.09k stars 171 forks source link

cmd/cue: get go create empty schema #846

Closed b4nst closed 3 years ago

b4nst commented 3 years ago

What version of CUE are you using (cue version)?

$ cue version
cue version 0.3.0-beta.6 darwin/amd64

Does this issue reproduce with the latest release?

yes

What did you do?

go mod init com.myorg/buildsystem
cue mod init com.myorg/buildsystem
go get github.com/go-task/task/v3
cue get go github.com/go-task/task/v3

What did you expect to see?

Task schema

What did you see instead?

cue.mod/gen/github.com/go-task/task/v3/taskfile/task_go_gen.cue

// Code generated by cue get go. DO NOT EDIT.

//cue:generate cue get go github.com/go-task/task/v3/taskfile

package taskfile

// Tasks represents a group of tasks
#Tasks: {[string]: null | #Task}

// Task represents a task
#Task: _
myitcv commented 3 years ago

@b4nst this is working as intended, according to the documentation cue help get go:

...
         - a type that implements MarshalJSON, UnmarshalJSON, MarshalYAML, or
          UnmarshalYAML is translated to top (_) to indicate it may be any
          value. For some Go core types for which the implementation of these
          methods is known, like time.Time, the type may be more specific.
...

The thinking being that such a method encodes "custom" encoding logic that cue get go cannot safely understand in all situations.

b4nst commented 3 years ago

Woops, guess it's a rtfm for me here! Thanks for the quick answer

cueckoo commented 3 years ago

This issue has been migrated to https://github.com/cue-lang/cue/issues/846.

For more details about CUE's migration to a new home, please see https://github.com/cue-lang/cue/issues/1078.