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语言中LittleEndian与BigEndian区别

Go 语言中,`LittleEndian` 和 `BigEndian` 是 `encoding/binary` 包中定义的两种字节序(Byte Order),它们决定了多字节数据在内存中的存储方式。...

Go Modules 使用备忘

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

Go 1.5.1 更新的功能

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

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