fix golint issues in core/proc (#502)

master
Kevin Wan 4 years ago committed by GitHub
parent 221f923fae
commit d84e3d4b53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,6 +11,7 @@ var (
envLock sync.RWMutex
)
// Env returns the value of the given environment variable.
func Env(name string) string {
envLock.RLock()
val, ok := envs[name]
@ -28,6 +29,7 @@ func Env(name string) string {
return val
}
// EnvInt returns an int value of the given environment variable.
func EnvInt(name string) (int, bool) {
val := Env(name)
if len(val) == 0 {

@ -15,10 +15,12 @@ func init() {
pid = os.Getpid()
}
// Pid returns pid of current process.
func Pid() int {
return pid
}
// ProcessName returns the processname, same as the command name.
func ProcessName() string {
return procName
}

@ -24,14 +24,19 @@ var (
delayTimeBeforeForceQuit = waitTime
)
// AddShutdownListener adds fn as a shutdown listener.
// The returned func can be used to wait for fn getting called.
func AddShutdownListener(fn func()) (waitForCalled func()) {
return shutdownListeners.addListener(fn)
}
// AddWrapUpListener adds fn as a wrap up listener.
// The returned func can be used to wait for fn getting called.
func AddWrapUpListener(fn func()) (waitForCalled func()) {
return wrapUpListeners.addListener(fn)
}
// SetTimeToForceQuit sets the waiting time before force quitting.
func SetTimeToForceQuit(duration time.Duration) {
delayTimeBeforeForceQuit = duration
}

@ -3,6 +3,7 @@ package proc
var noopStopper nilStopper
type (
// Stopper interface wraps the method Stop.
Stopper interface {
Stop()
}

Loading…
Cancel
Save