title: Resolving broken symbolic links
body: <p>I want my Go program to resolve the targets of a few symlinks. The only trouble is these symlinks will be pointing to destinations that do not actually exist, which is fine because I do some filepath manipulations afterwards. Is this even possible? If I do a "readlink -f ", I do get a nil result with exit code 1.</p>
  
  <pre><code>// path is the filepath of a symlink
  // this symlink will most likely be pointing to a non-existent file/location
  // this is fine and is handled elsewhere
  func handleSymlink(path *string) (bool, error) {
      f, err := os.Lstat(*path)
      if err != nil {
          return false, err
      }
  
      // if f is nil, then this is not a symlink
      if f == nil {
          return false, nil
      }
  
      ln, err := os.Readlink(*path)
      //ln, err := filepath.EvalSymlinks(*path)
  
      // ignore IsNotExist errors...this is expected
      if !os.IsNotExist(err) {
          return false, err
      }
  
      path = &amp;ln
      return true, nil 
  } 
  </code></pre>