github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/pkg/system/lstat_unix.go (about)

     1  // +build !windows
     2  
     3  package system // import "github.com/demonoid81/moby/pkg/system"
     4  
     5  import (
     6  	"os"
     7  	"syscall"
     8  )
     9  
    10  // Lstat takes a path to a file and returns
    11  // a system.StatT type pertaining to that file.
    12  //
    13  // Throws an error if the file does not exist
    14  func Lstat(path string) (*StatT, error) {
    15  	s := &syscall.Stat_t{}
    16  	if err := syscall.Lstat(path, s); err != nil {
    17  		return nil, &os.PathError{Op: "Lstat", Path: path, Err: err}
    18  	}
    19  	return fromStatT(s)
    20  }