Golang path/filepath.Abs() function example

package path/filepath

Golang path/filepath.Abs() function usage example

 file, err := ioutil.TempFile(os.TempDir(), "temp")

 if err != nil {
 panic(err)
 }
 fmt.Println("Temp File created!")
 thepath, err := filepath.Abs(filepath.Dir(file.Name()))

References :

http://golang.org/pkg/path/filepath/#Abs

https://www.socketloop.com/tutorials/golang-get-file-path-of-a-temporary-file

Advertisement