You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
808 B
Go

package icsutil
import (
"fmt"
"runtime"
"strings"
"os"
"golang.org/x/sys/unix"
)
func PrintCallTrace(depth int, v interface{}) {
funcname, file, line, ok := runtime.Caller(depth)
if ok {
files := strings.Split(file, "/")
fileslen := len(files)
func1 := runtime.FuncForPC(funcname).Name()
funcs := strings.Split(func1, "/")
funcslen := len(funcs)
fmt.Printf("[%s:%d %s] %v\n", files[fileslen-1], line, funcs[funcslen-1], v)
}
}
func GetDiskAvailableSpace(path string) uint64 {
var stat unix.Statfs_t
unix.Statfs(path, &stat)
return stat.Bavail * uint64(stat.Bsize)
}
func DeleteFile(path string, filename string) string {
var err string
rmerr := os.Remove(fmt.Sprintf("%s/%s", path, filename))
if rmerr != nil {
fmt.Printf("Delete File error - %s\n", rmerr)
}
return err
}