I have a library here (http://ift.tt/2ij0QJS) that includes a test comparing functionality of a custom scanner to bufio.Scanner
. In particular, I am comparing my approach to the Buffer
method which wasn't added until go1.6.
My actual code works with versions of go back to 1.4, but I wanted to include this test (and I'd like to add a benchmark as well) that uses the Buffer
function of the bufio.Scanner
object.
How can I include these tests that use features of go1.6+ while still allowing code to run for go1.4 and 1.5?
I imagine the answer is using a build flag to trigger the execution of these tests only if explicitly requested (and I do have access to the go version in my CI pipeline via a travis environment variable). I could also abuse the short flag here.
Is there a cleaner approach?
Aucun commentaire:
Enregistrer un commentaire