From c0ae83f891c76f5c34f263bf3a5b99c2185f0512 Mon Sep 17 00:00:00 2001 From: Sylvain Rabot Date: Thu, 11 Jun 2020 21:34:47 +0200 Subject: [PATCH] Use build tags to make it compile on non linux platforms Signed-off-by: Sylvain Rabot --- internal/runtime/{cpu.go => cpu_linux.go} | 2 ++ internal/runtime/cpu_notlinux.go | 28 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) rename internal/runtime/{cpu.go => cpu_linux.go} (99%) create mode 100644 internal/runtime/cpu_notlinux.go diff --git a/internal/runtime/cpu.go b/internal/runtime/cpu_linux.go similarity index 99% rename from internal/runtime/cpu.go rename to internal/runtime/cpu_linux.go index f2f9377c6..41b969df1 100644 --- a/internal/runtime/cpu.go +++ b/internal/runtime/cpu_linux.go @@ -1,3 +1,5 @@ +// +build linux + /* Copyright 2018 The Kubernetes Authors. diff --git a/internal/runtime/cpu_notlinux.go b/internal/runtime/cpu_notlinux.go new file mode 100644 index 000000000..86a649e62 --- /dev/null +++ b/internal/runtime/cpu_notlinux.go @@ -0,0 +1,28 @@ +// +build !linux + +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package runtime + +import ( + "runtime" +) + +// NumCPU ... +func NumCPU() int { + return runtime.NumCPU() +}