package util
import "github.com/purpleidea/mgmt/lang/util"
Package util contains utility functions that are specific to the mcl language.
Index ¶
- Constants
- func FnMatch(typ *types.Type, fns []*types.FuncValue) (int, error)
- func HasDuplicateTypes(typs []*types.Type) error
- func ParseImportName(name string) (*interfaces.ImportData, error)
- func ValidateVarName(name string) error
Constants ¶
const ( // ModuleMagicPrefix is the prefix which, if found as a prefix to the // last token in an import path, will be removed silently if there are // remaining characters following the name. If this is the empty string // then it will be ignored. ModuleMagicPrefix = "mgmt-" )
Functions ¶
func FnMatch ¶
FnMatch is run to turn a polymorphic, undetermined list of functions, into a specific statically typed version. It is usually run after Unify completes. It returns the index of the matched function.
func HasDuplicateTypes ¶
HasDuplicateTypes returns an error if the list of types is not unique.
func ParseImportName ¶
func ParseImportName(name string) (*interfaces.ImportData, error)
ParseImportName parses an import name and returns the default namespace name that should be used with it. For example, if the import name was: "git://example.com/purpleidea/Module-Name", this might return an alias of "module_name". It also returns a bunch of other data about the parsed import. TODO: check for invalid or unwanted special characters
func ValidateVarName ¶
ValidateVarName returns an error if the string pattern does not match the format for a valid variable name. The leading dollar sign must not be passed in.
Source Files ¶
- Version
- v0.0.0-20250322185616-c50a578426f1 (latest)
- Published
- Mar 22, 2025
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 4 days ago –
Tools for package owners.