Skip to content

Commit f520aba

Browse files
committed
init for sync
1 parent 801bda7 commit f520aba

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

main_test/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
)
7+
8+
func main() {
9+
10+
fmt.Println(os.Executable())
11+
12+
}

project_root_directory.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package project_root_directory
2+
3+
import (
4+
"os"
5+
"path/filepath"
6+
)
7+
8+
func Get() string {
9+
return ""
10+
}
11+
12+
type RunType int
13+
14+
const (
15+
RunTypeUintTest RunType = iota
16+
RunTypeRelease
17+
)
18+
19+
func judgeCurrentRunType() {
20+
21+
}
22+
23+
// 获取可执行文件的路径
24+
func getExecutable() string {
25+
ex, err := os.Executable()
26+
if err != nil {
27+
return ""
28+
}
29+
exPath := filepath.Dir(ex)
30+
realPath, err := filepath.EvalSymlinks(exPath)
31+
if err != nil {
32+
return ""
33+
}
34+
return realPath
35+
//return filepath.Dir(realPath)
36+
}
37+
38+
// 源代码测试
39+
40+
// 源代码Example
41+
42+
// 源代码基准测试
43+
44+
// 源代码main方法运行
45+
46+
// 编译后的执行

project_root_directory_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package project_root_directory
2+
3+
import "testing"
4+
5+
func Test_getExecutable(t *testing.T) {
6+
7+
t.Log(getExecutable())
8+
9+
}

test/test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package test
2+
3+
4+

0 commit comments

Comments
 (0)