You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Similarityoung (via GitHub)" <gi...@apache.org> on 2026/05/24 11:05:12 UTC

[PR] fix: auto-detect native GOARCH instead of hardcoding amd64 [dubbo-go-pixiu-samples]

Similarityoung opened a new pull request, #157:
URL: https://github.com/apache/dubbo-go-pixiu-samples/pull/157

   ## Summary
   - Fixes `igt/Makefile` to auto-detect native CPU architecture via `uname -m` instead of hardcoding `GOARCH=amd64`
   - On Apple Silicon Macs, AMD64 cross-compilation under Rosetta 2 causes TCP connection resets, breaking all integration tests
   
   ## Test plan
   - [x] Run all 20 integration tests on Apple Silicon (ARM64) Mac
   - [x] Verify `uname -m` returns correct architecture on both ARM64 and AMD64
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix: auto-detect native GOARCH instead of hardcoding amd64 [dubbo-go-pixiu-samples]

Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks merged PR #157:
URL: https://github.com/apache/dubbo-go-pixiu-samples/pull/157


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix: auto-detect native GOARCH instead of hardcoding amd64 [dubbo-go-pixiu-samples]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #157:
URL: https://github.com/apache/dubbo-go-pixiu-samples/pull/157#discussion_r3295838897


##########
igt/Makefile:
##########
@@ -30,7 +30,12 @@ pixiuSources = $(wildcard $(PIXIU_DIR)/pixiu/*.go)
 export GO111MODULE ?= on
 export GOPROXY ?= https://goproxy.io,direct
 export GOSUMDB ?= sum.golang.org
-export GOARCH ?= amd64
+NATIVE_ARCH := $(shell uname -m)
+ifeq ($(NATIVE_ARCH), arm64)
+	export GOARCH ?= arm64
+else
+	export GOARCH ?= amd64

Review Comment:
    if else里面都是amd64 和硬编码有什么区别



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix: auto-detect native GOARCH instead of hardcoding amd64 [dubbo-go-pixiu-samples]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #157:
URL: https://github.com/apache/dubbo-go-pixiu-samples/pull/157#discussion_r3294313271


##########
igt/Makefile:
##########
@@ -30,7 +30,12 @@ pixiuSources = $(wildcard $(PIXIU_DIR)/pixiu/*.go)
 export GO111MODULE ?= on
 export GOPROXY ?= https://goproxy.io,direct
 export GOSUMDB ?= sum.golang.org
-export GOARCH ?= amd64
+NATIVE_ARCH := $(shell uname -m)
+ifeq ($(NATIVE_ARCH), arm64)
+	export GOARCH ?= arm64
+else
+	export GOARCH ?= amd64

Review Comment:
   These lines appear to start with a tab. In Makefiles, a leading tab at the top level is interpreted as a recipe line and can trigger errors like `recipe commences before first target`. Remove the leading tab/indentation so `export GOARCH ?= ...` is a normal directive (consistent with the surrounding `export` lines).
   



##########
igt/Makefile:
##########
@@ -30,7 +30,12 @@ pixiuSources = $(wildcard $(PIXIU_DIR)/pixiu/*.go)
 export GO111MODULE ?= on
 export GOPROXY ?= https://goproxy.io,direct
 export GOSUMDB ?= sum.golang.org
-export GOARCH ?= amd64
+NATIVE_ARCH := $(shell uname -m)
+ifeq ($(NATIVE_ARCH), arm64)
+	export GOARCH ?= arm64
+else
+	export GOARCH ?= amd64
+endif

Review Comment:
   `uname -m` commonly returns `aarch64` on Linux (not `arm64`), and `x86_64` on Intel/AMD machines (not `amd64`). With the current equality check, an ARM64 Linux host would likely fall into the `amd64` branch and produce incorrect builds. Consider normalizing `NATIVE_ARCH` (e.g., mapping `aarch64` -> `arm64`, `x86_64` -> `amd64`) or defaulting `GOARCH` from `go env GOARCH` when available, while still allowing overrides via `GOARCH ?=`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix: auto-detect native GOARCH instead of hardcoding amd64 [dubbo-go-pixiu-samples]

Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #157:
URL: https://github.com/apache/dubbo-go-pixiu-samples/pull/157#discussion_r3295423205


##########
igt/Makefile:
##########
@@ -30,7 +30,12 @@ pixiuSources = $(wildcard $(PIXIU_DIR)/pixiu/*.go)
 export GO111MODULE ?= on
 export GOPROXY ?= https://goproxy.io,direct
 export GOSUMDB ?= sum.golang.org
-export GOARCH ?= amd64
+NATIVE_ARCH := $(shell uname -m)
+ifeq ($(NATIVE_ARCH), arm64)

Review Comment:
   [P1] 这里只识别 `arm64`,但 Linux ARM64 主机的 `uname -m` 通常返回 `aarch64`,因此在常见 ARM Linux 环境仍会落到 `GOARCH=amd64`,没有达到“自动检测 native GOARCH”的目的。这个 Makefile 已经依赖 Go,建议直接 `export GOARCH ?= $(shell go env GOARCH)`;如果继续用 `uname -m`,至少需要把 `aarch64` 映射到 `arm64`,`x86_64` 映射到 `amd64`,其他架构回退到 `go env GOARCH`。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix: auto-detect native GOARCH instead of hardcoding amd64 [dubbo-go-pixiu-samples]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #157:
URL: https://github.com/apache/dubbo-go-pixiu-samples/pull/157#discussion_r3294771693


##########
igt/Makefile:
##########
@@ -30,7 +30,12 @@ pixiuSources = $(wildcard $(PIXIU_DIR)/pixiu/*.go)
 export GO111MODULE ?= on
 export GOPROXY ?= https://goproxy.io,direct
 export GOSUMDB ?= sum.golang.org
-export GOARCH ?= amd64
+NATIVE_ARCH := $(shell uname -m)
+ifeq ($(NATIVE_ARCH), arm64)
+	export GOARCH ?= arm64
+else
+	export GOARCH ?= amd64

Review Comment:
   else 里面还是amd64 那和不加有啥区别



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix: auto-detect native GOARCH instead of hardcoding amd64 [dubbo-go-pixiu-samples]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #157:
URL: https://github.com/apache/dubbo-go-pixiu-samples/pull/157#discussion_r3295846880


##########
igt/Makefile:
##########
@@ -30,7 +30,12 @@ pixiuSources = $(wildcard $(PIXIU_DIR)/pixiu/*.go)
 export GO111MODULE ?= on
 export GOPROXY ?= https://goproxy.io,direct
 export GOSUMDB ?= sum.golang.org
-export GOARCH ?= amd64
+NATIVE_ARCH := $(shell uname -m)
+ifeq ($(NATIVE_ARCH), arm64)
+	export GOARCH ?= arm64
+else
+	export GOARCH ?= amd64

Review Comment:
   噢噢噢 看错了



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix: auto-detect native GOARCH instead of hardcoding amd64 [dubbo-go-pixiu-samples]

Posted by "Similarityoung (via GitHub)" <gi...@apache.org>.
Similarityoung commented on code in PR #157:
URL: https://github.com/apache/dubbo-go-pixiu-samples/pull/157#discussion_r3294798877


##########
igt/Makefile:
##########
@@ -30,7 +30,12 @@ pixiuSources = $(wildcard $(PIXIU_DIR)/pixiu/*.go)
 export GO111MODULE ?= on
 export GOPROXY ?= https://goproxy.io,direct
 export GOSUMDB ?= sum.golang.org
-export GOARCH ?= amd64
+NATIVE_ARCH := $(shell uname -m)
+ifeq ($(NATIVE_ARCH), arm64)
+	export GOARCH ?= arm64
+else
+	export GOARCH ?= amd64

Review Comment:
   我把之前硬编码的 amd64 改成 if else 了,主要是用来方便本地跑集成测试的。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org