The error
When you execute:
go build if(typeof __ez_fad_position != 'undefined'){__ez_fad_position('div-gpt-ad-tutorials_technology-medrectangle-3-0')}; You get the error:
runtime.main_main·f: function main is undeclared in the main package
Solution
The error above means that there is a file with package main that is missing the main function required when you use the package main. Please check all the files of your project which contains the package main and verify if the package name is correct or if you need to add the function main.
Also, make sure the following statements:
-
You only have one func main in the file which uses package main.
-
You have defined the function func main(){}