830ccb66 by skyblue

initial utils dir

1 parent 4fa625de
1 package utils
2
3 import (
4 "os"
5 "path/filepath"
6 )
7
8 func SelfPath() string {
9 path, _ := filepath.Abs(os.Args[0])
10 return path
11 }
1 package utils
2
3 import (
4 "testing"
5 )
6
7 func TestSelfPath(t *testing.T) {
8 path := SelfPath()
9 if path == "" {
10 t.Error("path cannot be empty")
11 }
12 t.Logf("SelfPath: %s", path)
13 }
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!