From 6dd523292e5912943dd826ca086c2faa9b872ec7 Mon Sep 17 00:00:00 2001 From: Zhuowei Wang Date: Mon, 16 Sep 2024 10:48:43 +0800 Subject: [PATCH] feat: support non arm or amd arch --- runtimex.go | 2 ++ runtimex_other.go | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 runtimex_other.go diff --git a/runtimex.go b/runtimex.go index 6fb5a87..057eef3 100644 --- a/runtimex.go +++ b/runtimex.go @@ -1,3 +1,5 @@ +//go:build arm64 || amd64 + // Copyright 2024 CloudWeGo Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/runtimex_other.go b/runtimex_other.go new file mode 100644 index 0000000..69047da --- /dev/null +++ b/runtimex_other.go @@ -0,0 +1,32 @@ +//go:build !(arm64 || amd64) + +// Copyright 2024 CloudWeGo 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 runtimex + +import ( + "fmt" + "runtime" +) + +var ErrUnimplemented = fmt.Errorf("runtimex: unimplemented in this platform[%s]", runtime.GOARCH) + +func GID() (int, error) { + return 0, ErrUnimplemented +} + +func PID() (int, error) { + return 0, ErrUnimplemented +}