VSCode 'main redeclared in this block' - any way to avoid it?

I just started with Go - the way I usually approach new language is by tweaking and experimenting with every element - which means producing a lot of simple files testing just one aspect of library package. So Go forcing me to keep every one of 8 different ideas to tackle something in a separate folder is somewhat annoying.
Of course I can just use VSCode as editor and run stuff from command line but at some point I will want to run debugger to really see what is happening.
Is there any way I can structure my study project to keep bunch of sketches in same folder?

1 Like

You could make each “project” a function in a separate file and part of the main package. Then you can call each of these functions in the single main function.

The main function therefore, just gives you an “entrypoint” where you kick off all your different projects (functions).

Other than that I don’t see a way around having everything in one folder. You can only have one main function in a package.

1 Like

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