From a78ca42334f20ee42ed308c04992527765e8f4d2 Mon Sep 17 00:00:00 2001 From: Taufik Rama Date: Wed, 6 Apr 2022 13:18:38 +0700 Subject: [PATCH] Added noop operations for js/wasm build target --- internal/sysinfo/memtotal_js.go | 13 +++++++++++++ internal/sysinfo/usage_js.go | 13 +++++++++++++ internal/sysinfo/usage_posix.go | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 internal/sysinfo/memtotal_js.go create mode 100644 internal/sysinfo/usage_js.go diff --git a/internal/sysinfo/memtotal_js.go b/internal/sysinfo/memtotal_js.go new file mode 100644 index 000000000..45ff92792 --- /dev/null +++ b/internal/sysinfo/memtotal_js.go @@ -0,0 +1,13 @@ +// Copyright 2020 New Relic Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +//go:build js && wasm + +package sysinfo + +import "errors" + +// PhysicalMemoryBytes returns the total amount of host memory. +func PhysicalMemoryBytes() (uint64, error) { + return 0, errors.New("unsupported js/wasm arch") +} diff --git a/internal/sysinfo/usage_js.go b/internal/sysinfo/usage_js.go new file mode 100644 index 000000000..8b19bc296 --- /dev/null +++ b/internal/sysinfo/usage_js.go @@ -0,0 +1,13 @@ +// Copyright 2020 New Relic Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +//go:build js && wasm + +package sysinfo + +import "errors" + +// GetUsage gathers process times. +func GetUsage() (Usage, error) { + return Usage{}, errors.New("unsupported js/wasm arch") +} diff --git a/internal/sysinfo/usage_posix.go b/internal/sysinfo/usage_posix.go index 4d758dea1..335261f3c 100644 --- a/internal/sysinfo/usage_posix.go +++ b/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 +//go:build !windows && !(js && wasm) package sysinfo