hariprasadraja
10/3/2019 - 9:07 AM

go file system link information

this will gives the inforamation about the symlink. Symlinks do not work in windows

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)
}