summaryrefslogtreecommitdiff
path: root/test/test0.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-02-14 13:23:51 +0100
committerOndřej Surý <ondrej@sury.org>2011-02-14 13:23:51 +0100
commit758ff64c69e34965f8af5b2d6ffd65e8d7ab2150 (patch)
tree6d6b34f8c678862fe9b56c945a7b63f68502c245 /test/test0.go
parent3e45412327a2654a77944249962b3652e6142299 (diff)
downloadgolang-upstream/2011-02-01.1.tar.gz
Imported Upstream version 2011-02-01.1upstream/2011-02-01.1
Diffstat (limited to 'test/test0.go')
-rw-r--r--test/test0.go40
1 files changed, 23 insertions, 17 deletions
diff --git a/test/test0.go b/test/test0.go
index dd2033a98..d8d86c427 100644
--- a/test/test0.go
+++ b/test/test0.go
@@ -6,12 +6,11 @@
package main
-const
- a_const = 0
+const a_const = 0
const (
- pi = /* the usual */ 3.14159265358979323
- e = 2.718281828
+ pi = /* the usual */ 3.14159265358979323
+ e = 2.718281828
mask1 int = 1 << iota
mask2 = 1 << iota
mask3 = 1 << iota
@@ -19,7 +18,7 @@ const (
)
type (
- Empty interface {}
+ Empty interface{}
Point struct {
x, y int
}
@@ -32,19 +31,21 @@ func (p *Point) Initialize(x, y int) *Point {
}
func (p *Point) Distance() int {
- return p.x * p.x + p.y * p.y
+ return p.x*p.x + p.y*p.y
}
var (
- x1 int
- x2 int
- u, v, w float
+ x1 int
+ x2 int
+ u, v, w float32
)
func foo() {}
func min(x, y int) int {
- if x < y { return x; }
+ if x < y {
+ return x
+ }
return y
}
@@ -57,24 +58,29 @@ func swap(x, y int) (u, v int) {
func control_structs() {
var p *Point = new(Point).Initialize(2, 3)
i := p.Distance()
- var f float = 0.3
+ var f float32 = 0.3
_ = f
- for {}
- for {}
+ for {
+ }
+ for {
+ }
for j := 0; j < i; j++ {
if i == 0 {
- } else i = 0
- var x float
+ } else {
+ i = 0
+ }
+ var x float32
_ = x
}
- foo: // a label
+foo: // a label
var j int
switch y := 0; true {
case i < y:
fallthrough
case i < j:
case i == 0, i == 1, i == j:
- i++; i++
+ i++
+ i++
goto foo
default:
i = -+-+i