1
0
Эх сурвалжийг харах

fix golint issues in core/proc (#502)

Kevin Wan 4 жил өмнө
parent
commit
d84e3d4b53

+ 2 - 0
core/proc/env.go

@@ -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 {

+ 2 - 0
core/proc/process.go

@@ -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
 }

+ 5 - 0
core/proc/shutdown.go

@@ -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
 }

+ 1 - 0
core/proc/stopper.go

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