2017-09-01 12 views
7

Mã này biên soạn OK sử dụng phiên bản trước của golang (1.8.3) tuy nhiên thất bại trong việc biên dịch sau khi nâng cấp lên golang (1,9)đi xây dựng không: thời gian chạy/mstkbar.go: 151: 10: debug.gcstackbarrieroff không xác định

mới
~/src/gopath/src/github.com/scottstensland/infosynth $ go build infosynth.go 
# runtime 
/usr/local/go/src/runtime/mstkbar.go:151:10: debug.gcstackbarrieroff undefined (type struct { allocfreetrace int32; cgocheck int32; efence int32; gccheckmark int32; gcpacertrace int32; gcshrinkstackoff int32; gcrescanstacks int32; gcstoptheworld int32; gctrace int32; invalidptr int32; sbrk int32; scavenge int32; scheddetail int32; schedtrace int32 } has no field or method gcstackbarrieroff) 
/usr/local/go/src/runtime/mstkbar.go:162:24: division by zero 
/usr/local/go/src/runtime/mstkbar.go:162:43: invalid expression unsafe.Sizeof(composite literal) 
/usr/local/go/src/runtime/mstkbar.go:162:44: undefined: stkbar 
/usr/local/go/src/runtime/mstkbar.go:212:4: gp.stkbar undefined (type *g has no field or method stkbar) 
/usr/local/go/src/runtime/mstkbar.go:213:15: gp.stkbar undefined (type *g has no field or method stkbar) 
/usr/local/go/src/runtime/mstkbar.go:216:23: undefined: stackBarrierPC 
/usr/local/go/src/runtime/mstkbar.go:226:28: gp.stkbarPos undefined (type *g has no field or method stkbarPos) 
/usr/local/go/src/runtime/mstkbar.go:227:19: gp.stkbarPos undefined (type *g has no field or method stkbarPos) 
/usr/local/go/src/runtime/mstkbar.go:248:41: undefined: stkbar 
/usr/local/go/src/runtime/mstkbar.go:227:19: too many errors 

Bất kỳ ý tưởng nào? Trên thực tế, lỗi này xảy ra cho bất kỳ phiên bản golang nâng cấp không chỉ là các phiên bản tôi đã đề cập ở đây.

PS Cũng nhận được cùng một lỗi khi phát hành: go get -v -t/...

Trả lời

21

SOLUTION:. Trước tiên bạn phải xóa golang trước cài đặt trước khi cài đặt phiên bản mới đi

type go # issue this to confirm where your go lives 

một đầu ra tiêu biểu:

go is /usr/local/go/bin/go # delete /usr/local/go not just /usr/local/go/bin/go 

vì vậy chỉ cần loại bỏ nó

sudo rm -rf /usr/local/go # OP's missing step else above errors 

trước khi cài đặt phiên bản mới

export golang_ver=$(curl https://golang.org/VERSION?m=text 2> /dev/null) 
wget https://storage.googleapis.com/golang/${golang_ver}.linux-amd64.tar.gz 
sudo tar -C /usr/local -xzf ${golang_ver}.linux-amd64.tar.gz 
1

tôi sử dụng Windows 10. Tôi phải gỡ bỏ go18 với Control Panel (không tin tưởng trình cài đặt 1.9 khi anh ta yêu cầu gỡ bỏ phiên bản cũ - làm điều đó bằng tay). Sau đó tôi gỡ bỏ c: \ go - goroot mặc định và chỉ sau này - cài đặt 1.9. Trong trường hợp của tôi là 1.9.2 Và tất nhiên hãy kiểm tra GOROOT & & GOPATH

của bạn
Các vấn đề liên quan