This is a port of Sindre Sorhus's excellent chalk/strip-ansi to Go.
$ go get -u github.com/jimschubert/stripansi
import (
"fmt"
"github.com/jimschubert/stripansi"
)
func main() {
result := stripansi.String("\x1b[30mfoo\x1b[0m \x1b[30mbar\x1b[0m \x1b[30mbaz\x1b[0m")
fmt.Println(result)
}
This is licensed under MIT.