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 1.5.1 更新的功能

Go 1.5.1版本对编译器,汇编器, fmt, net/textproto, net/http, 和 runtime 包的 bug 修复。...

Go 清理模块缓存

随着模块不断升级,时间久了,`pkg` 目录越来越大,导致专门为 Linux 下编译开的虚拟机空间爆满。...

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

Submit Comment Login
Based on Golang + fastHTTP + sdb | go1.22.3 Processed in 0ms