File: hostid_linux.go

package info (click to toggle)
golang-github-rs-xid 1.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 152 kB
  • sloc: makefile: 2
file content (13 lines) | stat: -rw-r--r-- 264 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
// +build linux

package xid

import "io/ioutil"

func readPlatformMachineID() (string, error) {
	b, err := ioutil.ReadFile("/etc/machine-id")
	if err != nil || len(b) == 0 {
		b, err = ioutil.ReadFile("/sys/class/dmi/id/product_uuid")
	}
	return string(b), err
}