fix purego build errors on non-supported architectures

This commit is contained in:
henrygd
2026-01-11 17:48:19 -05:00
parent 42c3ca5db5
commit 618e5b4cc1
4 changed files with 18 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
//go:build (linux || windows) && (amd64 || arm64)
package agent package agent
import ( import (

View File

@@ -1,14 +1,14 @@
//go:build linux //go:build linux && (amd64 || arm64)
package agent package agent
import ( import (
"log/slog"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/ebitengine/purego" "github.com/ebitengine/purego"
"log/slog"
) )
func openLibrary(name string) (uintptr, error) { func openLibrary(name string) (uintptr, error) {

View File

@@ -1,9 +1,21 @@
//go:build !linux && !windows //go:build (!linux && !windows) || (!amd64 && !arm64)
package agent package agent
import "fmt" import "fmt"
type nvmlCollector struct {
gm *GPUManager
}
func (c *nvmlCollector) init() error {
return fmt.Errorf("nvml not supported on this platform")
}
func (c *nvmlCollector) start() {}
func (c *nvmlCollector) collect() {}
func openLibrary(name string) (uintptr, error) { func openLibrary(name string) (uintptr, error) {
return 0, fmt.Errorf("nvml not supported on this platform") return 0, fmt.Errorf("nvml not supported on this platform")
} }

View File

@@ -1,4 +1,4 @@
//go:build windows //go:build windows && (amd64 || arm64)
package agent package agent