GolangNote

Golang笔记

Go build 错误 “stackcheck redeclared in this block previous declaration”的解决方法

Permalink

go 1.13 刚发布,这个版本改变比较多,一般 go 升级后都会习惯的跟着升级主程序。这次升级后 build 时遇到了 stack check redeclared in this block previous declaration 错误。

Bash: go runtime err
1
2
3
4
5
6
7
# runtime
/usr/local/go/src/runtime/stubs_x86.go:10:6: stackcheck redeclared in this block
    previous declaration at /usr/local/go/src/runtime/stubs_amd64x.go:10:6
/usr/local/go/src/runtime/unaligned1.go:11:6: readUnaligned32 redeclared in this block
    previous declaration at /usr/local/go/src/runtime/alg.go:321:40
/usr/local/go/src/runtime/unaligned1.go:15:6: readUnaligned64 redeclared in this block
    previous declaration at /usr/local/go/src/runtime/alg.go:329:40

原因是升级时直接覆盖,导致有些丢弃的库报错,解决方法是先删掉旧的 go pkgs ,再解压 go SDK 包

Bash: rm go
1
2
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz

目前的 go 最新版

Bash: go version
1
2
$ go version
go version go1.13 linux/amd64

本文网址: https://golangnote.com/topic/263.html 转摘请注明来源

Related articles

Go 编程格言谚语

这些 go 格言谚语大多出自 Rob Pike 振奋人心的演讲视频,有很大参考价值。...

Go Modules 使用备忘

简单说 Go Modules 就是包管理,从 go1.11 开始支持,可以不需要gopath存在,环境变量`GO111MODULE`,默认为 `auto` 项目存在 `go.mod` 则使用 go module ,否则使用GOPATH 和 vendor 机制。...

Write a Comment to "Go build 错误 “stackcheck redeclared in this block previous declaration”的解决方法"

Submit Comment Login
Based on Golang + fastHTTP + sdb | go1.17 Processed in 1ms