Recompile only changed files in Go when using C++ lib

190 views Asked by At

I am new to go. I use go-tdlib which in turn uses tdlib written in C++. First time the compilation took about 15-20 minutes, then I literally added one commented line to my Go main func (I just copypasted the example from go-tdlib, so it is just one small main func) and when I want to run the program it again takes 15-20 minutes to compile it. Is there any way to recompile only changed file? I tried go build and go install and I did not find yet any helpful solutions to this.

As I understand, Go compiles everything to one executable, and any change to one file triggers recompilation of everything. Is this correct? Is there any way to stop this? It is really annoying to wait 15-20 minutes when you added only one line to your main func.

Btw, I think it's due to the C++ lib, because if I remove all usages of the lib from the code, then it compiles as fast as expected.

0

There are 0 answers