···114114115115### `buildFlagsArray` and `buildFlags`: {#ex-goBuildFlags-noarray}
116116117117-These attributes set build flags supported by `go build`. We recommend using `buildFlagsArray`. The most common use case of these attributes is to make the resulting executable aware of its own version. For example:
117117+These attributes set build flags supported by `go build`. We recommend using `buildFlagsArray`.
118118119119```nix
120120 buildFlagsArray = [
121121- # Note: single quotes are not needed.
122122- "-ldflags=-X main.Version=${version} -X main.Commit=${version}"
121121+ "-tags=release"
123122 ];
124123```
125124125125+### `ldflags` {#var-go-ldflags}
126126+127127+Arguments to pass to the Go linker tool via the `-ldflags` argument of `go build`. The most common use case for this argument is to make the resulting executable aware of its own version. For example:
128128+126129```nix
127127- buildFlagsArray = ''
128128- -ldflags=
129129- -X main.Version=${version}
130130- -X main.Commit=${version}
131131- '';
130130+ ldflags = [
131131+ "-s" "-w"
132132+ "-X main.Version=${version}"
133133+ "-X main.Commit=${version}"
134134+ ];
132135```
133136134137### `deleteVendor` {#var-go-deleteVendor}