When you try to run or compile a program, it generates errors. I rummaged through all the Russian Internet did not find anything like it. Win10 system. Program initial Hello world, there is no place to make mistakes. If someone helps, I will be very grateful.

C:\Go\src\golang-book\chapter2>go build main1.go # runtime ..\..\runtime\mstkbar.go:244:41: undefined: stkbar ..\..\runtime\utf8.go:16:17: surrogateMin redeclared in this block previous declaration at ..\..\runtime\rune.go:49:17 ..\..\runtime\utf8.go:17:17: surrogateMax redeclared in this block previous declaration at ..\..\runtime\rune.go:50:17 ..\..\runtime\utf8.go:21:7: t1 redeclared in this block previous declaration at ..\..\runtime\rune.go:31:33 ..\..\runtime\utf8.go:22:7: tx redeclared in this block previous declaration at ..\..\runtime\rune.go:32:33 ..\..\runtime\utf8.go:23:7: t2 redeclared in this block previous declaration at ..\..\runtime\rune.go:33:33 ..\..\runtime\utf8.go:24:7: t3 redeclared in this block previous declaration at ..\..\runtime\rune.go:34:33 ..\..\runtime\utf8.go:25:7: t4 redeclared in this block previous declaration at ..\..\runtime\rune.go:35:33 ..\..\runtime\utf8.go:26:7: t5 redeclared in this block previous declaration at ..\..\runtime\rune.go:36:33 ..\..\runtime\utf8.go:28:10: maskx redeclared in this block previous declaration at ..\..\runtime\rune.go:43:24 ..\..\runtime\mstkbar.go:244:41: too many errors 

Program Code:

 package main import "fmt" func main() { fmt.Println("Hello world") } 

Decision:

 Такие ошибки вылезают если поверх старой версии go (например 1.8) распаковать/установить более новую версию. Структура файлов стандартной библиотеки меняется от версии к версии, поэтому ставить go в каталог где уже установлена предыдущая версия go нельзя. Полностью удалите каталог в котором установлен go и после этого установите его заново. 

It all worked. Aninstalil GO himself, deleted the folder with the remnants, downloaded the latest installer from the off site site and everything started up. Thank you kvark128

  • Give an example of the program code. - Sergey Glazirin
  • If you have such a Helloworld, you have something with an installation. Add to the question how to install go. - Ainar-G

1 answer 1

Such errors get out if over the old version of go (for example 1.8) unpack / install a newer version. The file structure of the standard library changes from version to version, so you cannot put go in a directory where the previous version of go is not already installed. Completely delete the directory in which go is installed and then reinstall it.

  • Thank you very much. It all worked. Most likely namudril during installation. - Nikolay