Documentation
¶
Overview ¶
---------------------------------------------------------------------------- General utilities for handling collections ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about the configuration of Aldev ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about cancelable contexts, to help gracefully stop some processes ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about local deployment with Containers / Kubernetes / Tilt ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about local deployment without Containers / Kubernetes / Tilt ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about downloading external resources ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about file manipulations ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about handling HTTP requests ----------------------------------------------------------------------------
---------------------------------------------------------------------------- Downloading translations from a Google sheet into a local, structured file ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about logging in the shell ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about running stuff in parallel ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about executing shell commands ----------------------------------------------------------------------------
---------------------------------------------------------------------------- Creates the required symlinks, if missing ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about building files from templates, and Aldev config ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is responsible for fetching source code and copy-pasting it into our project, as configured ----------------------------------------------------------------------------
Index ¶
- Constants
- func CreateMissingSymlinks(ctx CancelableContext)
- func Debug(str string, params ...any)
- func DeployToLocalCluster(ctx CancelableContext)
- func DeployWithNoContainer(ctx CancelableContext)
- func DirExists(dirPaths ...string) (string, bool)
- func DownloadExternalResources(ctx CancelableContext)
- func EnsureConfigmap()
- func EnsureDir(ctx CancelableContext, pathElem ...string) string
- func EnsureFileFromTemplate(filepath, tpl string, params ...any)
- func EnsureNoDir(ctx CancelableContext, pathElem ...string) string
- func Error(str string, params ...any)
- func ErrorAndCancel(ctx CancelableContext, str string, params ...any)
- func Fatal(ctx CancelableContext, str string, params ...any)
- func FatalErr(ctx CancelableContext, err error)
- func FatalIfErr(ctx CancelableContext, err error)
- func FileExists(dirPaths ...string) (string, bool)
- func GenerateDeployConfigs(ctx CancelableContext, dockerAllowed bool)
- func GetBinDir() string
- func GetConfigPath() string
- func GetGoSrcDir() string
- func InSlice[V comparable](s []V, el V) bool
- func Info(str string, params ...any)
- func InitAldevContext(waitTimeMs int, stopFn func()) *aldevContext
- func InstallGitHooks(ctx CancelableContext)
- func IsDevAPI() bool
- func IsDevLibrary() bool
- func IsDevNative() bool
- func IsDevWebApp() bool
- func IsLinux() bool
- func IsWindows() bool
- func MapFn[T any, U any](slice []T, fn func(T) U) []U
- func NewBaseContext() *baseCancelableContext
- func QuickRun(whyRunThis string, commandAsString string, params ...any)
- func ReadConfig(cfgFileName string)
- func ReadFile(ctx CancelableContext, filename string, failIfNotExist bool) []byte
- func ReadFileToJson[T any, Y *T](ctx CancelableContext, filename string, obj Y, failIfNotExist bool) Y
- func Recover(ctx CancelableContext, msg string, params ...any)
- func ReplaceInFile(ctx CancelableContext, filename string, replacements map[string]string)
- func Run(whyRunThis string, ctx CancelableContext, logStart bool, ...)
- func RunAndGet(whyRunThis string, execDir string, logStart bool, commandAsString string, ...) []byte
- func RunJobs(aldevCtx CancelableContext, parallel bool)
- func SetVerbose(isVerbose bool)
- func Step(str string, params ...any)
- func StepWithPreamble(preamble, str string, params ...any)
- func UseCodeSwaps()
- func Warn(str string, params ...any)
- func WatcherFor(filepaths ...string) *fsnotify.Watcher
- func WriteBytesToFile(ctx CancelableContext, filename string, bytes []byte)
- func WriteJsonObjToFile(ctx CancelableContext, filename string, obj any)
- func WriteStringToFile(ctx CancelableContext, filename string, content string, params ...any)
- type AldevConfig
- type AldevContext
- type AldevTask
- type CancelableContext
- type CmdConfig
- type CodeSwapsConfig
- type I18nConfig
- type JobConfig
- type SymlinkConfig
- type VendorConfig
Constants ¶
const AldevCacheDirENVVAR = "ALDEV_CACHEDIR"
const (
TagHOTSWAPPED = "___HOTSWAPPED___"
)
Variables ¶
This section is empty.
Functions ¶
func CreateMissingSymlinks ¶
func CreateMissingSymlinks(ctx CancelableContext)
Checks if the required symlinks exist, else creates them
func DeployToLocalCluster ¶
func DeployToLocalCluster(ctx CancelableContext)
func DeployWithNoContainer ¶
func DeployWithNoContainer(ctx CancelableContext)
func DownloadExternalResources ¶
func DownloadExternalResources(ctx CancelableContext)
Downloading external resources, like translations, vendors, etc
func EnsureConfigmap ¶
func EnsureConfigmap()
Making sure we have a ConfigMap to pass to K8S before deploying to a local cluster
func EnsureDir ¶
func EnsureDir(ctx CancelableContext, pathElem ...string) string
func EnsureFileFromTemplate ¶
func EnsureNoDir ¶
func EnsureNoDir(ctx CancelableContext, pathElem ...string) string
func ErrorAndCancel ¶
func ErrorAndCancel(ctx CancelableContext, str string, params ...any)
func Fatal ¶
func Fatal(ctx CancelableContext, str string, params ...any)
func FatalErr ¶
func FatalErr(ctx CancelableContext, err error)
func FatalIfErr ¶
func FatalIfErr(ctx CancelableContext, err error)
func FileExists ¶
func GenerateDeployConfigs ¶
func GenerateDeployConfigs(ctx CancelableContext, dockerAllowed bool)
func GetConfigPath ¶
func GetConfigPath() string
func GetGoSrcDir ¶
func GetGoSrcDir() string
returns the name of the folder where to find the Go source code
func InSlice ¶
func InSlice[V comparable](s []V, el V) bool
InSlice returns true if the slice s contains the given element el
func InitAldevContext ¶
func InitAldevContext(waitTimeMs int, stopFn func()) *aldevContext
func InstallGitHooks ¶
func InstallGitHooks(ctx CancelableContext)
Installing Git hooks to unify our practices
func IsDevLibrary ¶
func IsDevLibrary() bool
func IsDevNative ¶
func IsDevNative() bool
func IsDevWebApp ¶
func IsDevWebApp() bool
func NewBaseContext ¶
func NewBaseContext() *baseCancelableContext
func ReadConfig ¶
func ReadConfig(cfgFileName string)
func ReadFileToJson ¶
func ReadFileToJson[T any, Y *T](ctx CancelableContext, filename string, obj Y, failIfNotExist bool) Y
func Recover ¶
func Recover(ctx CancelableContext, msg string, params ...any)
func ReplaceInFile ¶
func ReplaceInFile(ctx CancelableContext, filename string, replacements map[string]string)
func Run ¶
func Run(whyRunThis string, ctx CancelableContext, logStart bool, commandAsString string, params ...any)
func RunJobs ¶
func RunJobs(aldevCtx CancelableContext, parallel bool)
func SetVerbose ¶
func SetVerbose(isVerbose bool)
func StepWithPreamble ¶
func UseCodeSwaps ¶
func UseCodeSwaps()
func WatcherFor ¶
func WriteBytesToFile ¶
func WriteBytesToFile(ctx CancelableContext, filename string, bytes []byte)
func WriteJsonObjToFile ¶
func WriteJsonObjToFile(ctx CancelableContext, filename string, obj any)
func WriteStringToFile ¶
func WriteStringToFile(ctx CancelableContext, filename string, content string, params ...any)
Types ¶
type AldevConfig ¶
type AldevConfig struct { AppName string // the name of the app - beware: the key has to be "appname" in the YAML file Languages string // the languages available for this app, seperated by a comma - for example: en,fr,it,de,zh,es Lib *struct { SrcDir string // where the library source code can be found Config string // the path to the config file for the API, from the API's folder Install string // command that should be run to install stuff, like needed dependencies, etc. Develop string // command that should be run to allow for continuously developping & building the library BinDir string // the directory where to find the library's compiled binary, as seen from the library source folder (srcdir) // contains filtered or unexported fields } API *struct { SrcDir string // where the API's Goald-based code should be found Config string // the path to the config file for the API, from the API's folder Port int // the port used to expose the whole load-balanced API service I18n *I18nConfig DataDir string // where to find bootstraping data to run the app BinDir string // the directory where to find the API's compiled binary, as seen from the API source folder (srcdir) // contains filtered or unexported fields } // APIOnly bool // if true, then no web app is handled Web *struct { SrcDir string // where the Web app's GoaldR-based code should be found Port int // the port used to expose the app's frontend EnvVars []*struct { Name string // the variable name; must start with "WEB_" Desc string // a description for the Value string // the value we're using for the local dev environment } } Native *struct { SrcDir string // where the Native app's GoaldN-based code should be found I18n *I18nConfig // DataDir string // where to find bootstraping data to run the app } Vendors []*VendorConfig // external projects to vendor into our project Deploying *struct { Dir string // where all the deploying config should be } CodeSwaps []*CodeSwapsConfig // Automatically, temporarily swapping bits of code Symlinks []*SymlinkConfig // Create symlinks, to help code-swapping for instance Jobs []*JobConfig // Jobs to run }
func Config ¶
func Config() *AldevConfig
func (*AldevConfig) ResolvedBinDir ¶
func (cfg *AldevConfig) ResolvedBinDir() string
computed property on an Aldev config object
type AldevContext ¶
type AldevContext interface { CancelableContext GetLoopCtx() CancelableContext RestartLoop() }
an Aldev Context has a loop and allows to restart it
type AldevTask ¶
type AldevTask func(ctx CancelableContext)
characterises the functions run during an aldev command or subcommand
type CancelableContext ¶
type CancelableContext interface { context.Context WithExecDir(...string) CancelableContext WithStdOutWriter(io.Writer) CancelableContext WithStdErrWriter(io.Writer) CancelableContext WithErrLogFn(errLogFn) CancelableContext WithEnvVars(...string) CancelableContext WithReRun() CancelableContext WithAllowFailure(bool) CancelableContext CancelAll() NewChildContext() CancelableContext // contains filtered or unexported methods }
type CodeSwapsConfig ¶
type CodeSwapsConfig struct { From string // the path from which to look for swaps; "." for the current project, "../../dependency" to swap in another lib For []string // the file paths for which to apply the same swaps; can be provided as a glob, e.g. "./src/**/*.ts?", Do []*struct { Replace string // the substring to look for and replace With string // the replacement EOFCom bool // should the added comment (HOTSWAPPED) be at the end of the line (// ...) rather than inline (/* ... */) ? } }