The filepath package
Abs()
gets the absolute path: the current project is used as a reference in the program.
IsAbs()
determines whether it is an absolute path
Absolute path: Absolute
starts from the drive letter to describe
Relative path: Relative
Abs()
gets the absolute path: the current project is used as a reference in the program.
IsAbs()
determines whether it is an absolute path
Absolute path: Absolute
starts from the drive letter to describe
Relative path: Relative
relative to the reference
fmt.Println(filepath.IsAbs( "aa.txt" )) //false fmt.Println(filepath.IsAbs( "C:\\liu\\pro\\aa.txt" )) //true fmt.Println( filepath.Abs( "aa.txt" )) //C:\Ruby\workspace\workspace1802\src\day12_file\aa.txt <nil> /* mac system file path /User/liu/documents/aa.txt under mac , on the selected file, command+i, to view the information of the file Location : */