package pid import ( "errors" "os" "path/filepath" ) var ( LockFail = errors.New("进程锁创建失败") ) type PidLock struct { file string lock *os.File } func NewPidLock(path string) *PidLock { absPath, _ := filepath.Abs(path) return &PidLock{ file: absPath, } }