From ae117a5437cdf3ac3563ff4801566f9ed284aae3 Mon Sep 17 00:00:00 2001 From: gonejack Date: Mon, 11 May 2020 11:49:49 +0800 Subject: [PATCH] go-build: apply suggestions Signed-off-by: gonejack --- pages/common/go-build.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pages/common/go-build.md b/pages/common/go-build.md index a8460fe92f..01cea6c8e0 100644 --- a/pages/common/go-build.md +++ b/pages/common/go-build.md @@ -1,12 +1,20 @@ # go build -> Tool for compiling packages and dependencies. -> More information: . +> Compile Go sources. +> More information: . -- Compile a source file into a named executable: +- Compile a file: -`go build -o {{executable}} {{path/to/main/file}}.go` +`go build path/to/main.go` -- Compile a main package into a named executable: +- Compile into named output: -`go build -o {{executable}} {{path/to/main/package}}` +`go build -o {{binary}} path/to/source.go` + +- Compile a package: + +`go build -o {{binary}} path/to/package` + +- Compile a main package into an executable, with data race detection: + +`go build -race -o {{executable}} path/to/main/package`