Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not thread safe #1

Open
jijeshmohan opened this issue Aug 16, 2017 · 0 comments
Open

Not thread safe #1

jijeshmohan opened this issue Aug 16, 2017 · 0 comments

Comments

@jijeshmohan
Copy link

jijeshmohan commented Aug 16, 2017

package main

import (
	"fmt"
	me "github.com/gojek-engineering/go-multierror"
)

func main() {
	errs := me.NewMultiError()
	errs.Push("sample")

	go writeToErr(errs)
	go readFromErr(errs)

	if err := readFromErr(errs); err != nil {
		fmt.Println(err)
	}
}

func writeToErr(errs *me.MultiError) {
	errs.Push("new error")
}

func readFromErr(errs *me.MultiError) error {
	return errs.HasError()
}

run this code with -race flag

@ghost ghost mentioned this issue Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant