[agent-operator]-无聊的更新内容
This commit is contained in:
17
agent-tmp/io-tmp/获取当前用户目录.go
Normal file
17
agent-tmp/io-tmp/获取当前用户目录.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package io_tmp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/user"
|
||||
)
|
||||
|
||||
func GetUserHomeDir() {
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(usr)
|
||||
fmt.Println(usr.HomeDir)
|
||||
}
|
||||
7
agent-tmp/io-tmp/获取当前用户目录_test.go
Normal file
7
agent-tmp/io-tmp/获取当前用户目录_test.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package io_tmp
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestGetUserHomeDir(t *testing.T) {
|
||||
GetUserHomeDir()
|
||||
}
|
||||
Reference in New Issue
Block a user