Documentation ¶
Overview ¶
Package utils provides helper functions for other subpackages
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrPathNotSet states that given path to file loader is empty ErrPathNotSet = errors.New("path is not set") // ErrFileNotFound states that given file is not exists ErrFileNotFound = errors.New("file not found") )
View Source
var NewLinesRegex = regexp.MustCompile(`(?m:\s*$)`)
NewLinesRegex holds the regex to remove newlines from given bytes.Buffer
Functions ¶
func Clear ¶
Clear formats the given source with predefined operations, it removes the new lines too
func ReadFile ¶
ReadFile reads the given file, first it tries to read with relative path, then tries with exact given path
func RemoveNewLines ¶
RemoveNewLines removes extranneous new lines from given byte slice
func Write ¶
Write writes a given model data into given fileName, if folders in the filename does not exist, creates the folders too.
func WriteFormattedFile ¶
WriteFormattedFile formats the code with goimports and writes the result to the given file, if file doesnt exists, it creates it
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.