huandu / go-tls

A bit safer approach to implement Thread Local Storage (TLS) for Go 1.7+.
MIT License
162 stars 16 forks source link

broken @go1.17 #10

Open xiekeyi98 opened 3 years ago

xiekeyi98 commented 3 years ago

go 1.17 it is relased.

And this repo will broken at the unit test.

xiekeyi98 commented 3 years ago

image

package main

import (
    "context"
    "fmt"

    "github.com/huandu/go-tls"
)

func main() {
    ctx, can := context.WithCancel(context.Background())
    go func() {
        defer can()
        k, v := "k", "v"
        tls.Set(k, tls.MakeData(v))
        g, exi := tls.Get(k)
        fmt.Printf("%v,[%v,%v]\n", tls.ID(), g, exi)
    }()
    <-ctx.Done()
}
huandu commented 3 years ago

Thanks for letting me know this. I'll take a look at it later.