'main redeclared in this block' warning

This warning pops up in VS code;

main redeclared in this block
previous declaration at

I have my go practice files in one directory and each file has a func main() block.

Is anyone familiar with the warning? if so how may I resolve.

3 Likes

there can be only one main function in a package.

6 Likes

@kync Many thanks, I therefore created a separate directory for each file.

image

3 Likes

Good to see, you solved your problem. Please, mark the question as answered.

2 Likes

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