fix golint issues in core/proc (#502)
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user