gopkg.in/docker/docker.v20@v20.10.27/pkg/system/lstat_unix.go (about)

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