package main
import "golang.org/x/tour/tree"
import "fmt"
import "time"
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
for i := 0; i < 10; i++ {
time.Sleep(100+time.Millisecond)
fmt.Println(i)
ch <- i
}
return
}
// Same determines whether the trees
// t1 and t2 contain the same values.
func Same(t1, t2 *tree.Tree) bool {
return false
}
func main() {
ch := make(chan int)
go Walk(tree.New(1), ch)
val, ok := <-ch
if ok {
fmt.Println(val)
}
}
package main
import (
"golang.org/x/tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
ss := strings.Fields(s)
result := make(map[string]int)
for i1 := range ss {
var counter int
for i2 := range ss {
if ss[i1] == ss[i2] {
counter += 1
}
}
result[ss[i1]] = counter
}
return result
}
func main() {
wc.Test(WordCount)
}
On a system with GnuPG installed, do this by downloading the ISO PGP signature (under Checksums in the page Download) to the ISO directory, and verifying it with:
Что это значит?