package main
import (
"fmt"
//"io"
"flag"
"time"
)
func main() {
heapProfFile := flag.String("HeapProfFile", "logs/heap.20060102150405.prof", "HeapProf文件路径(含时间戳模板)")
fmt.Println(*heapProfFile)
path := time.Now().Format(*heapProfFile)
fmt.Println(path)
}
在来看一个例子:
package main
import (
"fmt"