How to get the absolute path of a file

solved: File.Name is the path information, FileInfo.Name is the file name, don"t be confused by the name

how do I get the absolute path of a file? I don"t think there are any related attributes in File or FileInfo.
for example, if I pass * os.File as a parameter, how to get the absolute path

file, _ := os.Open("config.yml")
// path:d:\GoDev\src\test\config.yml 
info, _ := os.Stat("config.yml")
// path: vol:3330745337 
info2, _ := file.Stat()
fmt.Printf("%+v\n", file)
fmt.Printf("%+v\n", info)
fmt.Printf("%+v\n", info2)
&{file:0xc04206c780}
&{name:config.yml sys:{FileAttributes:32 CreationTime:{LowDateTime:746054434 HighDateTime:30682930} LastAccessTime:{LowDateTime:746052720 HighDateTime:30682930} LastWriteTime:{LowDateTime:2328162096 HighDateTime:30683074} FileSizeHigh:0 FileSizeLow:5} filetype:0 Mutex:{state:0 sema:0} path:d:\GoDev\src\test\config.yml
vol:0 idxhi:0 idxlo:0 appendNameToPath:false}
&{name:config.yml sys:{FileAttributes:32 CreationTime:{LowDateTime:746054434 HighDateTime:30682930} LastAccessTime:{LowDateTime:746052720 HighDateTime:30682930} LastWriteTime:{LowDateTime:2328162096 HighDateTime:30683074} FileSizeHigh:0 FileSizeLow:5} filetype:1 Mutex:{state:0 sema:0} path: vol:3330745337 idxhi:1048576 idxlo:39063 appendNameToPath:false}
Apr.07,2021

import "path/filepath" , where Abs method

filepath.Abs(filepath.Dir(file.Name()))
Menu