Go:func 函数

Go:func 函数

func 函数

func函数(适用于method)小结

Go函数

数也是一种类型,可以和其他类型一样被保存在变量中。和接口一样,接口也是一种类型。

1
2
3
4
5
6
7
8
9
10
11
12
13
package main
import (
"fmt"
)
func foo() {
fmt.Println("foo")
}
func main() {
var f func()
f = foo
f()
}

Read more
Go tool pprof性能监控调试工具基本使用说明

Go tool pprof性能监控调试工具基本使用说明

Go tool pprof使用方式

go中有pprof包来做代码的性能监控主要涉及两个pkg:

1
2
3
4
5
6
7
8
9
10
11
#web服务器:
import (
"net/http"
_ "net/http/pprof"
)

#一般应用程序(实际应用无web交互)
import (
"net/http"
_ "runtime/pprof"
)
Read more
Go:fmt.Printf() 格式化占位符
Jack Liu Golang personal summary combing notes