package chrono import ( "bufio" "fmt" "os" "path/filepath" "regexp" "time" ) type ChronoEntry struct { Date, Time, Action string } type ParsedChronoEntry struct { StartTime time.Time Action string Duration string } func Chrono() { // Return path of an executable exPath, err := os.Executable() if err != nil { panic(err) } exDir := filepath.Dir(exPath) fmt.Println(exDir) // Return path of the current directory path, err := os.Getwd() if err != nil { panic(err) } // Join paths textFilePath := filepath.Join(path, "chrono.txt") // Read file with chrono data readFile, err := os.Open(textFilePath) if err != nil { panic(err) } defer readFile.Close() fileScanner := bufio.NewScanner(readFile) fileScanner.Split(bufio.ScanLines) var fileLines []string for fileScanner.Scan() { fileLines = append(fileLines, fileScanner.Text()) } // Prepare slice for data parse_result := make([]ChronoEntry, 0) result := make([]ParsedChronoEntry, 0) r := regexp.MustCompile( `(?P\d{2}\s\w*\s\d{4})\s+at\s+(?P