encoding/gocode: be resilient to Go string literal changes
The way that Go encodes string literals changes between
go1.18 and go1.19, which breaks this test.
We care about the actual bytes because the tests in `gen_test.go`
perform functional tests on the generated code (rather than
generating to a temporary location and testing that), so it's
important to know that those tests are running on that exact code.
So we normalize the code before comparison to make the test
resilient to both encoding conventions.
Also fix the tests in `gen_test.go` and update the generated files
to correspond with the new quoting convention.
Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I5ac51093e45933f6a4ae28eacad36d45c1ddc1e9
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/542972
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>