Merge pull request #549 from AmeBel/correction

correct go help instruction
This commit is contained in:
astaxie
2015-10-15 11:25:58 +08:00

View File

@@ -19,19 +19,19 @@ This command is for compiling tests. It will compile packages and dependencies i
- If there are many files in the folder, but you just want to compile one of them, you should append the file name after `go build`. For example, `go build a.go`. `go build` will compile all the files in the folder.
- You can also assign the name of the file that will be generated. For instance, in the `mathapp` project (in section 1.2), using `go build -o astaxie.exe` will generate `astaxie.exe` instead of `mathapp.exe`. The default name is your folder name (non-main package) or the first source file name (main package).
(According to [The Go Programming Language Specification](https://golang.org/ref/spec), package names should be the name after the word `package` in the first line of your source files. It doesn't have to be the same as the folder name, and the executable file name will be your folder name by default.])
(According to [The Go Programming Language Specification](https://golang.org/ref/spec), package names should be the name after the word `package` in the first line of your source files. It doesn't have to be the same as the folder name, and the executable file name will be your folder name by default.])
- `go build` ignores files whose names start with `_` or `.`.
- If you want to have different source files for every operating system, you can name files with the system name as a suffix. Suppose there are some source files for loading arrays. They could be named as follows:
array_linux.go | array_darwin.go | array_windows.go | array_freebsd.go
`go build` chooses the one that's associated with your operating system. For example, it only compiles array_linux.go in Linux systems, and ignores all the others.
## go clean
This command is for cleaning files that are generated by compilers, including the following files:
This command is for cleaning files that are generated by compilers, including the following files:
_obj/ // old directory of object, left by Makefiles
_test/ // old directory of test, left by Makefiles
_testmain.go // old directory of gotest, left by Makefiles
@@ -42,7 +42,7 @@ This command is for cleaning files that are generated by compilers, including th
DIR(.exe) // generated by go build
DIR.test(.exe) // generated by go test -c
MAINFILE(.exe) // generated by go build MAINFILE.go
I usually use this command to clean up my files before I upload my project to Github. These are useful for local tests, but useless for version control.
## go fmt and gofmt
@@ -61,8 +61,8 @@ This command is for getting remote packages. So far, it supports BitBucket, Gith
Github (git)
Google Code (Git, Mercurial, Subversion)
Launchpad (Bazaar)
In order to use this command, you have to install these tools correctly. Don't forget to update the `$PATH` variable. By the way, it also supports customized domain names. Use `go help remote` for more details about this.
In order to use this command, you have to install these tools correctly. Don't forget to update the `$PATH` variable. By the way, it also supports customized domain names. Use `go help importpath` for more details about this.
## go install
@@ -76,7 +76,7 @@ This command loads all files whose name include `*_test.go` and generates test f
FAIL archive/zip 0.022s
ok compress/gzip 0.033s
...
It tests all your test files by default. Use command `go help testflag` for more details.
## godoc
@@ -96,7 +96,7 @@ Go provides more commands than those we've just talked about.
go env // view environment variables about Go
go list // list all installed packages
go run // compile temporary files and run the application
There are also more details about the commands that I've talked about. You can use `go help <command>` to look them up.
## Links