@@ -414,7 +414,7 @@ func NewJournal() (j *Journal, err error) {
414414 r := C .my_sd_journal_open (sd_journal_open , & j .cjournal , C .SD_JOURNAL_LOCAL_ONLY )
415415
416416 if r < 0 {
417- return nil , fmt .Errorf ("failed to open journal: %d " , syscall .Errno (- r ))
417+ return nil , fmt .Errorf ("failed to open journal: %s " , syscall .Errno (- r ). Error ( ))
418418 }
419419
420420 return j , nil
@@ -435,7 +435,7 @@ func NewJournalFromDir(path string) (j *Journal, err error) {
435435
436436 r := C .my_sd_journal_open_directory (sd_journal_open_directory , & j .cjournal , p , 0 )
437437 if r < 0 {
438- return nil , fmt .Errorf ("failed to open journal in directory %q: %d " , path , syscall .Errno (- r ))
438+ return nil , fmt .Errorf ("failed to open journal in directory %q: %s " , path , syscall .Errno (- r ). Error ( ))
439439 }
440440
441441 return j , nil
@@ -461,7 +461,7 @@ func NewJournalFromFiles(paths ...string) (j *Journal, err error) {
461461
462462 r := C .my_sd_journal_open_files (sd_journal_open_files , & j .cjournal , & cPaths [0 ], 0 )
463463 if r < 0 {
464- return nil , fmt .Errorf ("failed to open journals in paths %q: %d " , paths , syscall .Errno (- r ))
464+ return nil , fmt .Errorf ("failed to open journals in paths %q: %s " , paths , syscall .Errno (- r ). Error ( ))
465465 }
466466
467467 return j , nil
@@ -496,7 +496,7 @@ func (j *Journal) AddMatch(match string) error {
496496 j .mu .Unlock ()
497497
498498 if r < 0 {
499- return fmt .Errorf ("failed to add match: %d " , syscall .Errno (- r ))
499+ return fmt .Errorf ("failed to add match: %s " , syscall .Errno (- r ). Error ( ))
500500 }
501501
502502 return nil
@@ -514,7 +514,7 @@ func (j *Journal) AddDisjunction() error {
514514 j .mu .Unlock ()
515515
516516 if r < 0 {
517- return fmt .Errorf ("failed to add a disjunction in the match list: %d " , syscall .Errno (- r ))
517+ return fmt .Errorf ("failed to add a disjunction in the match list: %s " , syscall .Errno (- r ). Error ( ))
518518 }
519519
520520 return nil
@@ -532,7 +532,7 @@ func (j *Journal) AddConjunction() error {
532532 j .mu .Unlock ()
533533
534534 if r < 0 {
535- return fmt .Errorf ("failed to add a conjunction in the match list: %d " , syscall .Errno (- r ))
535+ return fmt .Errorf ("failed to add a conjunction in the match list: %s " , syscall .Errno (- r ). Error ( ))
536536 }
537537
538538 return nil
@@ -562,7 +562,7 @@ func (j *Journal) Next() (uint64, error) {
562562 j .mu .Unlock ()
563563
564564 if r < 0 {
565- return 0 , fmt .Errorf ("failed to iterate journal: %d " , syscall .Errno (- r ))
565+ return 0 , fmt .Errorf ("failed to iterate journal: %s " , syscall .Errno (- r ). Error ( ))
566566 }
567567
568568 return uint64 (r ), nil
@@ -581,7 +581,7 @@ func (j *Journal) NextSkip(skip uint64) (uint64, error) {
581581 j .mu .Unlock ()
582582
583583 if r < 0 {
584- return 0 , fmt .Errorf ("failed to iterate journal: %d " , syscall .Errno (- r ))
584+ return 0 , fmt .Errorf ("failed to iterate journal: %s " , syscall .Errno (- r ). Error ( ))
585585 }
586586
587587 return uint64 (r ), nil
@@ -599,7 +599,7 @@ func (j *Journal) Previous() (uint64, error) {
599599 j .mu .Unlock ()
600600
601601 if r < 0 {
602- return 0 , fmt .Errorf ("failed to iterate journal: %d " , syscall .Errno (- r ))
602+ return 0 , fmt .Errorf ("failed to iterate journal: %s " , syscall .Errno (- r ). Error ( ))
603603 }
604604
605605 return uint64 (r ), nil
@@ -618,7 +618,7 @@ func (j *Journal) PreviousSkip(skip uint64) (uint64, error) {
618618 j .mu .Unlock ()
619619
620620 if r < 0 {
621- return 0 , fmt .Errorf ("failed to iterate journal: %d " , syscall .Errno (- r ))
621+ return 0 , fmt .Errorf ("failed to iterate journal: %s " , syscall .Errno (- r ). Error ( ))
622622 }
623623
624624 return uint64 (r ), nil
@@ -641,7 +641,7 @@ func (j *Journal) getData(field string) (unsafe.Pointer, C.int, error) {
641641 j .mu .Unlock ()
642642
643643 if r < 0 {
644- return nil , 0 , fmt .Errorf ("failed to read message: %d " , syscall .Errno (- r ))
644+ return nil , 0 , fmt .Errorf ("failed to read message: %s " , syscall .Errno (- r ). Error ( ))
645645 }
646646
647647 return d , C .int (l ), nil
@@ -736,7 +736,7 @@ func (j *Journal) GetEntry() (*JournalEntry, error) {
736736 var realtimeUsec C.uint64_t
737737 r = C .my_sd_journal_get_realtime_usec (sd_journal_get_realtime_usec , j .cjournal , & realtimeUsec )
738738 if r < 0 {
739- return nil , fmt .Errorf ("failed to get realtime timestamp: %d " , syscall .Errno (- r ))
739+ return nil , fmt .Errorf ("failed to get realtime timestamp: %s " , syscall .Errno (- r ). Error ( ))
740740 }
741741
742742 entry .RealtimeTimestamp = uint64 (realtimeUsec )
@@ -746,7 +746,7 @@ func (j *Journal) GetEntry() (*JournalEntry, error) {
746746
747747 r = C .my_sd_journal_get_monotonic_usec (sd_journal_get_monotonic_usec , j .cjournal , & monotonicUsec , & boot_id )
748748 if r < 0 {
749- return nil , fmt .Errorf ("failed to get monotonic timestamp: %d " , syscall .Errno (- r ))
749+ return nil , fmt .Errorf ("failed to get monotonic timestamp: %s " , syscall .Errno (- r ). Error ( ))
750750 }
751751
752752 entry .MonotonicTimestamp = uint64 (monotonicUsec )
@@ -757,7 +757,7 @@ func (j *Journal) GetEntry() (*JournalEntry, error) {
757757 r = C .my_sd_journal_get_cursor (sd_journal_get_cursor , j .cjournal , & c )
758758 defer C .free (unsafe .Pointer (c ))
759759 if r < 0 {
760- return nil , fmt .Errorf ("failed to get cursor: %d " , syscall .Errno (- r ))
760+ return nil , fmt .Errorf ("failed to get cursor: %s " , syscall .Errno (- r ). Error ( ))
761761 }
762762
763763 entry .Cursor = C .GoString (c )
@@ -773,7 +773,7 @@ func (j *Journal) GetEntry() (*JournalEntry, error) {
773773 }
774774
775775 if r < 0 {
776- return nil , fmt .Errorf ("failed to read message field: %d " , syscall .Errno (- r ))
776+ return nil , fmt .Errorf ("failed to read message field: %s " , syscall .Errno (- r ). Error ( ))
777777 }
778778
779779 msg := C .GoStringN ((* C .char )(d ), C .int (l ))
@@ -803,7 +803,7 @@ func (j *Journal) SetDataThreshold(threshold uint64) error {
803803 j .mu .Unlock ()
804804
805805 if r < 0 {
806- return fmt .Errorf ("failed to set data threshold: %d " , syscall .Errno (- r ))
806+ return fmt .Errorf ("failed to set data threshold: %s " , syscall .Errno (- r ). Error ( ))
807807 }
808808
809809 return nil
@@ -826,7 +826,7 @@ func (j *Journal) GetRealtimeUsec() (uint64, error) {
826826 j .mu .Unlock ()
827827
828828 if r < 0 {
829- return 0 , fmt .Errorf ("failed to get realtime timestamp: %d " , syscall .Errno (- r ))
829+ return 0 , fmt .Errorf ("failed to get realtime timestamp: %s " , syscall .Errno (- r ). Error ( ))
830830 }
831831
832832 return uint64 (usec ), nil
@@ -850,7 +850,7 @@ func (j *Journal) GetMonotonicUsec() (uint64, error) {
850850 j .mu .Unlock ()
851851
852852 if r < 0 {
853- return 0 , fmt .Errorf ("failed to get monotonic timestamp: %d " , syscall .Errno (- r ))
853+ return 0 , fmt .Errorf ("failed to get monotonic timestamp: %s " , syscall .Errno (- r ). Error ( ))
854854 }
855855
856856 return uint64 (usec ), nil
@@ -875,7 +875,7 @@ func (j *Journal) GetCursor() (string, error) {
875875 defer C .free (unsafe .Pointer (d ))
876876
877877 if r < 0 {
878- return "" , fmt .Errorf ("failed to get cursor: %d " , syscall .Errno (- r ))
878+ return "" , fmt .Errorf ("failed to get cursor: %s " , syscall .Errno (- r ). Error ( ))
879879 }
880880
881881 cursor := C .GoString (d )
@@ -899,7 +899,7 @@ func (j *Journal) TestCursor(cursor string) error {
899899 j .mu .Unlock ()
900900
901901 if r < 0 {
902- return fmt .Errorf ("failed to test to cursor %q: %d " , cursor , syscall .Errno (- r ))
902+ return fmt .Errorf ("failed to test to cursor %q: %s " , cursor , syscall .Errno (- r ). Error ( ))
903903 } else if r == 0 {
904904 return ErrNoTestCursor
905905 }
@@ -921,7 +921,7 @@ func (j *Journal) SeekHead() error {
921921 j .mu .Unlock ()
922922
923923 if r < 0 {
924- return fmt .Errorf ("failed to seek to head of journal: %d " , syscall .Errno (- r ))
924+ return fmt .Errorf ("failed to seek to head of journal: %s " , syscall .Errno (- r ). Error ( ))
925925 }
926926
927927 return nil
@@ -941,7 +941,7 @@ func (j *Journal) SeekTail() error {
941941 j .mu .Unlock ()
942942
943943 if r < 0 {
944- return fmt .Errorf ("failed to seek to tail of journal: %d " , syscall .Errno (- r ))
944+ return fmt .Errorf ("failed to seek to tail of journal: %s " , syscall .Errno (- r ). Error ( ))
945945 }
946946
947947 return nil
@@ -961,7 +961,7 @@ func (j *Journal) SeekRealtimeUsec(usec uint64) error {
961961 j .mu .Unlock ()
962962
963963 if r < 0 {
964- return fmt .Errorf ("failed to seek to %d: %d " , usec , syscall .Errno (- r ))
964+ return fmt .Errorf ("failed to seek to %d: %s " , usec , syscall .Errno (- r ). Error ( ))
965965 }
966966
967967 return nil
@@ -984,7 +984,7 @@ func (j *Journal) SeekCursor(cursor string) error {
984984 j .mu .Unlock ()
985985
986986 if r < 0 {
987- return fmt .Errorf ("failed to seek to cursor %q: %d " , cursor , syscall .Errno (- r ))
987+ return fmt .Errorf ("failed to seek to cursor %q: %s " , cursor , syscall .Errno (- r ). Error ( ))
988988 }
989989
990990 return nil
@@ -1031,7 +1031,7 @@ func (j *Journal) GetUsage() (uint64, error) {
10311031 j .mu .Unlock ()
10321032
10331033 if r < 0 {
1034- return 0 , fmt .Errorf ("failed to get journal disk space usage: %d " , syscall .Errno (- r ))
1034+ return 0 , fmt .Errorf ("failed to get journal disk space usage: %s " , syscall .Errno (- r ). Error ( ))
10351035 }
10361036
10371037 return uint64 (out ), nil
@@ -1065,7 +1065,7 @@ func (j *Journal) GetUniqueValues(field string) ([]string, error) {
10651065 r := C .my_sd_journal_query_unique (sd_journal_query_unique , j .cjournal , f )
10661066
10671067 if r < 0 {
1068- return nil , fmt .Errorf ("failed to query journal: %d " , syscall .Errno (- r ))
1068+ return nil , fmt .Errorf ("failed to query journal: %s " , syscall .Errno (- r ). Error ( ))
10691069 }
10701070
10711071 // Implements the SD_JOURNAL_FOREACH_UNIQUE macro from sd-journal.h
@@ -1079,7 +1079,7 @@ func (j *Journal) GetUniqueValues(field string) ([]string, error) {
10791079 }
10801080
10811081 if r < 0 {
1082- return nil , fmt .Errorf ("failed to read message field: %d " , syscall .Errno (- r ))
1082+ return nil , fmt .Errorf ("failed to read message field: %s " , syscall .Errno (- r ). Error ( ))
10831083 }
10841084
10851085 msg := C .GoStringN ((* C .char )(d ), C .int (l ))
@@ -1111,7 +1111,7 @@ func (j *Journal) GetCatalog() (string, error) {
11111111 defer C .free (unsafe .Pointer (c ))
11121112
11131113 if r < 0 {
1114- return "" , fmt .Errorf ("failed to retrieve catalog entry for current journal entry: %d " , syscall .Errno (- r ))
1114+ return "" , fmt .Errorf ("failed to retrieve catalog entry for current journal entry: %s " , syscall .Errno (- r ). Error ( ))
11151115 }
11161116
11171117 catalog := C .GoString (c )
0 commit comments