Go Language Error: main redeclared in this block [How to Solve]

F5 go error: main redeclared in this block

The reason is that there cannot be more than one package main under the same directory

Solution: create two folders hello and main respectively, put the files in them, and execute F5 again. There will be no problem.

Read More: