diff --git a/rlimit/rlimit.go b/rlimit/rlimit_linux.go similarity index 97% rename from rlimit/rlimit.go rename to rlimit/rlimit_linux.go index efbf1af29..1c25a7ef4 100644 --- a/rlimit/rlimit.go +++ b/rlimit/rlimit_linux.go @@ -1,3 +1,5 @@ +//go:build linux + // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 diff --git a/rlimit/rlimit_other.go b/rlimit/rlimit_other.go new file mode 100644 index 000000000..e851314fe --- /dev/null +++ b/rlimit/rlimit_other.go @@ -0,0 +1,17 @@ +//go:build !linux + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package rlimit // import "go.opentelemetry.io/ebpf-profiler/rlimit" + +import ( + "fmt" + "runtime" +) + +// MaximizeMemlock is the stub implementation, allowing to compile the rlimit +// package on non-linux systems, always failing at runtime with an error if used. +func MaximizeMemlock() (func(), error) { + return nil, fmt.Errorf("unsupported os %s", runtime.GOOS) +}