Skip to content

Commit 618e5b4

Browse files
committed
fix purego build errors on non-supported architectures
1 parent 42c3ca5 commit 618e5b4

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

agent/gpu_nvml.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build (linux || windows) && (amd64 || arm64)
2+
13
package agent
24

35
import (

agent/gpu_nvml_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
//go:build linux
1+
//go:build linux && (amd64 || arm64)
22

33
package agent
44

55
import (
6+
"log/slog"
67
"os"
78
"path/filepath"
89
"strings"
910

1011
"github.com/ebitengine/purego"
11-
"log/slog"
1212
)
1313

1414
func openLibrary(name string) (uintptr, error) {

agent/gpu_nvml_unsupported.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
//go:build !linux && !windows
1+
//go:build (!linux && !windows) || (!amd64 && !arm64)
22

33
package agent
44

55
import "fmt"
66

7+
type nvmlCollector struct {
8+
gm *GPUManager
9+
}
10+
11+
func (c *nvmlCollector) init() error {
12+
return fmt.Errorf("nvml not supported on this platform")
13+
}
14+
15+
func (c *nvmlCollector) start() {}
16+
17+
func (c *nvmlCollector) collect() {}
18+
719
func openLibrary(name string) (uintptr, error) {
820
return 0, fmt.Errorf("nvml not supported on this platform")
921
}

agent/gpu_nvml_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build windows
1+
//go:build windows && (amd64 || arm64)
22

33
package agent
44

0 commit comments

Comments
 (0)