<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                [TOC] ## 實例 ### 默認帶 --help 查詢 ``` var ( s string ) func main() { flag.StringVar(&s,"name", "cc", "input you name") flag.Parse() fmt.Printf("%+v\n", s) } ``` 運行 ``` > go run main.go --help -name string input you name (default "cc") > go run main.go --name cpj //只能用 --name, -name無效 cpj ``` ### 主動打印 help 信息 ``` var ( help bool file string number int ) func init() { flag.BoolVar(&help, "h", false, "this is help") // `file` 寫在最后的注釋中,可使 -f string 改為 -f file flag.StringVar(&file, "f", "", "this is a `file`") flag.IntVar(&number, "n", 0, "tshi is a `number`") flag.Usage = usage } func main() { flag.Parse() if file != "" { log.Println("file is ", file) lookup := flag.Lookup("f") // 打印參數的數據 fmt.Printf("%+v\n", lookup) //&{Name:f Usage:this is a `file` Value:test.file DefValue:} } if number != 0 { log.Println("number is", number) } fmt.Println(flag.Args()) if help { //主動打印信息 flag.Usage() } } func usage() { fmt.Fprintf(os.Stdout, `test version: test/1.10.0 Usage: test [-hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives] Options: `) flag.PrintDefaults() } ``` output ``` Usage: test [-hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives] Options: -f file this is a file -h this is help -n number tshi is a number ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看