<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國際加速解決方案。 廣告
                >[info] retry-go(重試機制) CSDN文檔:https://blog.csdn.net/jiaoyangwm/article/details/136500332 * **安裝:** ~~~ go get "github.com/avast/retry-go" ~~~ * **示例:** ~~~ package main import ( "fmt" "github.com/avast/retry-go" "io" "net/http" ) func main() { urls := []string{ "http://example.com", // url 真實存在 "http://not-exist.com", // url 不存在 } for _, url := range urls { f(url) } } func f(url string) { fmt.Println("開始處理: ", url) var body []byte err := retry.Do(func() error { resp, err := http.Get(url) if err != nil { return err } defer resp.Body.Close() body, err = io.ReadAll(resp.Body) if err != nil { return err } return nil }, retry.Attempts(3)) if err != nil { panic(err) } _ = body fmt.Println("處理成功") } ~~~ * **返回:** ``` 開始處理: http://example.com 處理成功 開始處理: http://not-exist.com panic: All attempts fail: #1: Get "http://not-exist.com": dial tcp: lookup not-exist.com: no such host #2: Get "http://not-exist.com": dial tcp: lookup not-exist.com: no such host #3: Get "http://not-exist.com": dial tcp: lookup not-exist.com: no such host ```
                  <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>

                              哎呀哎呀视频在线观看