Documentation ¶
Index ¶
- Variables
- func AddApp(l *LockFile, wd, name string) error
- func GetProjectRoot(wd string) (string, error)
- func NewLockFile(dir string, name string) error
- func NewProject(dir string, name string) error
- func UpdateLockFile(wd string, lock *LockFile) error
- type AppVersion
- type BuildConfig
- type CommandConfig
- type LockFile
- type Project
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoProject is the error returned when a project file is not // found in the current directory ErrNoProject = errors.New("failed to find project file in current path") // ErrNoGoModFile is an error signifying that a directory where // the user wants to initialise a project doesn't contain go.mod file. ErrNoGoModFile = errors.New("no go.mod file, run 'go mod init' first") )
Functions ¶
func GetProjectRoot ¶
GetProjectRoot attempts to locate the root of the mona project based on the provided working directory. The provided path is traversed in reverse and each directory is checked for the existence of a mona.yml file.
func NewLockFile ¶
NewLockFile creates a new "mona.lock" file in the current working directory using the provided name.
func NewProject ¶
NewProject creates a new "mona.yml" file in the provided directory with the given name.
func UpdateLockFile ¶
UpdateLockFile overwrites the current "mona.lock" file in the given working directory with the data provided.
Types ¶
type AppVersion ¶
type AppVersion struct { BuildHash string `yaml:"build"` TestHash string `yaml:"test"` LintHash string `yaml:"lint"` }
The AppVersion type represents individual app information as stored in the lock file.
type BuildConfig ¶
type BuildConfig struct { Env map[string]string `yaml:"env"` Flags []string `yaml:"flags"` LDFlags struct { S bool `yaml:"s"` X map[string]string `yaml:"X"` } `yaml:"ldflags"` }
func (BuildConfig) AllFlags ¶
func (bc BuildConfig) AllFlags() []string
func (BuildConfig) EnvToList ¶
func (bc BuildConfig) EnvToList() []string
EnvToList converts the Env map to list of entries in form key=value.
type CommandConfig ¶
type CommandConfig struct { Exclude []string `yaml:"exclude"` ExcludeMap map[string]bool `yaml:"-"` Env map[string]string `yaml:"env"` Flags []string `yaml:"flags"` }
func (CommandConfig) EnvToList ¶
func (cc CommandConfig) EnvToList() []string
EnvToList converts the Env map to list of entries in form key=value.
type LockFile ¶
type LockFile struct {
Apps map[string]*AppVersion `yaml:"apps,omitempty"`
}
The LockFile type represents the structure of a lock file, it stores the project name, version and the last build hashes used for each app
func LoadLockFile ¶
LoadLockFile attempts to load a lock file into memory from the provided working directory.
type Project ¶
type Project struct { Name string `yaml:"name"` // The name of the project Exclude []string `yaml:"exclude,omitempty"` // Global file patterns to ignore during hash generation Location string `yaml:"-"` // The root project directory, not set in the yaml file but set on load for convenience BinDir string `yaml:"binDir"` // Relative path from the root of the project to the directory where compiled binaries will be placed. Mod deps.Module `yaml:"-"` }
Project type represents the structure of the "mona.yml" file.
func LoadProject ¶
LoadProject attempts to read a "mona.yml" file into memory from the provided working directory