स्विच करने के लिए मैं जाओ के साथ प्रक्रिया निष्पादित और फाइल करने के लिए उत्पादन लिखने (लॉग फ़ाइल)Golang इसे सुरक्षित cmd.Stdout
cmd := exec.Command(path)
cmd.Dir = dir
t := time.Now()
t1 := t.Format("20060102-150405")
fs, err := os.Create(dir + "/var/log/" + t1 + ".std")
if err == nil {
cmd.Stdout = fs
}
मैं लॉग और परिवर्तन लॉग फ़ाइल दैनिक http://golang.org/pkg/os/exec/
// Stdout and Stderr specify the process's standard output and error.
//
// If either is nil, Run connects the corresponding file descriptor
// to the null device (os.DevNull).
//
// If Stdout and Stderr are the same writer, at most one
// goroutine at a time will call Write.
Stdout io.Writer
Stderr io.Writer
बारी बारी से करना चाहते हैं
क्या यह आर्बिटरी गोरौटाइन से प्रति दिन cmd.Stdout परिवर्तनीय को बदलने के लिए सुरक्षित है या मुझे goroutine को कार्यान्वित करना है जो Stdout से दूसरी फ़ाइल में कॉपी करेगा और फ़ाइलों को स्विच करेगा?