mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Merge pull request #1925 from hashmap/1898-test-race
Fix data race in lexer and lexer test
This commit is contained in:
commit
23ddbd64aa
2
Makefile
2
Makefile
|
@ -38,7 +38,7 @@ check_license:
|
|||
|
||||
test:
|
||||
@echo ">> running tests"
|
||||
@$(GO) test -short $(pkgs)
|
||||
@$(GO) test -race -short $(pkgs)
|
||||
|
||||
format:
|
||||
@echo ">> formatting code"
|
||||
|
|
|
@ -438,8 +438,12 @@ var tests = []struct {
|
|||
// for the parser to avoid duplicated effort.
|
||||
func TestLexer(t *testing.T) {
|
||||
for i, test := range tests {
|
||||
l := lex(test.input)
|
||||
l.seriesDesc = test.seriesDesc
|
||||
l := &lexer{
|
||||
input: test.input,
|
||||
items: make(chan item),
|
||||
seriesDesc: test.seriesDesc,
|
||||
}
|
||||
go l.run()
|
||||
|
||||
out := []item{}
|
||||
for it := range l.items {
|
||||
|
|
Loading…
Reference in a new issue