---
title: "Ricky (@rickylin) | Hashnode"
description: "Ricky (@rickylin) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@rickylin"
---

@rickylin

# Ricky

@rickylin · Joined November 2025

## Comments

[1.25 的 synctest 看起來沒有 Run 應該是這樣吧 func TestAfterFunc(t \*testing.T) { synctest.Test(t, func(\*testing.T) { ctx, cancel := context.WithCancel(context.Background()) called := false context.AfterFunc(ctx, func() { called = true }) synctest.Wait() // 等到所有 goroutine 都卡住 if called { t.Fatal("AfterFunc 在 cancel 前就被呼叫") } cancel() synctest.Wait() // 再等一次 if !called { t.Fatal("AfterFunc 沒有在 cancel 後被呼叫") } }) }](https://hashnode.com/posts/go-synctest/687bc2dfac7de9dd7b16e818/comment/690d91b04ebd4e3a75bad13d)

Comment · Article · Nov 7, 2025 · [Go synctest：徹底解決並發測試的痛點](https://hashnode.com/posts/go-synctest/687bc2dfac7de9dd7b16e818)
