type Dep struct { Version string `json:"v"` Default bool `json:"default,omitempty"` }
File represents the contents of a cue.mod/module.cue file.
type File struct { Module string `json:"module"` Language *Language `json:"language,omitempty"` Deps map[string]*Dep `json:"deps,omitempty"` // contains filtered or unexported fields }
func Parse(modfile []byte, filename string) (*File, error)
Parse verifies that the module file has correct syntax. The file name is used for error messages. All dependencies must be specified correctly: with major versions in the module paths and canonical dependency versions.
func ParseLegacy(modfile []byte, filename string) (*File, error)
ParseLegacy parses the legacy version of the module file that only supports the single field "module" and ignores all other fields.
func ParseNonStrict(modfile []byte, filename string) (*File, error)
ParseNonStrict is like Parse but allows some laxity in the parsing:
The file name is used for error messages.
func (f *File) DefaultMajorVersions() map[string]string
DefaultMajorVersions returns a map from module base path to the major version that's specified as the default for that module. The caller should not modify the returned map.
func (f *File) DepVersions() []module.Version
DepVersions returns the versions of all the modules depended on by the file. The caller should not modify the returned slice.
This always returns the same value, even if the contents of f are changed. If f was not created with Parse, it returns nil.
func (f *File) Format() ([]byte, error)
Format returns a formatted representation of f in CUE syntax.
type Language struct { Version string `json:"version,omitempty"` }