惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
N
Netflix TechBlog - Medium
P
Proofpoint News Feed
D
Docker
J
Java Code Geeks
L
LangChain Blog
Microsoft Security Blog
Microsoft Security Blog
The GitHub Blog
The GitHub Blog
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
月光博客
月光博客
T
Tailwind CSS Blog
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
腾讯CDC
罗磊的独立博客
U
Unit 42
爱范儿
爱范儿
Vercel News
Vercel News
MyScale Blog
MyScale Blog

二丫讲梵

学习周刊-总第258期-2026年第15周 学习周刊-总第257期-2026年第14周 学习周刊-总第256期-2026年第13周 学习周刊-总第255期-2026年第12周 学习周刊-总第254期-2026年第11周 学习周刊-总第253期-2026年第10周 临时插播一条羊毛,免费领取450元大模型API代金券 学习周刊-总第252期-2026年第09周 学习周刊-总第251期-2026年第08周 学习周刊-总第250期-2026年第07周 学习周刊-总第249期-2026年第06周 诚邀评论,聊聊你所知欲知的我 学习周刊-总第248期-2026年第05周 我的QQ动态之2015年 我的QQ动态之2014年 我的QQ动态之2013年 我的QQ动态之2012年 我的QQ动态-2010-2011年 我的QQ动态-创栏小叙 学习周刊-总第247期-2026年第04周 Nexus社区版权益阉割--一文告诉你有哪些版本可以选择 学习周刊-总第246期-2026年第03周 学习周刊-总第245期-2026年第02周 学习周刊-总第244期-2026年第01周 学习周刊-总第243期-2025年第52周 学习周刊-总第242期-2025年第51周 开源项目ZenOps:带你领略禅意运维 学习周刊-总第241期-2025年第50周 用京东金融,享负债人生 学习周刊-总第240期-2025年第49周
学习周刊-总第99期-2023年第12周
二丫讲梵 · 2023-03-24 · via 二丫讲梵

# 0 ,前言

周刊维护在:https://github.com/eryajf/learning-weekly (opens new window) 欢迎投稿,推荐或自荐项目 /文章 /博客,请提交 issue 。

周刊核心为运维周刊,还会侧重 Go 语言生态,Vue 相关技术生态的项目,以及 GitHub 上优秀项目或经验。

你也可以在我的博客 (opens new window) 查看汇总周刊。

🔥 有不少人想单独从博客通过 RSS 订阅周刊的更新,现在它来了,你可以使用这个🔗 链接 (opens new window)进行订阅。

# 1,优秀项目




  • 项目地址:retry-go (opens new window)

  • 项目说明:顾名思义,一个支持在 go 中实现重试的库。

    eg:

    package main
    
    import (
        "io/ioutil"
        "log"
        "net/http"
        "time"
    
        "github.com/rafaeljesus/retry-go"
    )
    
    var (
        attempts  = 3               //最大重试次数
        sleepTime = time.Second * 2 //重试延迟时间
    )
    
    func main() {
        _, err := retry.DoHTTP(func() (*http.Response, error) {
            return makeRequest()
        }, attempts, sleepTime)
        if err != nil {
        log.Print("retry.DoHTTP Failed")
            return
        }
    
        log.Print("retry.DoHTTP OK")
    }
    
    // 发送http请求
    func makeRequest() (*http.Response, error) {
        client := http.Client{
            Timeout: 2 * time.Second, // 设置请求超时时间
        }
        req, err := client.Get("https://www.baidu2.com") // 模拟不存在的url请求
        if err != nil {
            log.Printf(err.Error())
            return nil, err
        }
    
        body, err := ioutil.ReadAll(req.Body)
        if err != nil {
            log.Printf(err.Error())
            return nil, err
        }
        log.Printf("响应数据 %v\n", string(body))
        defer req.Body.Close()
    
        res := &http.Response{}
        return res, nil
    }
    

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50

  • 相关文章:README (opens new window)





申明

原创文章eryajf,未经授权,严禁转载,侵权必究!此乃文中随机水印,敬请读者谅解。

# 2,优秀文章






# 3,优秀博客