DEV Community

Jorge Araya
Jorge Araya

Posted on

Tell runtime/cgo to not thread warnings as errors

Occasionally, you want to debug (with delve) your project, but when you attempt to do so, you are greeted with the following error:

 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^~~~~~~
cc1: all warnings being treated as errors
Enter fullscreen mode Exit fullscreen mode

To resolve this, just export CGO_CFLAGS with the value "-O2 -g -Wno-error".

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up