You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS 12中VSCode安装Go开发扩展报错:setresgid/setresuid隐式声明

MacOS 12下安装VSCode Go扩展编译错误解决

错误信息

linux_syscall.c:67:13: note: did you mean 'setregid'?
runtime/cgo
linux_syscall.c:67:13: 错误:函数'setresgid'的隐式声明在C99中无效 [-Werror,-Wimplicit-function-declaration]
linux_syscall.c:67:13: 提示:你是不是想使用'setregid'?
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/unistd.h:593:6: 提示:'setregid'在此处声明
linux_syscall.c:73:13: 错误:函数'setresuid'的隐式声明在C99中无效 [-Werror,-Wimplicit-function-declaration]
linux_syscall.c:73:13: 提示:你是不是想使用'setreuid'?
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/unistd.h:595:6: 提示:'setreuid'在此处声明

解决步骤

  • 检查并重置Go环境变量:
    打开终端执行go env,确认GOOS为darwin,GOARCH根据芯片类型为amd64(Intel芯片)或arm64(M系列芯片)。若不符,执行以下命令修正:
    go env -w GOOS=darwin
    go env -w GOARCH=amd64 # M系列芯片替换为 arm64
    
  • 重新安装Go扩展依赖工具:
    在VSCode中按下Cmd+Shift+P,输入Go: Install/Update Tools,选择全部工具完成安装。
  • 重置Command Line Tools(若上述步骤无效):
    终端执行xcode-select --install,完成安装后重启VSCode重试。

内容的提问来源于stack exchange,提问作者Bruce Dong

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 13:45:53