Separate directories! - main redeclared in this block
- Put each example / exercise in a separate directory
- As each package must have only one main() function.
examples/same/same_one.go
package main import ( "fmt" ) func main() { fmt.Println("Hello Same One") }
examples/same/same_two.go
package main import ( "fmt" ) func main() { fmt.Println("Hello Same Two") }
go run .
# _/home/gabor/work/slides/golang/examples/same ./same_two.go:7:6: main redeclared in this block previous declaration at ./same_one.go:7:6