fatih / color

Color package for Go (golang)
https://pkg.go.dev/github.com/fatih/color
MIT License
7.26k stars 615 forks source link

Race condition #37

Closed hieuht817 closed 8 years ago

hieuht817 commented 8 years ago

I faced race condition. I think fixing this may solve:

// Set sets the SGR sequence.
func (c *Color) Set() *Color {
    c.Lock()
    if c.isNoColorSet() {
        return c
    }

    fmt.Fprintf(Output, c.format())
    return c
}

func (c *Color) unset() {
    if c.isNoColorSet() {
        return
    }

    Unset()
    c.Unlock()
}