Compiling for maximum compatibility

I recently developed a toy application in go and tried to deploy it on my personal server. I use ubuntu on both my personal pc and server and when I tried to run the binary compiled in my pc on the server, it showed error that the binary needed glibc 2.32 but the server had only 2.31 even with the latest update. After some googling, I ended up compiling the source in my VPS and using that binary.
Projects like hugo seems to provide executables that seems to work on a wide range of versions. How can I build binaries like that and ensure that my binary would run on most systems?