-
Notifications
You must be signed in to change notification settings - Fork 1
/
base.go
37 lines (31 loc) · 805 Bytes
/
base.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package tsk
/*
#cgo LDFLAGS: -ltsk
#include <tsk/libtsk.h>
*/
import "C"
import (
"fmt"
)
// Version returns a text representation of the libtsk version.
// It wraps tsk_version_get_str().
func Version() string {
cVersion := C.tsk_version_get_str()
return C.GoString(cVersion)
}
// ErrNo returns the libtsk specific errno.
// It wraps tsk_error_get_errno().
func ErrorNo() int {
errno := int(C.tsk_error_get_errno())
return errno
}
// ErrorStr return a description of the current error.
// It wraps tsk_error_get_errstr().
func ErrorStr() string {
errstr := C.GoString(C.tsk_error_get_errstr())
return errstr
}
// Error returns a string containing the error's description and number (errno).
func Error() error {
return fmt.Errorf("%s (%d)", ErrorStr(), ErrorNo())
}