mirror of https://github.com/curusarn/resh
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
332 B
18 lines
332 B
package deviceid
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path"
|
|
"strings"
|
|
)
|
|
|
|
func Get(dataDir string) (string, error) {
|
|
fname := "device-id"
|
|
dat, err := os.ReadFile(path.Join(dataDir, fname))
|
|
if err != nil {
|
|
return "", fmt.Errorf("could not read file with device-id: %w", err)
|
|
}
|
|
id := strings.TrimRight(string(dat), "\n")
|
|
return id, nil
|
|
}
|
|
|