Gopher, the Go language mascot, is an otter and is an entry point into understanding Go's syntax and features. Git branch management: switch branches: git checkout new branch: git branch merge branch: git merge delete branch: git branch -d remote warehouse operation: clone remote warehouse: git clone add remote warehouse: git remote add push branch: git push pull Code: git pullGo command line tool practice: write the main function and receive command line parameters. Use fmt.Println to print the entered text. Use go run to run the script or compile it into a binary file for execution.
The world of Gopher: In-depth exploration of the Go language mascot
The mascot of the Go language, Gopher, is a cute otter. Loved by developers. Not only is it a mascot, it's also a great entry point into Go's syntax and features.
Git branches are pointers between different versions in the source code library, used to record different development progress. The remote warehouse is the centralized storage place of the code.
// 切换到分支 my-branch git checkout my-branch // 新建分支 my-new-branch git branch my-new-branch // 合并分支 my-new-branch 到当前分支 git merge my-new-branch // 删除分支 my-new-branch git branch -d my-new-branch
// 克隆远程仓库到本地 git clone https://github.com/golang/go.git // 添加远程仓库 git remote add origin https://github.com/my-user/my-repo.git // 推送当前分支到远程仓库 git push origin my-branch // 从远程仓库拉取代码 git pull origin my-branch
The following is an example of a simple Go CLI tool, It can print the entered text:
package main import ( "fmt" "os" ) func main() { args := os.Args if len(args) == 1 { fmt.Println("请输入要打印的文本") } else { fmt.Println(args[1]) } }
go run
to run the script: $ go run main.go "Hello, Gopher!"
$ go build main.go
$ ./main "Hello, Gopher!"
The above is the detailed content of The world of Gopher: Exploring the Go language mascot. For more information, please follow other related articles on the PHP Chinese website!