1. Installing mercurial
Mercurial is a lightweight distributed version control system implemented in Python language
You can enter the HG command to query whether the system is installed mercurial, you can install the following two kinds of commands
$sudo pip Install mercurial
After the installation is successful
$sudo Easy-install Mercurial
After installation, enter the HG command, shown below, indicating a successful installation of Mercuria
$ HG
Mercurial Distributed SCM
Basic commands:
Add add the specified files on the next commit
Annotate show changeset information by line for each file
Clone make a copy of existing repository
Commit commit the specified files or all outstanding changes
diff diff repository (or selected files)
Export dump the header and diffs for one or more changesets
Forget forget the specified files on the next commit
Init create a new repository in the given directory
Log Show revision history of entire repository or files
Merge Merge working directory with another revision
Pull pulling changes from the specified source
Push push changes to the specified destination
Remove remove the specified files on the next commit
Serve start stand-alone webserver
Status show changed files in the working directory
Summary Summarize working directory State
Update Update working directory (or switch revisions)
Use ' HG help ' for the full list of commands or ' hg-v ' for details
If the command installation fails, you can download the installation directly.
2. Get Go Source code
$HG Clone-r Release Https://go.googlecode.com/hg/go
Warning:go.googlecode.com Certificate with fingerprint 3f:8a:ae:12:fc:c2:65:d0:64:42:ee:6f:cc:b3:41:a1:9a:76:6e:8c Not verified (check hostfingerprints or web.cacerts config setting)
Adding changesets
adding manifests
adding file changes
Added 19559 changesets with 68116 changes to 8835 files
Updating to Branch release-branch.go1.3
4167 files updated, 0 files merged, 0 files removed, 0 files unresolved
The go directory is created in the current path
3. Install Go
Go to the Go Source (GO/SRC) directory to install, execute the following command
$./all.bash
Finally, the following will be displayed
All TESTS PASSED
---
Installed Go for DARWIN/AMD64 In/users/angel/iproject/go
Installed Commands In/users/angel/iproject/go/bin
You need to Add/users/angel/iproject/go/bin to your PATH.
4. Writing HelloWorld
$ cat Helloworld.go
Package Main
Import (
"FMT"
)
Func Main () {
Fmt. Println ("Hello World")
}
5. Running the program
$ go Run helloworld.go
Hello World
Reference links
Getting Started with the MAC environment go language HelloWorld