Go Template for Competitive Programming
- Install the Go programming lanugage. You can download it here.
- Optionally, install a text editor. I like using Visual Studio Code.
- Put your files in the
src/folder. I prefer to put them in subfolders, likesrc/codeforcesorsrc/topcoder. - If your program reads from
stdin, then you can use the templatesrc/#templates/template.go, which has wrappers for readingstdinand printing tostdout. - Put your input in
io/in.txt. - To build
some_program.go, run the command.\run some_program. Note that it does not include the.goextension. It will find any file with the matching name in thesrc/folder, so avoid having duplicate names of source files, even if they are in different subdirectories. This will build and run the source code, putting the executable in thebin/folder. - The program output and build errors will be printed in the console, but you can also look at
io/out.txtandio/err.txt.