If my .go files (all files declared as main mackage) lays in the root of project folder, then go build does nothing but threre are no errors in terminal
and if my .go files (all files declared as main mackage) lays in main folder, then if I run go build it produces executable in the main folder.
And that while you’re in the main/ folder, go build works but in /root/folder/, it doesn’t.
The reason is that Go packages must all be in the same folder. When you run go build from /root/folder/, go build looks for .go files in that folder to build a package. go build does not traverse the directory structure from the current directory and build subpackages.
To build your main package from /root/folder/, run go build ./main from that folder. I think the program will still end up being called main, though.