TRIVIAL go fmt
This commit is contained in:
parent
090d101d51
commit
736d61e82c
@ -2,8 +2,8 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
func sum(a []int, c chan int) {
|
||||
@ -11,7 +11,7 @@ func sum(a []int, c chan int) {
|
||||
for _, v := range a {
|
||||
sum += v
|
||||
}
|
||||
to_sleep := time.Duration(100 * math.Abs(float64(sum))) * time.Millisecond
|
||||
to_sleep := time.Duration(100*math.Abs(float64(sum))) * time.Millisecond
|
||||
fmt.Printf("Sleeping %s...\n", to_sleep)
|
||||
time.Sleep(to_sleep)
|
||||
c <- sum
|
||||
@ -27,5 +27,5 @@ func main() {
|
||||
fmt.Printf("x = %d\n", x)
|
||||
y := <-c
|
||||
fmt.Printf("y = %d\n", y)
|
||||
fmt.Println(x, y, x + y)
|
||||
fmt.Println(x, y, x+y)
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"code.google.com/p/go-tour/wc"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func WordCount(s string) map[string]int {
|
||||
|
@ -9,7 +9,7 @@ func Pic(dx, dy int) [][]uint8 {
|
||||
for i := range cols {
|
||||
cols[i] = make([]uint8, dx)
|
||||
for j := range cols[i] {
|
||||
cols[i][j] = uint8(j^i)
|
||||
cols[i][j] = uint8(j ^ i)
|
||||
}
|
||||
}
|
||||
return cols
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
// using Newton's method
|
||||
func Sqrt(x float64) float64 {
|
||||
z := x - (x * 0.1)
|
||||
for i := 0 ; i < 1000 ; i++ {
|
||||
for i := 0; i < 1000; i++ {
|
||||
newZ := z - (((z * z) - x) / 2 * z)
|
||||
diff := math.Abs(newZ) - math.Abs(z)
|
||||
if math.Abs(diff) < 0.01 {
|
||||
|
Loading…
Reference in New Issue
Block a user