Skip to content

Commit

Permalink
version/DetectOS()
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Jul 15, 2024
1 parent fa64688 commit 1206e7d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions version/os.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package version

import (
"github.com/blackfireio/osinfo"

Check failure on line 4 in version/os.go

View workflow job for this annotation

GitHub Actions / Tests

no required module provides package github.com/blackfireio/osinfo; to add it:
)

func DetectOS() (string, string) {
osInfo, err := osinfo.GetOSInfo()
if err != nil {
return System, "???"
}

if osInfo.Name != "" && System == "docker" {
return osInfo.Name + " (docker)", osInfo.Version
}

return osInfo.Name, osInfo.Version
}

0 comments on commit 1206e7d

Please sign in to comment.