August 2019
Beginner to intermediate
798 pages
17h 2m
English
In this subsection, you will see the use of an external Go package that sets up the profiling environment much more conveniently than by using the runtime/pprof standard Go package. This point is illustrated in betterProfile.go, which will be presented in three parts.
The first part of betterProfile.go is as follows:
package main
import (
"fmt"
"github.com/pkg/profile"
)
var VARIABLE int
func N1(n int) bool {
for i := 2; i < n; i++ {
if (n % i) == 0 {
return false
}
}
return true
}
In the preceding code, you can see the use of an external Go package that can be found at github.com/pkg/profile. You can download it with the help of the go get command, as follows:
$ go get github.com/pkg/profile ...
Read now
Unlock full access