diff options
Diffstat (limited to 'sd_id128/get.go')
-rw-r--r-- | sd_id128/get.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sd_id128/get.go b/sd_id128/get.go index d8cdcfa..40d1219 100644 --- a/sd_id128/get.go +++ b/sd_id128/get.go @@ -17,6 +17,7 @@ package sd_id128 import ( "crypto/rand" "os" + "io/ioutil" "strings" ) @@ -61,11 +62,11 @@ var cachedMachineID ID128 // machine-id(5): https://www.freedesktop.org/software/systemd/man/machine-id.html func GetMachineID() (ID128, error) { if cachedMachineID == (ID128{}) { - str, err := readfile("/etc/machine-id") + str, err := ioutil.ReadFile("/etc/machine-id") if err != nil { return ID128{}, err } - id, err := ParsePlain(strings.TrimSuffix(str, "\n")) + id, err := ParsePlain(strings.TrimSuffix(string(str), "\n")) if err != nil { return ID128{}, err } @@ -94,11 +95,11 @@ var cachedBootID ID128 // random(4): http://man7.org/linux/man-pages/man4/random.4.html func GetBootUUID() (ID128, error) { if cachedBootID == (ID128{}) { - str, err := readfile("/proc/sys/kernel/random/boot_id") + str, err := ioutil.ReadFile("/proc/sys/kernel/random/boot_id") if err != nil { return ID128{}, err } - id, err := ParseUUID(strings.TrimSuffix(str, "\n")) + id, err := ParseUUID(strings.TrimSuffix(string(str), "\n")) if err != nil { return ID128{}, err } |