Documentation ¶
Overview ¶
Package util is a generated GoMock package.
Index ¶
- Variables
- func CheckError(err error, msg string) bool
- func CheckProperty(properties map[string]string, property string) (string, error)
- func FailOnError(err error, msg string)
- func ReplacePathSeparators(path string) (newPath string)
- func SetupLogging(verbose bool) error
- func UnmarshalYaml(text string, fileName string) (error, map[string]map[string]string)
- type FileReader
- type MockFileReader
- type MockFileReaderMockRecorder
- type Template
Constants ¶
This section is empty.
Variables ¶
var Log lumber.Logger = lumber.NewConsoleLogger(lumber.INFO)
Log is the shared Lumber Logger logging to console and after calling SetupLogging also to file
Functions ¶
func CheckError ¶
func CheckProperty ¶
func FailOnError ¶
func ReplacePathSeparators ¶
func SetupLogging ¶
SetupLogging is used to initialize the shared file Logger once the necessary setup config is available
func UnmarshalYaml ¶
UnmarshalYaml takes the contents of a yaml file and converts it to a map[string]map[string]string The yaml file should have the following format:
some-name-1:
- list-key-1: "list-entry-1"
- list-key-2: "list-entry-2"
some-name-2:
- list-key-1: "list-entry-1"
Types ¶
type FileReader ¶
type FileReader interface { ReadFile(fileName string) (content []byte, err error) ReadDir(fileName string) ([]os.FileInfo, error) }
A FileReader is an interface which encapsulates io/ioutil to make the code using it testable. Since the reading of the file is now behind an interface, we can easily mock it.
func NewFileReader ¶
func NewFileReader() FileReader
NewFileReader creates a new FileReader. A FileReader is an interface which encapsulates io/ioutil to make the code using it testable. Since the reading of the file is now behind an interface, we can easily mock it.
func NewInMemoryFileReader ¶
func NewInMemoryFileReader(originalDir string, transformers []func(string) string) (FileReader, error)
NewInMemoryFileReader creates a new in-memory file reader which reads all the original files once and stores them internally in-memory. This allows us to perform any modifications on the files later on
type MockFileReader ¶
type MockFileReader struct {
// contains filtered or unexported fields
}
MockFileReader is a mock of FileReader interface
func NewMockFileReader ¶
func NewMockFileReader(ctrl *gomock.Controller) *MockFileReader
NewMockFileReader creates a new mock instance
func (*MockFileReader) EXPECT ¶
func (m *MockFileReader) EXPECT() *MockFileReaderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockFileReaderMockRecorder ¶
type MockFileReaderMockRecorder struct {
// contains filtered or unexported fields
}
MockFileReaderMockRecorder is the mock recorder for MockFileReader
func (*MockFileReaderMockRecorder) ReadDir ¶
func (mr *MockFileReaderMockRecorder) ReadDir(fileName interface{}) *gomock.Call
ReadDir indicates an expected call of ReadDir
func (*MockFileReaderMockRecorder) ReadFile ¶
func (mr *MockFileReaderMockRecorder) ReadFile(fileName interface{}) *gomock.Call
ReadFile indicates an expected call of ReadFile
type Template ¶
Template wraps the underlying templating logic and provides a means of setting config values just on one place. It is intended to be language-agnostic, the file type does not matter (yaml, json, ...)
func NewTemplate ¶
NewTemplate creates a new template for the given file