Newbie compile error for bufio

I’m just starting to look at go (writing code for 40 years). I’m stepping through “Head First Go”.

Here’s my version info: go version go1.12.7 windows/amd64 .

My simple current test case is this:

package main

import (

func main() {
	fmt.Print("Enter a grade: ")
	reader := bufio.NewReader(os.Stdin)
	input := reader.ReadString('\n')

When I run “go run” on this, I get:
# bytes
c:\go\src\bytes\bytes_decl.go:10:6: IndexByte redeclared in this block
previous declaration at c:\go\src\bytes\bytes.go:101:34
c:\go\src\bytes\bytes_decl.go:17:6: Equal redeclared in this block
previous declaration at c:\go\src\bytes\bytes.go:18:25
c:\go\src\bytes\bytes_decl.go:24:6: Compare redeclared in this block
previous declaration at c:\go\src\bytes\bytes.go:37:27

1 Like

Never mind, seems like my go installation was corrupted. I thought I installed it for the first time today, but there’s an indication that I had installed it earlier this month (perhaps when 1.11 was the latest release?). I uninstalled it (and made sure c:\go was gone) and reinstalled, and my test case is now working.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.