Go: Difference between revisions
imported>Adisbladis Remove statement about generating deps.nix with vgo2nix and gomod2nix. The former is deprecated and the latter has dropped support for deps.nix output. |
imported>Zarelit Add workaround about delve not running in vscode |
||
| Line 51: | Line 51: | ||
If you intend to compile against glibc statically (such as via <tt>go build -ldflags "-s -w -linkmode external -extldflags -static"</tt>), add <tt>glibc.static</tt> to the list of packages passed to <tt>nix-shell</tt>. | If you intend to compile against glibc statically (such as via <tt>go build -ldflags "-s -w -linkmode external -extldflags -static"</tt>), add <tt>glibc.static</tt> to the list of packages passed to <tt>nix-shell</tt>. | ||
If you encounter [https://github.com/go-delve/delve/issues/3085 this issue] and receive an error about _FORTIFY_SOURCE when running delve (for example in VSCode), put <tt>hardeningDisable = [ "fortify" ];</tt> inside shell.nix or in the <tt>mkShell</tt> invocation argument like this: | |||
<syntaxhighlight lang="nix"> | |||
pkgs.mkShell { | |||
hardeningDisable = [ "fortify" ]; | |||
buildInputs = [ pkgs.go_1_18 ]; | |||
}; | |||
</syntaxhighlight> | |||
== Compile go program with static compile flag == | == Compile go program with static compile flag == | ||