package main

import (
    "fmt"
    "sync"
    "time"
)

var once sync.Once

func main() {
    for i := 0; i < 10; i++ {
        go func() {
            once.Do(func() {
                fmt.Println("123")
            })
        }()
    }
    time.Sleep(time.Second * 30)
}

只能输出一个123