gcflags_ldflags_debug_release_build

command
v0.5.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2025 License: MIT Imports: 4 Imported by: 0

README

これは何?

Goにてデバッグビルドするときと、リリースビルドするときによく利用するフラグについて。

デバッグ

go build -gcflags "all=-N -l" -o debug main.go
オプションの意味
      # gcflags の all=-N -l の意味 (goコンパイラに対しての指示) (go tool compile -help)
      #   all= は全てのパッケージが対象という意味
      #   -N   は最適化無効という意味 (No optimization)
      #   -l   はインライン化無効という意味 (No inlining)

リリース

go build -ldflags "-s -w" -o release main.go
オプションの意味
      # ldflags の -s -w の意味 (リンカに対しての指示) (go tool link -help)
      #    -s   はシンボルテーブル削除という意味
      #    -w   はDWARF情報削除という意味(デバッグ情報)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL