]> Cypherpunks repositories - gostls13.git/commit
misc/cgo/errors: fix erroneous regexp detection
authorBryan C. Mills <bcmills@google.com>
Wed, 13 Sep 2017 19:14:05 +0000 (15:14 -0400)
committerBryan Mills <bcmills@google.com>
Thu, 14 Sep 2017 02:24:04 +0000 (02:24 +0000)
commit814d92230a6befef18084fdf62431a9e0ecab7d4
tree6455428841af623f9d9ca97bbd35b40826b4ec30
parent29415eb2b92e78481897c4161ba99f5b09fa6102
misc/cgo/errors: fix erroneous regexp detection

I had passed 1 instead of 2 to the SplitAfterN call in
errorstest.check, so all of the cases were erroneously falling through
to the non-regexp case (and passing even if the actual error didn't
match).

Now, we use bytes.HasSuffix to check for the non-regexp case, so we
will not incorrectly match a regexp comment to the non-regexp case.

updates #13467

Change-Id: Ia6be928a495425f2b7bae5001bd01346e115dcfa
Reviewed-on: https://go-review.googlesource.com/63692
Reviewed-by: Ian Lance Taylor <iant@golang.org>
misc/cgo/errors/errors_test.go