hariprasadraja
10/3/2019 - 9:07 AM

go file system link information

[go file Lstat] this will gives the inforamation about the symlink. Symlinks do not work in windows #go #file

package main

import (
	"fmt"
	"log"
	"os"
)

func main() {
	// Lstat will return file info, but if it is actually
	// a symlink, it will return info about the symlink.
	// It will not follow the link and give information
	// about the real file
	// Symlinks do not work in Windows
	fileInfo, err := os.Lstat("original_sym.txt")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Link info: %+v", fileInfo)
}