code: func TraversesSymlink(filesystem fs.Filesystem, name string) error {
  	var err error
  	name, err = fs.Canonicalize(name)
  	if err != nil {
  		return err
  	}
  
  	if name == "." {
  		// The result of calling TraversesSymlink(filesystem, filepath.Dir("foo"))
  		return nil
  	}
  
  	var path string
  	for _, part := range strings.Split(name, string(fs.PathSeparator)) {
  		path = filepath.Join(path, part)
  		info, err := filesystem.Lstat(path)
  		if err != nil {
  			if fs.IsNotExist(err) {
  				return nil
  			}
  			return err
  		}
  		if info.IsSymlink() {
  			return &TraversesSymlinkError{
  				path: path,
  			}
  		}
  		if !info.IsDir() {
  			return &NotADirectoryError{
  				path: path,
  			}
  		}
  	}
  	return nil
  }
docs: // TraversesSymlink returns an error if any path component of name (including name
  // itself) traverses a symlink.