3.3. コードの変更のプレビュー
指定したパス code_path でコードをフォーマットしてプレビューするには、以下のように -d
オプションを指定して gofmt を実行します。
Red Hat Enterprise Linux 7 の場合:
$ scl enable go-toolset-1.11 'gofmt -d code_path'
Red Hat Enterprise Linux 8 の場合:
$ gofmt -d code_path
統一された diff 形式の出力は、標準出力に出力されます。
-d
と -w
オプションの両方を組み合わせることができます。