Add golangci (#6418)

This commit is contained in:
kolaente 2019-06-12 21:41:28 +02:00 committed by techknowlogick
parent 5832f8d90d
commit f9ec2f89f2
147 changed files with 1046 additions and 774 deletions

View file

@ -9,6 +9,8 @@ import (
"io/ioutil"
"runtime"
"runtime/pprof"
"code.gitea.io/gitea/modules/log"
)
// DumpMemProfileForUsername dumps a memory profile at pprofDataPath as memprofile_<username>_<temporary id>
@ -30,9 +32,15 @@ func DumpCPUProfileForUsername(pprofDataPath, username string) (func(), error) {
return nil, err
}
pprof.StartCPUProfile(f)
err = pprof.StartCPUProfile(f)
if err != nil {
log.Fatal("StartCPUProfile: %v", err)
}
return func() {
pprof.StopCPUProfile()
f.Close()
err = f.Close()
if err != nil {
log.Fatal("StopCPUProfile Close: %v", err)
}
}, nil
}