Restructure project directories
Follow the standard of all go projects
This commit is contained in:
parent
741f18efd1
commit
5445ce1ccf
20 changed files with 39 additions and 42 deletions
55
app/utils.go
55
app/utils.go
|
|
@ -1,55 +0,0 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"gitlab.com/revalus/grm/config"
|
||||
)
|
||||
|
||||
func getFileContent(pathToFile string) ([]byte, error) {
|
||||
return os.ReadFile(pathToFile)
|
||||
}
|
||||
|
||||
func getFileExtension(pathToFile string) (string, error) {
|
||||
splitFileName := strings.Split(pathToFile, ".")
|
||||
|
||||
if len(splitFileName) == 1 {
|
||||
msg := fmt.Sprintf("excension for file \"%v\", not found", splitFileName)
|
||||
return "", errors.New(msg)
|
||||
}
|
||||
|
||||
fileExtension := splitFileName[len(splitFileName)-1]
|
||||
|
||||
return fileExtension, nil
|
||||
}
|
||||
|
||||
func checkIsItemInSlice(check string, sliceToCheck []string) bool {
|
||||
for _, item := range sliceToCheck {
|
||||
if item == check {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func checkAnyOfItemInSlice(check []string, sliceToCheck []string) bool {
|
||||
|
||||
for _, item := range check {
|
||||
if checkIsItemInSlice(item, sliceToCheck) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func reverseRepositoryConfigs(repositories []config.RepositoryConfig) []config.RepositoryConfig {
|
||||
for i, j := 0, len(repositories)-1; i < j; i, j = i+1, j-1 {
|
||||
repositories[i], repositories[j] = repositories[j], repositories[i]
|
||||
}
|
||||
return repositories
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue