code: func findDaemon(cfg *config.Config) (*os.Process, error) {
  	lock, err := lockfile.New(cfg.PidPath)
  	if err != nil {
  		return nil, err
  	}
  
  	proc, err := lock.GetOwner()
  	if err != nil {
  		// happy path cases. the pid doesn't exist, or it contains garbage,
  		// or the previous owner is gone.
  		if os.IsNotExist(err) || err == lockfile.ErrInvalidPid || err == lockfile.ErrDeadOwner {
  			return nil, nil
  		}
  
  		return nil, err
  	}
  
  	return proc, nil
  }
docs: // findDaemon returns an os.Process for a running daemon, or nil if it is not
  // running. It returns an error if the pid file location is invalid in the
  // config, or there was an error reading the pid file.