feat: 自动发布realease

This commit is contained in:
Akizon77
2025-04-29 20:57:23 +08:00
parent f21001c71e
commit 79d1760163
13 changed files with 324 additions and 238 deletions

32
monitoring/os_linux.go Normal file
View File

@@ -0,0 +1,32 @@
//go:build linux
// +build linux
package monitoring
import (
"bufio"
"os"
"strings"
)
func OSName() string {
file, err := os.Open("/etc/os-release")
if err != nil {
return "Linux"
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := scanner.Text()
if strings.HasPrefix(line, "PRETTY_NAME=") {
return strings.Trim(line[len("PRETTY_NAME="):], `"`)
}
}
if err := scanner.Err(); err != nil {
return "Linux"
}
return "Linux"
}