Add sync command
This commit is contained in:
commit
5e6a5e23fd
18 changed files with 1077 additions and 0 deletions
25
app/utils.go
Normal file
25
app/utils.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func getFileContent(pathToFile string) ([]byte, error) {
|
||||
return ioutil.ReadFile(pathToFile)
|
||||
}
|
||||
|
||||
func getFileExcension(pathToFile string) (string, error) {
|
||||
splittedFileName := strings.Split(pathToFile, ".")
|
||||
|
||||
if len(splittedFileName) == 1 {
|
||||
msg := fmt.Sprintf("excension for file \"%v\", not found", splittedFileName)
|
||||
return "", errors.New(msg)
|
||||
}
|
||||
|
||||
fileExcension := splittedFileName[len(splittedFileName)-1]
|
||||
|
||||
return fileExcension, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue