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)