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() +}