code: func isPerfFile(path string) bool {
  	sourceFile, openErr := os.Open(path)
  	if openErr != nil {
  		return false
  	}
  	defer sourceFile.Close()
  
  	// If the file is the output of a perf record command, it should begin
  	// with the string PERFILE2.
  	perfHeader := []byte("PERFILE2")
  	actualHeader := make([]byte, len(perfHeader))
  	if _, readErr := sourceFile.Read(actualHeader); readErr != nil {
  		return false
  	}
  	return bytes.Equal(actualHeader, perfHeader)
  }
docs: // isPerfFile checks if a file is in perf.data format. It also returns false
  // if it encounters an error during the check.