-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
158 lines (135 loc) · 3.2 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package main
import "mycollection"
//例子程序如下:
/*
type Data struct{
}
func xxx() *Data{
var c Data
return &c
}
func main(){
xxx();
}
*/
//go run -gcflags "-m -l" main.go //-m表示进行内存分析 -l表示避免程序内联(避免程序优化)
//这样我们可以看到类似如下的输出:
//........
//./main.go: &c escapes to heap
//./main.go: moved to heap :c
//.........
func main() {
//zhanglin.PrintfTest()
//zhanglin.JsonTest()
//zhanglin.LogicTest()
//zhanglin.AlignTest()
//mystruct.Mystruct()
//mystruct.Mystruct2()
//=========包================
//mypkg.Mypkg()
//=========变量================
//myvar.Myvar()
//=========基本语法================
//mygolang.Mygolang()
//=========集合================
mycollection.Mycollection()
//mycollection.MySort()
//mycollection.TestMap()
//=========函数================
//myfunc.Myfunc()
//=========延迟================
//myfunc.Mydefer()
//=========类================
//mystruct.Mystruct()
//mystruct.Mystruct2()
//=========方法================
//mymethod.Mymethod()
//mymethod.Finallizefunc()
//=========接口================
//myintf.Myintf()
//myintf.Myintf2()
//myintf.Myintf3()
//myintf.Myintf4()
//myintf.TestAAABBBCCC()
//myref.Myref()
//=========错误处理================
//myexception.Panic()
//myexception.Myexception()
//myexception.DeferTest()
//=========基本api================
//bytes.BytesBase()
//bytes.BytesReader()
//bytes.BytesBuffer()
//myapi.Mystr()
//myapi.MyString2()
//myapi.MyReg()
//myapi.Mytime()
//myapi.MyJson()
//myapi.MyLineFilter()
//myapi.MyRandom()
//myapi.MySha1()
//myapi.MyBase64()
//myapi.MyUrlParser()
//=========并发================
//mygoroutine.Mygoroutine1()
//mygoroutine.Mygoroutine2()
//mygoroutine.TestGoroutine()
//mygoroutine.Myselect()
//myruntime.Myruntime()
//myruntime.NumCpuTest()
//mysync.WaitGroupTest()
//mysync.MyMutx()
//mysync.MyRWLock()
//mysync.MyAtomic()
//mysync.MyOnce()
//mysync.MyOnce2()
//mysync.MyPooltest()
//mytime.MyTicker()
//mytime.MyTimeout()
//mytime.MyTimer()
//=========pprof================
//mypprof.Testpprof()
//mypprof.Testmypprof2()
//=========文件io================
//myfile.Myfile()
//myfile.MyFile2()
//=========命令行参数================
//mycmdline.Mycmdline()
//=========网络io================
//go mytcp.MyTcpServer()
// mytcp.MyTcpClient()
//go onetoone.MyUdpServer()
//onetoone.MyUdpCli()
//go multi.MyMultiServer()
//multi.MyMultiCli()
//broadcast.MyBCServer()
//broadcast.MyBCCli()
//=========网络io-http相关================
//mynet.MyHttp1()
//mynet.MyHttp2()
//mynet.MyHttp21()
//mynet.MyHttp22()
//mynet.MyHttp3()
//mynet.MyHttp31()
//mynet.Myhttpcli()
//myupload.MyUpServer()
//myupload.MyUpCli()
//myssl.MySsl()
//myssl.MySslCli()
//myhttp2.MyHttp2Server()
//myhttp2.MyHttp2Cli()
//myws.MyWsServer()
//=========系统================
//mysys.MyExec()
//mysys.MyExec2()
//mysys.MySignal()
//mysys.MySyscall()
//mysys.MySyscall2()
//=========go调用c================
//goandc.Mygoandc()
//=========虚拟化================
//mycontainer.MyUts()
//mycontainer.MyUts2()
//mycontainer.MyPid()
//mycontainer.MyCgrouptest()
}