這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。
去年工作原因,接觸到了golang,今年開始,自身感興趣,開始在自學Golang。首先簡短介紹下golang,Go語言是Google開發的一種編譯型,並髮型,具有記憶體回收功能的系統程式設計語言,官方支援FreeBSD,Linux,Mac OS和Windows四大作業系統。其出於Google公司,由眾多業界頂尖認識主持設計和開發,其設計動機就是為瞭解決伺服器端開發中遇到的實際問題,加上開源屬性,吸引了越來越多的開發人士參與。
golang的優點就不一一列舉了,本人對其高並發、多核支援,輕量級的goroutine和channel設計情有獨鐘。相關golang方面的學習資料可推薦官方網站、《go語言聖經》等等,github上可研讀相關優秀golang開源項目
本篇文章主要講述golang的命令工具,大致描述下golang的相關命令,以便在開發過程中,好好利用工具,事半功倍。
Go 語言內建了一套完整的命令操作工具,我們可以在命令列中執行go來查看相關協助
Usage: go command [arguments]The commands are: build compile packages and dependencies clean remove object files doc show documentation for package or symbol env print Go environment information fix run go tool fix on packages fmt run gofmt on package sources generate generate Go files by processing source get download and install packages and dependencies install compile and install packages and dependencies list list packages run compile and run Go program test test packages tool run specified go tool version print Go version vet run go tool vet on packagesUse "go help [command]" for more information about a command.Additional help topics: c calling between Go and C buildmode description of build modes filetype file types gopath GOPATH environment variable environment environment variables importpath import path syntax packages description of package lists testflag description of testing flags testfunc description of testing functionsUse "go help [topic]" for more information about that topic.
這些命令對於我們平時編寫的代碼非常有用,後續我們逐一詳細地來瞭解一些常用命令。