code: func getFileType(pathname string) (FileType, error) {
  	var pathType FileType
  	info, err := os.Stat(pathname)
  	if os.IsNotExist(err) {
  		return pathType, fmt.Errorf("path %q does not exist", pathname)
  	}
  	// err in call to os.Stat
  	if err != nil {
  		return pathType, err
  	}
  
  	// checks whether the mode is the target mode
  	isSpecificMode := func(mode, targetMode os.FileMode) bool {
  		return mode&targetMode == targetMode
  	}
  
  	mode := info.Mode()
  	if mode.IsDir() {
  		return FileTypeDirectory, nil
  	} else if mode.IsRegular() {
  		return FileTypeFile, nil
  	} else if isSpecificMode(mode, os.ModeSocket) {
  		return FileTypeSocket, nil
  	} else if isSpecificMode(mode, os.ModeDevice) {
  		if isSpecificMode(mode, os.ModeCharDevice) {
  			return FileTypeCharDev, nil
  		}
  		return FileTypeBlockDev, nil
  	}
  
  	return pathType, fmt.Errorf("only recognise file, directory, socket, block device and character device")
  }
docs: // getFileType checks for file/directory/socket and block/character devices