modfile

package
v0.8.0-0.dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dep

type Dep struct {
	Version string `json:"v"`
	Default bool   `json:"default,omitempty"`
}

type File

type File struct {
	Module   string          `json:"module"`
	Language Language        `json:"language"`
	Deps     map[string]*Dep `json:"deps,omitempty"`
	// contains filtered or unexported fields
}

func Parse

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

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

func ParseNonStrict(modfile []byte, filename string) (*File, error)

ParseNonStrict is like Parse but allows some laxity in the parsing:

  • if a module path lacks a version, it's taken from the version.
  • if a non-canonical version is used, it will be canonicalized.

The file name is used for error messages.

func (*File) DepVersions

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.

type Language

type Language struct {
	Version string `json:"version"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL