initial commit
This commit is contained in:
commit
457eec7add
20
goutil.go
Normal file
20
goutil.go
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
package goutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
"path/filepath"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WriteFile(filename string, data string) error {
|
||||||
|
return ioutil.WriteFile(filename, []byte(data), 0644)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadFile(filename string) (string, error) {
|
||||||
|
data, err := ioutil.ReadFile(filename)
|
||||||
|
return string(data), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func TrimExt(path string) string {
|
||||||
|
extension := filepath.Ext(path)
|
||||||
|
return path[0 : len(path)-len(extension)]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user