Run and build don't work (Win 10)

I installed go, put in the environment variables, ran ‘go version’ and I get ‘go version go1.14 windows/amd64’. I created the hello world program by copying it from the installation guide, and when I try ‘go run hello.go’ (hello.go is in the directory I’m using), I get

runtime/internal/atomic

…\runtime\internal\atomic\atomic_amd64x.go:13:6: Load redeclared in this block
previous declaration at …\runtime\internal\atomic\atomic_amd64.go:16:24
…\runtime\internal\atomic\atomic_amd64x.go:19:6: Loadp redeclared in this block
previous declaration at …\runtime\internal\atomic\atomic_amd64.go:22:32
…\runtime\internal\atomic\atomic_amd64x.go:25:6: Load64 redeclared in this block
previous declaration at …\runtime\internal\atomic\atomic_amd64.go:28:26
…\runtime\internal\atomic\atomic_amd64x.go:30:6: Xadd redeclared in this block
previous declaration at …\runtime\internal\atomic\atomic_amd64.go:39:37
…\runtime\internal\atomic\atomic_amd64x.go:33:6: Xadd64 redeclared in this block
previous declaration at …\runtime\internal\atomic\atomic_amd64.go:42:39
…\runtime\internal\atomic\atomic_amd64x.go:36:6: Xadduintptr redeclared in this block
previous declaration at …\runtime\internal\atomic\atomic_amd64.go:45:47
…\runtime\internal\atomic\atomic_amd64x.go:39:6: Xchg redeclared in this block
previous declaration at …\runtime\internal\atomic\atomic_amd64.go:48:36
…\runtime\internal\atomic\atomic_amd64x.go:42:6: Xchg64 redeclared in this block
previous declaration at …\runtime\internal\atomic\atomic_amd64.go:51:38
…\runtime\internal\atomic\atomic_amd64x.go:45:6: Xchguintptr redeclared in this block
previous declaration at …\runtime\internal\atomic\atomic_amd64.go:54:45
…\runtime\internal\atomic\atomic_amd64x.go:48:6: And8 redeclared in this block
previous declaration at …\runtime\internal\atomic\atomic_amd64.go:63:27
…\runtime\internal\atomic\atomic_amd64x.go:48:6: too many errors
Same stuff when I do ‘go build hello.go’. What am I missing?

Your go installation seems toast. Did you unpack one version of go on top of another? I suggest removing and reinstalling.

Just did that. Same problem…

What’s the output of ‘go env’? Do you have go installed in WSL as well? What’s the output of ‘go env’ in WSL?

What’s happening is that you have two installations somehow overlapping.You need to figure out why that is.

It looks similar to your problem.

1 Like

I removed go again, then deleted all files currently in the go folder, and started again. This time it worked. Problem solved, but not sure why…

1 Like

Cooooool! “Problem solved, but not sure why…” That’s the art of programming :joy: :joy: happy coding!

At leat he wrote the steps he followed helping future gophers.