Documentation ¶
Overview ¶
Package utils bring global functions
Index ¶
- Variables
- func Contains(list []string, string string) bool
- func EnsureOrFatal(err error)
- func EnsureProgramInstalled(programName string) bool
- func FileExists(path string) bool
- func NoDiagsOrFatal(diags hcl.Diagnostics)
- func OkOrFatal(ok bool, message string)
- func RunSystemCommand(name string, arg ...string) (string, string, bool)
Constants ¶
This section is empty.
Variables ¶
var LogFatal = log.Fatal
LogFatal is the log.Fatal go built-in function by default. Permit to change the behaviour of that variable in order to test the EnsureOrFatal function
var LogFatalf = log.Fatalf
LogFatalf is the log.Fatalf go built-in function by default. Permit to change the behaviour of that variable in order to test EnsureProgramInstalled function
Functions ¶
func EnsureOrFatal ¶
func EnsureOrFatal(err error)
EnsureOrFatal ensures the error in nil or uses LogFatal
func EnsureProgramInstalled ¶
EnsureProgramInstalled check if the given program is installed in the system. For example, check if terraform is installed. If not, will crash the program.
func FileExists ¶
FileExists return true is the given file exists, else false
func NoDiagsOrFatal ¶
func NoDiagsOrFatal(diags hcl.Diagnostics)
NoDiagsOrFatal ensure that the diag slice is empty or uses LogFatal
Types ¶
This section is empty.