Skip to content

Commit b4f334b

Browse files
committed
feat(arch): add loongarch64 support
Signed-off-by: yzewei <[email protected]>
1 parent f460879 commit b4f334b

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ ifneq "$(strip $(LOCAL))" "true"
7272
override EMBEDDED_FILES_CHECK = fs/assets/check.txt
7373
endif
7474

75+
RACE =
76+
ifneq ($(arch), loong64)
77+
RACE :=
78+
else
79+
RACE := -race
80+
endif
81+
7582
# when build for local development (`LOCAL=true make install` can skip license check)
7683
$(BUILD_DIR)/$(PROJECT): $(EMBEDDED_FILES_CHECK) $(GO_FILES) $(BUILD_DIR)
7784
$(eval ldflags = $(GO_LDFLAGS) $(patsubst %,-extldflags \"%\",$(LDFLAGS_$(GOOS))))
@@ -111,18 +118,18 @@ $(BUILD_DIR):
111118

112119
.PHONY: test
113120
test: $(BUILD_DIR)
114-
@ ./hack/gotest.sh -count=1 -race -short -timeout=90s $(SKAFFOLD_TEST_PACKAGES)
121+
@ ./hack/gotest.sh -count=1 $(RACE) -short -timeout=90s $(SKAFFOLD_TEST_PACKAGES)
115122
@ ./hack/checks.sh
116123
@ ./hack/linters.sh
117124

118125
.PHONY: unit-tests
119126
unit-tests: $(BUILD_DIR)
120-
@ ./hack/gotest.sh -count=1 -race -short -timeout=90s $(SKAFFOLD_TEST_PACKAGES)
127+
@ ./hack/gotest.sh -count=1 $(RACE) -short -timeout=90s $(SKAFFOLD_TEST_PACKAGES)
121128

122129
.PHONY: coverage
123130
coverage: $(BUILD_DIR)
124131
# https://go-review.git.corp.google.com/c/go/+/569575
125-
@ GOEXPERIMENT=nocoverageredesign ./hack/gotest.sh -count=1 -race -cover -short -timeout=90s -coverprofile=out/coverage.txt -coverpkg="./pkg/...,./cmd/..." $(SKAFFOLD_TEST_PACKAGES)
132+
@ GOEXPERIMENT=nocoverageredesign ./hack/gotest.sh -count=1 $(RACE) -cover -short -timeout=90s -coverprofile=out/coverage.txt -coverpkg="./pkg/...,./cmd/..." $(SKAFFOLD_TEST_PACKAGES)
126133
@- curl -s https://codecov.io/bash > $(BUILD_DIR)/upload_coverage && bash $(BUILD_DIR)/upload_coverage
127134

128135
.PHONY: checks

hack/install-golint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ is_supported_platform() {
7272
linux/386) found=0 ;;
7373
linux/arm64) found=0 ;;
7474
linux/riscv64) found=0 ;;
75+
linux/loong64) found=0 ;;
7576
esac
7677
return $found
7778
}
@@ -191,6 +192,7 @@ uname_arch() {
191192
armv6*) arch="armv6" ;;
192193
armv7*) arch="armv7" ;;
193194
riscv64) arch="riscv64" ;;
195+
linux/loong64) found=0 ;;
194196
esac
195197
echo ${arch}
196198
}
@@ -230,6 +232,7 @@ uname_arch_check() {
230232
s390x) return 0 ;;
231233
amd64p32) return 0 ;;
232234
riscv64) return 0 ;;
235+
linux/loong64) found=0 ;;
233236
esac
234237
log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib"
235238
return 1

pkg/skaffold/platform/platform.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func isKnownOS(os string) error {
142142
// Unexported function copied from "github.com/containerd/containerd/platforms"
143143
func isKnownArch(arch string) error {
144144
switch arch {
145-
case "386", "amd64", "amd64p32", "arm", "armbe", "arm64", "arm64be", "ppc64", "ppc64le", "mips", "mipsle", "mips64", "mips64le", "mips64p32", "mips64p32le", "ppc", "riscv", "riscv64", "s390", "s390x", "sparc", "sparc64", "wasm":
145+
case "386", "amd64", "amd64p32", "arm", "armbe", "arm64", "arm64be", "ppc64", "ppc64le", "mips", "mipsle", "mips64", "mips64le", "mips64p32", "mips64p32le", "loong64", "ppc", "riscv", "riscv64", "s390", "s390x", "sparc", "sparc64", "wasm":
146146
return nil
147147
}
148148
return fmt.Errorf("unknown architecture %q", arch)

0 commit comments

Comments
 (0)