summaryrefslogtreecommitdiff
path: root/vendor/github.com/rs/xid/hostid_darwin.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-09-02 13:08:54 +0200
committerLibravatar GitHub <noreply@github.com>2024-09-02 13:08:54 +0200
commitf924297af1db3665cdcb8ffbfda1cf584f4c4eb9 (patch)
tree86fb4aa6ddcd1809d8b8cc11d6c88137c80fd343 /vendor/github.com/rs/xid/hostid_darwin.go
parent[performance] use single-threaded image transforms (#3252) (diff)
downloadgotosocial-f924297af1db3665cdcb8ffbfda1cf584f4c4eb9.tar.xz
[chore]: Bump github.com/minio/minio-go/v7 from 7.0.75 to 7.0.76 (#3262)
Bumps [github.com/minio/minio-go/v7](https://github.com/minio/minio-go) from 7.0.75 to 7.0.76. - [Release notes](https://github.com/minio/minio-go/releases) - [Commits](https://github.com/minio/minio-go/compare/v7.0.75...v7.0.76) --- updated-dependencies: - dependency-name: github.com/minio/minio-go/v7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/rs/xid/hostid_darwin.go')
-rw-r--r--vendor/github.com/rs/xid/hostid_darwin.go29
1 files changed, 27 insertions, 2 deletions
diff --git a/vendor/github.com/rs/xid/hostid_darwin.go b/vendor/github.com/rs/xid/hostid_darwin.go
index 08351ff72..17351563a 100644
--- a/vendor/github.com/rs/xid/hostid_darwin.go
+++ b/vendor/github.com/rs/xid/hostid_darwin.go
@@ -2,8 +2,33 @@
package xid
-import "syscall"
+import (
+ "errors"
+ "os/exec"
+ "strings"
+)
func readPlatformMachineID() (string, error) {
- return syscall.Sysctl("kern.uuid")
+ ioreg, err := exec.LookPath("ioreg")
+ if err != nil {
+ return "", err
+ }
+
+ cmd := exec.Command(ioreg, "-rd1", "-c", "IOPlatformExpertDevice")
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ return "", err
+ }
+
+ for _, line := range strings.Split(string(out), "\n") {
+ if strings.Contains(line, "IOPlatformUUID") {
+ parts := strings.SplitAfter(line, `" = "`)
+ if len(parts) == 2 {
+ uuid := strings.TrimRight(parts[1], `"`)
+ return strings.ToLower(uuid), nil
+ }
+ }
+ }
+
+ return "", errors.New("cannot find host id")
}