From f56aa0c06cf9f5f0707aed2947c641b2b5795177 Mon Sep 17 00:00:00 2001 From: Herman Slatman Date: Tue, 1 Oct 2024 10:11:32 +0200 Subject: [PATCH] Fix `GOOS=js` builds with nops --- v3/internal/sysinfo/memtotal_js.go | 11 +++++++++++ v3/internal/sysinfo/usage_js.go | 11 +++++++++++ v3/internal/sysinfo/usage_posix.go | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 v3/internal/sysinfo/memtotal_js.go create mode 100644 v3/internal/sysinfo/usage_js.go diff --git a/v3/internal/sysinfo/memtotal_js.go b/v3/internal/sysinfo/memtotal_js.go new file mode 100644 index 000000000..a0d81766f --- /dev/null +++ b/v3/internal/sysinfo/memtotal_js.go @@ -0,0 +1,11 @@ +// Copyright 2020 New Relic Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +package sysinfo + +import "errors" + +// PhysicalMemoryBytes returns the total amount of host memory. +func PhysicalMemoryBytes() (uint64, error) { + return 0, errors.New("not supported on GOOS=js") +} diff --git a/v3/internal/sysinfo/usage_js.go b/v3/internal/sysinfo/usage_js.go new file mode 100644 index 000000000..74f8ce160 --- /dev/null +++ b/v3/internal/sysinfo/usage_js.go @@ -0,0 +1,11 @@ +// Copyright 2020 New Relic Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +package sysinfo + +import "errors" + +// GetUsage gathers process times. +func GetUsage() (Usage, error) { + return Usage{}, errors.New("not supported on GOOS=js") +} diff --git a/v3/internal/sysinfo/usage_posix.go b/v3/internal/sysinfo/usage_posix.go index 4d758dea1..5b553fd90 100644 --- a/v3/internal/sysinfo/usage_posix.go +++ b/v3/internal/sysinfo/usage_posix.go @@ -1,7 +1,7 @@ // Copyright 2020 New Relic Corporation. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -// +build !windows +// +build !windows,!js package sysinfo