When I run "go test", I want to use a different configuration file. How do I know within my code if I'm running within a test context or a normal context? Is there some sort of environment variable to check?


Question: Compiling in Code::Blocks with Dependencies
Answer: CodeBlocks offers the ability to execute pre or post build things. Checkout menu "Project->Build options", and under the "Pre/Post build steps" tab, you can insert any shell command you want. For example:



When hitting F9, you will see:

-------------- Build: Release in aaa (compiler: GNU GCC Compiler)---------------
Target is up to date.
Running target post-build steps
echo "Hi"
Hi
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)


So you can add here any command you want to gather you files together, for example something like (using 7-zip):

7z a my_archive.zip myfile1.exe myfile2.dll readme.txt


Be advised that this will be executed at every build which is not something you might want: when compiling a minor change in program, you don't want to wait for the archive program. So maybe do this only in a special build target.