其他分享
首页 > 其他分享> > Go学习例子(五)

Go学习例子(五)

作者:互联网

21、Embedding

 

 

 

$ go run embedding.go
co={num: 1, str: some name}
also num: 1
describe: base with num=1
describer: base with num=1

22、Errors

 

 

$ go run errors.go
f1 worked: 10
f1 failed: can't work with 42
f2 worked: 10
f2 failed: 42 - can't work with it
42
can't work with it

23、Goroutines

 

 

$ go run goroutines.go
direct : 0
direct : 1
direct : 2
goroutine : 0
going
goroutine : 1
goroutine : 2
done

24、Channels

 

 

$ go run channels.go 
ping

25、Channel Buffering

 

 

$ go run channel-buffering.go 
buffered
channel

标签:run,goroutine,42,direct,学习,go,num,例子,Go
来源: https://www.cnblogs.com/biao/p/15628119.html