This is a creation in
Article, where the information may have evolved or changed.
Golang's Map program:
Package Mainimport ' FMT ' type E interface{}func mult2 (t e) e {switch T. (type) {case Int:return T. (int) * 2case String:retur N T. (string) +
This is a creation in
Article, where the information may have evolved or changed.
Site Establishment Origins http://build.golangtc.com
At first I was looking for a website, just tell it my github address, it can compile the code, and then the code
This is a creation in
Article, where the information may have evolved or changed.
Bored try Golang connect HDFs and write a Hello World
Golang Package Address
Https://github.com/vladimirvivien/gowfs
Installation
Go get
This is a creation in
Article, where the information may have evolved or changed.
1. Pointers to Golang
can be unsafe. Pointer convert to UIntPtr, then perform pointer operations in disguise
Package Mainimport "FMT" import "unsafe" type User
This is a creation in
Article, where the information may have evolved or changed.
How to get goconfig third party Package
Install Goconfig package in git shell using go get github.com/unknwon/goconfig
How to use Goconfig
Package Mainimport ("FMT"
This is a created
article in which the information may have evolved or changed.
Go language bit Operation example
Package Mainimport ( "FMT")//Gets all even-numbered func even (a int) between 0-n (array []int) {for I: = 0; i > 1 return
This is a creation in
Article, where the information may have evolved or changed.
Compress files
package main import ( "FMT" "OS" "io" "Archive/tar" "Compress/gzip") func main () { // file write fw, Err := os.
This is a creation in
Article, where the information may have evolved or changed.
Debuggers
Application programming needs good debugging support, and in this area still a lot of work needs to is done. A Debugger (Oogle): Support for GDB (at least
This is a creation in
Article, where the information may have evolved or changed.
Golang official compiler installation and configurationSince Golang is written in some functional languages, all first of all, you should install GCC, $ sudo
This is a creation in
Article, where the information may have evolved or changed.
Related packages are strings, StrConv
Determine whether to begin/end with a stringStrings. Hasprefix (s string, prefix string) bool = Str.startswith
This is a creation in
Article, where the information may have evolved or changed.
Recently, some features have been implemented, using PROTOBUF and XML. From the types they write or the test cases, they see a number of such data structures:
Type
This is a creation in
Article, where the information may have evolved or changed.
Installing mercurialYou need to install the mercurial version management system before doing the following operations (you can output HG noun detection for
This is a creation in
Article, where the information may have evolved or changed.
Channel
Sample1 Close twice
CH: = Make (chan bool) close (CH) //This will panic, channel cannot close two times
The channel was closed early when it was read.
This is a creation in
Article, where the information may have evolved or changed.
Package Mainimport ("OS" "FMT" "Bufio" "Strings" "StrConv") func main () {F, _:=os. OpenFile ("A.txt", OS. O_rdonly, 0666) defer f.close () M:=bufio. Newreader (f)
This is a creation in
Article, where the information may have evolved or changed.
1. return value using Channel
Func Main () {//generate random numbers as a serviceRandservice: =Randgenerator ()//read random numbers from the service and printFmt.
This is a created
article in which the information may have evolved or changed.
When you use go get to download the code for a website such as github.com, you sometimes find that the downloaded code does not match the code on your website. such as
This is a creation in
Article, where the information may have evolved or changed.
Almost all of the code comes from:
http://jan.newmarch.name/go/
Thanks to the author
/* IP */package mainimport ("FMT" "NET" "OS") Func main () {if Len (OS. Args)!
This is a creation in
Article, where the information may have evolved or changed. This chapter is mainly about the use of functions in the go in the process of doing exercises a few of the more memorable problem is the definition of a named return
This is a creation in
Article, where the information may have evolved or changed.
by looking at the Goclipse document finally set up the environment, this note is the process of their own learning, for their own review and exchange, I hope we have a
This is a creation in
Article, where the information may have evolved or changed.
Go language value transfer and address delivery:
Value passing is the operation of a copy of the source structure;
The site transfer is the operation of the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service