typos fixed
This commit is contained in:
@@ -86,7 +86,7 @@ LiteIDE features.
|
||||
|
||||
Replace `GOROOT=$HOME/go` to your Go installation path, save it.
|
||||
- $GOPATH
|
||||
$GOPATH is the path that contains a list of projects. Open the command tool (or press `Ctrl+` in LiteIDE), then type `go help gopath` for more details.
|
||||
$GOPATH is the path that contains a list of projects. Open the command tool (or press ``Ctrl+` ``in LiteIDE), then type `go help gopath` for more details.
|
||||
It's very easy to view and change $GOPATH in LiteIDE. Follow `View - Setup GOPATH` to view and change these values.
|
||||
|
||||
## Sublime Text
|
||||
@@ -106,11 +106,11 @@ Here I'm going to introduce you the Sublime Text 2 (Sublime for short) + GoSubli
|
||||
Figure 1.6 Sublime project management
|
||||
|
||||
- Syntax highlight
|
||||
- Free trial forever with no functional limitations. You may be prompted once in a while to remind you to purchase a licnese, but you can simply ignore it if you wish. Of course, if you do find that it enhances your productivity and you really enjoy using it, please purchase a copy of it and support its continued development!
|
||||
- Free trial forever with no functional limitations. You may be prompted once in a while to remind you to purchase a license, but you can simply ignore it if you wish. Of course, if you do find that it enhances your productivity and you really enjoy using it, please purchase a copy of it and support its continued development!
|
||||
|
||||
First, download the version of [Sublime](http://www.sublimetext.com/) suitable for your operating system.
|
||||
|
||||
1. Press `Ctrl+`, open the command tool and input the following commands.
|
||||
1. Press ``Ctrl+` ``, open the command tool and input the following commands.
|
||||
|
||||
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ The reason that Go is concise because it has some default behaviors.
|
||||
|
||||
in `[n]type`, `n` is the length of the array, `type` is the type of its elements. Like other languages, we use `[]` to get or set element values within arrays.
|
||||
|
||||
var arr [10]int // an array of type int
|
||||
var arr [10]int // an array of type [10]int
|
||||
arr[0] = 42 // array is 0-based
|
||||
arr[1] = 13 // assign value to element
|
||||
fmt.Printf("The first element is %d\n", arr[0]) // get element value, it returns 42
|
||||
|
||||
@@ -15,7 +15,7 @@ The greatest invention in programming is flow control. Because of them, you are
|
||||
if x > 10 {
|
||||
fmt.Println("x is greater than 10")
|
||||
} else {
|
||||
fmt.Println("x is less than 10")
|
||||
fmt.Println("x is less than or equal to 10")
|
||||
}
|
||||
|
||||
The most useful thing concerning `if` in Go is that it can have one initialization statement before the conditional statement. The scope of the variables defined in this initialization statement are only available inside the block of the defining `if`.
|
||||
|
||||
@@ -181,7 +181,7 @@ An empty interface is an interface that doesn't contain any methods, so all type
|
||||
a = i
|
||||
a = s
|
||||
|
||||
If a function uses an empty interface as its argument type, it can accept any type; if a function uses empty as its return value type, it can return any type.
|
||||
If a function uses an empty interface as its argument type, it can accept any type; if a function uses empty interface as its return value type, it can return any type.
|
||||
|
||||
### Method arguments of an interface
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ Sometimes we require that users input some fields but they don't, for example in
|
||||
// code for empty field
|
||||
}
|
||||
|
||||
`r.Form` treats different form element types differently when they are blank. For empty textboxes, text areas and file uploads, it returns an empty string; for radio buttons and check boxes, it doesn't even create the corresponding items. Instead, you will get errors if you try to access it. Therefore, it's safer to use `r.Form.Get()` to get filed values since it will always return empty if the value does not exist. On the other hand, `r.Form.Get()` can only get one field value at a time, so you need to use `r.Form` to get the map of values.
|
||||
`r.Form` treats different form element types differently when they are blank. For empty textboxes, text areas and file uploads, it returns an empty string; for radio buttons and check boxes, it doesn't even create the corresponding items. Instead, you will get errors if you try to access it. Therefore, it's safer to use `r.Form.Get()` to get field values since it will always return empty if the value does not exist. On the other hand, `r.Form.Get()` can only get one field value at a time, so you need to use `r.Form` to get the map of values.
|
||||
|
||||
## Numbers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user