<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Go on Mengboy 技术笔记</title>
    <link>https://www.mfun.ink/tags/go/</link>
    <description>Recent content in Go on Mengboy 技术笔记</description>
    <generator>Hugo -- 0.156.0</generator>
    <language>zh-cn</language>
    <lastBuildDate>Wed, 08 Apr 2026 01:22:53 +0000</lastBuildDate>
    <atom:link href="https://www.mfun.ink/tags/go/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Go Dual-Provider LLM Routing (OpenAI &#43; Claude): Timeout Tiers, Cost Caps, and Fallback Control</title>
      <link>https://www.mfun.ink/english/post/go-dual-model-routing-openai-claude-timeout-cost-fallback/</link>
      <pubDate>Wed, 08 Apr 2026 01:22:53 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/go-dual-model-routing-openai-claude-timeout-cost-fallback/</guid>
      <description>&lt;p&gt;If your Go service relies on one LLM provider, two failures hurt the most, timeout spikes and billing spikes. A real production setup is not just “add another provider”, it is a single control plane for routing, timeout tiers, cost caps, and fallback.&lt;/p&gt;
&lt;p&gt;This guide gives you a practical OpenAI + Claude dual-provider pattern with one priority, keep uptime first, then optimize quality.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Go 服务双栈模型路由（OpenAI/Claude）：超时分层、成本上限与降级回退</title>
      <link>https://www.mfun.ink/2026/04/08/go-dual-model-routing-openai-claude-timeout-cost-fallback/</link>
      <pubDate>Wed, 08 Apr 2026 01:22:53 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/04/08/go-dual-model-routing-openai-claude-timeout-cost-fallback/</guid>
      <description>&lt;p&gt;线上接入单一模型供应商，最怕两件事，突发超时和账单失控。真正可落地的方案不是“多接一个模型”这么简单，而是把路由、超时、成本、回退放进同一个控制面。&lt;/p&gt;
&lt;p&gt;这篇给你一套 Go 可直接落地的双栈路由框架，目标是三件事，稳定性优先、成本可控、故障可快速止血。&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Responses &#43; Go Stream Recovery: Delta Persistence, Resume Tokens, and Duplicate Chunk Dedup</title>
      <link>https://www.mfun.ink/english/post/openai-responses-go-stream-resume-delta-dedup/</link>
      <pubDate>Mon, 23 Mar 2026 01:13:09 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/openai-responses-go-stream-resume-delta-dedup/</guid>
      <description>&lt;p&gt;In production, the painful part is not “streaming is slow.” It’s “streaming breaks and then duplicates output after reconnect.”&lt;br&gt;
This guide gives you a practical recovery loop: &lt;strong&gt;delta persistence + resume token + idempotent dedup&lt;/strong&gt;, so reconnection does not replay garbage.&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Responses &#43; Go 的流式中断恢复：delta 持久化、resume token 与重复片段去重</title>
      <link>https://www.mfun.ink/2026/03/23/openai-responses-go-stream-resume-delta-dedup/</link>
      <pubDate>Mon, 23 Mar 2026 01:13:09 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/03/23/openai-responses-go-stream-resume-delta-dedup/</guid>
      <description>&lt;p&gt;生产里最难受的不是“流式返回慢”，而是“流式返回断了还重复”，用户看到半句、重连后又从中间重喷一遍。&lt;br&gt;
这篇给一套可落地的恢复闭环：&lt;strong&gt;delta 持久化 + resume token + 幂等去重&lt;/strong&gt;，目标是“断线可续，重放不重字”。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Go &#43; OpenAI Responses Agent Memory Layering: Short-Term Context, Long-Term Index, and Cost Caps</title>
      <link>https://www.mfun.ink/english/post/go-openai-responses-agent-memory-layering/</link>
      <pubDate>Wed, 18 Mar 2026 16:33:52 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/go-openai-responses-agent-memory-layering/</guid>
      <description>&lt;p&gt;In production Go agents, the first thing that breaks is usually not model quality. It is memory management: context grows, bills spike, and answers drift.&lt;/p&gt;
&lt;p&gt;Use a 3-layer memory design:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;L1: short-term conversational window (seconds)&lt;/li&gt;
&lt;li&gt;L2: rolling summary (minutes)&lt;/li&gt;
&lt;li&gt;L3: long-term retrieval memory (days)&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    <item>
      <title>Go &#43; OpenAI Responses Agent 记忆分层实战：短期上下文、长期索引与成本封顶</title>
      <link>https://www.mfun.ink/2026/03/18/go-openai-responses-agent-memory-layering/</link>
      <pubDate>Wed, 18 Mar 2026 16:33:52 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/03/18/go-openai-responses-agent-memory-layering/</guid>
      <description>&lt;p&gt;你在 Go 里做 Agent，最容易翻车的不是推理能力，而是“记忆”失控：上下文越来越长、账单越来越高、回答却越来越飘。&lt;/p&gt;
&lt;p&gt;这篇给你一个可落地的三层方案：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;L1：短期会话上下文（秒级，强相关）&lt;/li&gt;
&lt;li&gt;L2：中期摘要记忆（分钟级，压缩）&lt;/li&gt;
&lt;li&gt;L3：长期检索记忆（天级，向量索引）&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    <item>
      <title>Go 服务调用 OpenAI 的 429/5xx 风暴应对：令牌桶、指数退避与熔断恢复</title>
      <link>https://www.mfun.ink/2026/03/18/go-openai-429-5xx-storm-defense-token-bucket-backoff-circuit-breaker/</link>
      <pubDate>Wed, 18 Mar 2026 01:14:00 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/03/18/go-openai-429-5xx-storm-defense-token-bucket-backoff-circuit-breaker/</guid>
      <description>&lt;p&gt;你不是被 OpenAI API「偶尔报错」打败的；你是被&lt;strong&gt;并发放大后的重试风暴&lt;/strong&gt;打败的。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Handling OpenAI 429/5xx Storms in Go: Token Bucket, Exponential Backoff, and Circuit Breakers</title>
      <link>https://www.mfun.ink/english/post/go-openai-429-5xx-storm-defense-token-bucket-backoff-circuit-breaker/</link>
      <pubDate>Wed, 18 Mar 2026 01:14:00 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/go-openai-429-5xx-storm-defense-token-bucket-backoff-circuit-breaker/</guid>
      <description>&lt;p&gt;Most Go teams are not killed by a single API error. They are killed by a retry storm they created themselves.&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Batch API &#43; Go 降本实战：离线拆批、失败重放与成本边界</title>
      <link>https://www.mfun.ink/2026/03/13/openai-batch-api-go-cost-control-offline-batching-failure-replay/</link>
      <pubDate>Fri, 13 Mar 2026 01:08:00 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/03/13/openai-batch-api-go-cost-control-offline-batching-failure-replay/</guid>
      <description>&lt;p&gt;一句话结论：如果你的调用是&lt;strong&gt;可延迟、可批处理、可回放&lt;/strong&gt;，就该把在线请求下沉到 Batch API；省钱最明显，但前提是你把拆批、失败分流和回放链路先做好。&lt;/p&gt;
&lt;p&gt;很多团队把 Batch API 当“便宜版同步接口”来用，结果不是省钱，而是把失败样本堆成事故池。真正的保守做法是：先定义成本边界和SLO，再做离线拆批与失败回放。&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Batch API with Go: Offline Batching, Failure Replay, and Cost Boundaries</title>
      <link>https://www.mfun.ink/english/post/openai-batch-api-go-cost-control-offline-batching-failure-replay/</link>
      <pubDate>Fri, 13 Mar 2026 01:08:00 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/openai-batch-api-go-cost-control-offline-batching-failure-replay/</guid>
      <description>&lt;p&gt;Short answer: if your workload is &lt;strong&gt;delay-tolerant, batchable, and replay-safe&lt;/strong&gt;, move it from online calls to Batch API. The savings are real, but only if you design splitting, failure routing, and replay first.&lt;/p&gt;
&lt;p&gt;Many teams treat Batch API as a cheaper sync endpoint. That usually creates a replay mess instead of stable savings. A conservative rollout starts with cost boundaries and SLOs, then implements offline batching and controlled replay.&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Responses Structured Outputs &#43; Go：Schema 演进、坏样本兜底与灰度回滚</title>
      <link>https://www.mfun.ink/2026/03/11/openai-responses-structured-outputs-go-schema-evolution-fallback-rollback/</link>
      <pubDate>Wed, 11 Mar 2026 01:08:00 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/03/11/openai-responses-structured-outputs-go-schema-evolution-fallback-rollback/</guid>
      <description>&lt;p&gt;Structured Outputs 最容易翻车的地方，不是“模型不听话”，而是&lt;strong&gt;你把 schema 当成了永远不变的圣旨&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;线上一旦进入版本演进期，最常见的事故就是：字段新增后老消费端崩、枚举值扩展后校验误杀、坏样本把整条链路拖死，最后只能半夜回滚，像在给自己写惊悚片。&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Responses Structured Outputs with Go: Schema Evolution, Bad-Case Fallbacks, and Gradual Rollback</title>
      <link>https://www.mfun.ink/english/post/openai-responses-structured-outputs-go-schema-evolution-fallback-rollback/</link>
      <pubDate>Wed, 11 Mar 2026 01:08:00 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/openai-responses-structured-outputs-go-schema-evolution-fallback-rollback/</guid>
      <description>&lt;p&gt;The hardest part of Structured Outputs is not getting JSON once. It is surviving schema changes without turning production into a small fire with excellent logs and terrible business results.&lt;/p&gt;
&lt;p&gt;Once a Go service starts evolving prompts and response contracts, the usual failure modes show up fast: a new required field breaks older consumers, an enum expands and strict validation kills valid requests, or one bad sample drags the whole chain into retries and rollback panic.&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Realtime &#43; Go in Production: WebRTC Token Rotation, Interruption Recovery, and End-to-End Latency Budgets</title>
      <link>https://www.mfun.ink/english/post/openai-realtime-go-webrtc-auth-recovery-latency-budget/</link>
      <pubDate>Mon, 09 Mar 2026 01:13:00 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/openai-realtime-go-webrtc-auth-recovery-latency-budget/</guid>
      <description>&lt;p&gt;If you plan to put OpenAI Realtime into production, do not let a passing demo fool you.&lt;/p&gt;
&lt;p&gt;What usually breaks the system is not the model itself. It is &lt;strong&gt;non-rotating short-lived auth, missing interruption state, and zero end-to-end latency budgeting&lt;/strong&gt;. Miss those three and your voice UX starts sounding like an angry walkie-talkie.&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Realtime &#43; Go 生产落地：WebRTC 鉴权轮换、打断恢复与端到端延迟预算</title>
      <link>https://www.mfun.ink/2026/03/09/openai-realtime-go-webrtc-auth-recovery-latency-budget/</link>
      <pubDate>Mon, 09 Mar 2026 01:13:00 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/03/09/openai-realtime-go-webrtc-auth-recovery-latency-budget/</guid>
      <description>&lt;p&gt;如果你准备把 OpenAI Realtime 真上生产，先别被“能跑通 demo”骗了。&lt;/p&gt;
&lt;p&gt;真正把系统打爆的，通常不是模型本身，而是 &lt;strong&gt;短时鉴权没轮换、打断恢复没状态机、端到端延迟没预算&lt;/strong&gt;。这三件事不补，语音体验会像在和一台卡顿的对讲机吵架。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Go &#43; OpenAI Responses: Connection Pooling and Timeout Budgets from HTTP/2 Reuse to Error-Budget Control</title>
      <link>https://www.mfun.ink/english/post/go-openai-responses-connection-pool-timeout-budget/</link>
      <pubDate>Fri, 06 Mar 2026 01:13:12 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/go-openai-responses-connection-pool-timeout-budget/</guid>
      <description>&lt;p&gt;When Go services call the OpenAI Responses API in production, the real failures are rarely about model quality. Most incidents come from transport instability: weak connection pooling, conflicting timeout layers, and retry storms.&lt;/p&gt;
&lt;p&gt;This guide gives you a practical baseline: HTTP/2 reuse, layered timeout budgets, bounded retries, and error-budget driven operations.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Go 调 OpenAI Responses 的连接池与超时预算：HTTP/2 复用到错误预算闭环</title>
      <link>https://www.mfun.ink/2026/03/06/go-openai-responses-connection-pool-timeout-budget/</link>
      <pubDate>Fri, 06 Mar 2026 01:13:12 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/03/06/go-openai-responses-connection-pool-timeout-budget/</guid>
      <description>&lt;p&gt;线上 Go 服务调用 OpenAI Responses 时，最容易踩的坑不是“模型不准”，而是链路抖动：连接池不稳、超时预算乱配、重试叠加把自己打挂。&lt;/p&gt;
&lt;p&gt;这篇给一套可落地的基线配置：HTTP/2 连接复用、分层超时、错误预算和退避重试，目标是把 5xx 与超时比例压到可控范围，并且能快速定位瓶颈。&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Responses &#43; Go 工具调用重试风暴治理：幂等键、退避抖动与熔断阈值</title>
      <link>https://www.mfun.ink/2026/03/04/openai-responses-go-retry-storm-idempotency-backoff-circuit-breaker/</link>
      <pubDate>Wed, 04 Mar 2026 01:10:40 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/03/04/openai-responses-go-retry-storm-idempotency-backoff-circuit-breaker/</guid>
      <description>&lt;p&gt;线上最可怕的不是一次失败，而是&lt;strong&gt;失败后被重试放大&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;在 OpenAI Responses + Go 的工具调用链路里，如果没有幂等键、退避抖动和熔断阈值，10 个请求很快就能打成 1000 个下游调用，账单和延迟一起爆炸。&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Responses &#43; Go: Taming Retry Storms with Idempotency Keys, Jittered Backoff, and Circuit Breakers</title>
      <link>https://www.mfun.ink/english/post/openai-responses-go-retry-storm-idempotency-backoff-circuit-breaker/</link>
      <pubDate>Wed, 04 Mar 2026 01:10:40 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/openai-responses-go-retry-storm-idempotency-backoff-circuit-breaker/</guid>
      <description>&lt;p&gt;The most expensive outage is not a single failure — it is a failure amplified by retries.&lt;/p&gt;
&lt;p&gt;In an OpenAI Responses + Go tool-calling stack, missing idempotency, jittered backoff, and breaker thresholds can turn 10 failing requests into 1000 downstream calls in minutes.&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Assistants/Responses 在 Go 里的上下文爆炸治理：截断策略、摘要回填与成本上限</title>
      <link>https://www.mfun.ink/2026/03/02/openai-assistants-responses-go/</link>
      <pubDate>Mon, 02 Mar 2026 12:44:00 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/03/02/openai-assistants-responses-go/</guid>
      <description>&lt;p&gt;线上 Agent 一跑久了就会遇到同一个坑：上下文越来越长，延迟飙升、费用失控，最后还更容易答偏。&lt;/p&gt;
&lt;p&gt;这不是模型“变笨”了，通常是上下文治理没做：该留的没留、该删的没删、该摘要的摘要坏了。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Taming Context Explosion in OpenAI Assistants/Responses with Go: Truncation, Summary Backfill, and Cost Caps</title>
      <link>https://www.mfun.ink/english/post/openai-assistants-responses-go/</link>
      <pubDate>Mon, 02 Mar 2026 12:44:00 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/openai-assistants-responses-go/</guid>
      <description>&lt;p&gt;Long-running agent sessions usually fail the same way: context keeps growing, latency spikes, costs blow up, and answer quality gets worse.&lt;/p&gt;
&lt;p&gt;That is rarely a model-quality issue. It is almost always missing context governance.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Go &#43; OpenAI API Timeout Troubleshooting: DNS, TLS, Proxy, and Connection Pool</title>
      <link>https://www.mfun.ink/english/post/go-openai-api-timeout-troubleshooting-dns-tls-proxy-connection-pool/</link>
      <pubDate>Mon, 02 Mar 2026 01:12:10 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/go-openai-api-timeout-troubleshooting-dns-tls-proxy-connection-pool/</guid>
      <description>&lt;p&gt;When OpenAI API calls start timing out in production, the real problem is usually not “OpenAI is down.”&lt;/p&gt;
&lt;p&gt;The real problem is you don’t know which hop is failing: DNS, TLS handshake, proxy path, or your own connection pool.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Go 调 OpenAI API 常见超时链路排查：DNS/TLS/代理/连接池一次讲清</title>
      <link>https://www.mfun.ink/2026/03/02/go-openai-api-timeout-troubleshooting-dns-tls-proxy-connection-pool/</link>
      <pubDate>Mon, 02 Mar 2026 01:12:10 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/03/02/go-openai-api-timeout-troubleshooting-dns-tls-proxy-connection-pool/</guid>
      <description>&lt;p&gt;线上调用 OpenAI API 一旦出现超时，最烦的不是“偶发失败”，而是你不知道到底卡在 DNS、TLS、代理，还是你自己的连接池。&lt;/p&gt;
&lt;p&gt;这篇给你一套可直接落地的排查顺序：先判定超时发生在哪一段，再用指标和最小实验定位，最后给可复制的 Go 配置模板，避免同类事故反复出现。&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Agents SDK &#43; Go 落地指南：Tool Calling、会话记忆与错误恢复</title>
      <link>https://www.mfun.ink/2026/02/25/openai-agents-sdk-go-tool-calling/</link>
      <pubDate>Wed, 25 Feb 2026 01:18:00 +0000</pubDate>
      <guid>https://www.mfun.ink/2026/02/25/openai-agents-sdk-go-tool-calling/</guid>
      <description>&lt;p&gt;很多团队已经把 LLM 接进业务，但一到“多步任务 + 调工具 + 失败重试”就开始失控：日志看不懂、状态回不去、成本还飙升。&lt;/p&gt;
&lt;p&gt;这篇给你一个能直接落地到 Go 服务里的最小可用方案：&lt;strong&gt;工具调用闭环、会话记忆分层、错误恢复可回放&lt;/strong&gt;。&lt;/p&gt;</description>
    </item>
    <item>
      <title>OpenAI Agents SDK with Go: Tool Calling, Session Memory, and Error Recovery</title>
      <link>https://www.mfun.ink/english/post/openai-agents-sdk-go-tool-calling/</link>
      <pubDate>Wed, 25 Feb 2026 01:18:00 +0000</pubDate>
      <guid>https://www.mfun.ink/english/post/openai-agents-sdk-go-tool-calling/</guid>
      <description>&lt;p&gt;Most teams can connect an LLM in a demo. The real pain starts in production: multi-step tasks, flaky tool calls, unclear retries, and rising cost.&lt;/p&gt;
&lt;p&gt;This guide gives you a pragmatic Go-first blueprint for shipping an Agent workflow that can survive real incidents.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Go 语言实现jpg和png图片的批量压缩</title>
      <link>https://www.mfun.ink/2024/01/28/img-tool/</link>
      <pubDate>Sun, 28 Jan 2024 21:42:10 +0800</pubDate>
      <guid>https://www.mfun.ink/2024/01/28/img-tool/</guid>
      <description>&lt;p&gt;记录笔记或者写博客的时候经常会直接复制mac截图插入图片，默认复制得到的是无损png图片，图片体积比较大，占空间带宽，就基于go实现了个命令行批量压缩工具。&lt;/p&gt;</description>
    </item>
    <item>
      <title>go 指针赋值是原子性的吗</title>
      <link>https://www.mfun.ink/2023/12/06/is-assigning-pointer-atomic-go/</link>
      <pubDate>Wed, 06 Dec 2023 21:16:31 +0800</pubDate>
      <guid>https://www.mfun.ink/2023/12/06/is-assigning-pointer-atomic-go/</guid>
      <description>&lt;h3 id=&#34;问题提出&#34;&gt;问题提出&lt;/h3&gt;
&lt;p&gt;提出这个问题主要是因为日常开发中有这样的场景，比如服务配置热加载或者一些全局缓存的异步更新，通常会单独启一个协程去获取最新数据再通过赋值更新原数据。因为更新逻辑是单独的协程，变量的写和读就存在并发访问的情况，于是就有了这个问题。一个简单异步刷新例子 如下：&lt;/p&gt;</description>
    </item>
    <item>
      <title>xorm使用map kv更新日期时间类型字段的时区问题</title>
      <link>https://www.mfun.ink/2023/07/29/xorm-update-time/</link>
      <pubDate>Sat, 29 Jul 2023 21:44:10 +0800</pubDate>
      <guid>https://www.mfun.ink/2023/07/29/xorm-update-time/</guid>
      <description>&lt;p&gt;最近使用xorm更新db的时候碰到一个挺有意思的问题，db中字段类型是日期datetime，对应go model中的字段是time.Time类型，在分别使用model和map两种方式进行更新时，使用model的方式更新能得到正确结果，db中的日期能被更新成当地时间；使用map kv的方式进行更新时db中的字段被更新成了格林尼治标准时间。都是取的go time.Now为什么更新结果不一样呢？&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Go&#34; data-lang=&#34;Go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// demo&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;type&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;TimeTest&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	&lt;span style=&#34;color:#a6e22e&#34;&gt;ID&lt;/span&gt;         &lt;span style=&#34;color:#66d9ef&#34;&gt;int64&lt;/span&gt;     &lt;span style=&#34;color:#e6db74&#34;&gt;`xorm:&amp;#34;not null pk autoincr INT(11) &amp;#39;id&amp;#39;&amp;#34;`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	&lt;span style=&#34;color:#a6e22e&#34;&gt;UpdateTime&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;time&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;Time&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;`xorm:&amp;#34;update_time&amp;#34;`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;UpdateTime&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;o&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;xorm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;Session&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	&lt;span style=&#34;color:#a6e22e&#34;&gt;o&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;Table&lt;/span&gt;(new(&lt;span style=&#34;color:#a6e22e&#34;&gt;TimeTest&lt;/span&gt;)).&lt;span style=&#34;color:#a6e22e&#34;&gt;Where&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id = ?&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;Update&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;TimeTest&lt;/span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;		&lt;span style=&#34;color:#a6e22e&#34;&gt;UpdateTime&lt;/span&gt;: &lt;span style=&#34;color:#a6e22e&#34;&gt;time&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;Now&lt;/span&gt;(),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	})
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	&lt;span style=&#34;color:#a6e22e&#34;&gt;o&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;Table&lt;/span&gt;(new(&lt;span style=&#34;color:#a6e22e&#34;&gt;TimeTest&lt;/span&gt;)).&lt;span style=&#34;color:#a6e22e&#34;&gt;Where&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id = ?&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;Update&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;map&lt;/span&gt;[&lt;span style=&#34;color:#66d9ef&#34;&gt;string&lt;/span&gt;]&lt;span style=&#34;color:#66d9ef&#34;&gt;interface&lt;/span&gt;{}{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;		&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;update_time&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#a6e22e&#34;&gt;time&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;Now&lt;/span&gt;(),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	})
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>基于redis实现一个简单的分布式限流器</title>
      <link>https://www.mfun.ink/2022/10/15/redis-current-limiter/</link>
      <pubDate>Sat, 15 Oct 2022 22:30:35 +0800</pubDate>
      <guid>https://www.mfun.ink/2022/10/15/redis-current-limiter/</guid>
      <description>&lt;p&gt;分布式限流器也是项目开发中常用的，基于redis incr指令可以比较方便快捷的实现一个分布式限流器，因为这个指令自身的原子性，所以不用开发者考虑计数过程的并发问题。下面是go代码实现。&lt;/p&gt;</description>
    </item>
    <item>
      <title>goroutine 并发数量限制</title>
      <link>https://www.mfun.ink/2022/10/15/goroutine-limit/</link>
      <pubDate>Sat, 15 Oct 2022 18:08:41 +0800</pubDate>
      <guid>https://www.mfun.ink/2022/10/15/goroutine-limit/</guid>
      <description>&lt;p&gt;最近经常用go写一些脚本，为了执行效率，一般会开启多个goroutine并发执行,脚本中通常会调用一些线上服务或者数据库读写数据，为了不影响线上服务运行,为了不影响线上服务运行就要对执行的goroutine数量进行限制，避免并发太大打垮线上服务。下面就简单写一个goroutine并发控制器。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Go启动main函数都干了什么(一)</title>
      <link>https://www.mfun.ink/2020/10/27/go-start-up/</link>
      <pubDate>Tue, 27 Oct 2020 15:27:33 +0800</pubDate>
      <guid>https://www.mfun.ink/2020/10/27/go-start-up/</guid>
      <description>&lt;h3 id=&#34;生成二进制可执行文件&#34;&gt;生成二进制可执行文件&lt;/h3&gt;
&lt;p&gt;首先，写一个go main函数，这里就简单输出以下hello world。&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;package main

import &amp;#34;fmt&amp;#34;

func main()  {
	fmt.Println(&amp;#34;hello word&amp;#34;)
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;执行&lt;code&gt;go build -gcflags &amp;quot;-N -l&amp;quot; -ldflags=-compressdwarf=false -o main main.go&lt;/code&gt;生成可执行二进制文件。&lt;/p&gt;
&lt;h3 id=&#34;开启gdb调试&#34;&gt;开启gdb调试&lt;/h3&gt;
&lt;p&gt;执行&lt;code&gt;gdb main&lt;/code&gt;开始gdb调试。通过i files查看程序入口地址，再这个地址打上断点。&lt;/p&gt;</description>
    </item>
    <item>
      <title>造轮子——go 版本控制(gvm)</title>
      <link>https://www.mfun.ink/2020/09/29/gvm/</link>
      <pubDate>Tue, 29 Sep 2020 20:36:24 +0800</pubDate>
      <guid>https://www.mfun.ink/2020/09/29/gvm/</guid>
      <description>&lt;h2 id=&#34;功能列表&#34;&gt;功能列表&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;支持linux、darwin&lt;/li&gt;
&lt;li&gt;获取远程go版本列表 &lt;code&gt;gvm remote&lt;/code&gt;
&lt;img loading=&#34;lazy&#34; src=&#34;https://www.mfun.ink/images/gvm/remote.png&#34;&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    <item>
      <title>sse(serve send events) 服务端推送技术</title>
      <link>https://www.mfun.ink/2020/09/12/sse/</link>
      <pubDate>Sat, 12 Sep 2020 22:58:30 +0800</pubDate>
      <guid>https://www.mfun.ink/2020/09/12/sse/</guid>
      <description>&lt;h3 id=&#34;什么是sse&#34;&gt;什么是sse&lt;/h3&gt;
&lt;p&gt;sse 指 serve send events，是一种基于http的服务端想客户端推送事件的技术，通常http请求都是请求&amp;ndash;&amp;gt;应答的模式，一次request&amp;ndash;&amp;gt;response结束后，连接就断开了，前端需要请求新的资源就需要重新建立连接，再次发起请求，当然http2.0后可以使用多路复用，不必建立新的连接。而sse指连接建立成功后，后端可以不断向前端推送消息。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
