Closed MarkSonghurst closed 6 years ago
I found this comment in the Go 1.11 Release Notes:
The compiler now performs significantly more aggressive bounds-check and branch elimination. Notably, it now recognizes transitive relations, so if i<j and j<len(s), it can use these facts to eliminate the bounds check for s[i]. It also understands simple arithmetic such as s[i-10] and can recognize more inductive cases in loops. Furthermore, the compiler now uses bounds information to more aggressively optimize shift operations.
The issue is in the sec51/convert dependency package. Here is a PR which resolves the issue. To work around what I suspect are Go 1.11 optimisations, I've used the Go binary package to do the endian conversions.
The convert package is stored static in the source control for the twofactor package, so will need to be updated here in twofactor as well.
@MarkSonghurst I'm using go 1.10.3 and get the same error. I've copied the changes from your PR on top of the vendor ones and everything worked. @silenteh We need this merged ASAP. Thank you.
@MarkSonghurst thanks for your help in fixing the issues with Golang 1.11 @es-lab the pull request was merged
I use the twofactor package in a daemon, which suddenly started to panic when I rebuilt and ran it using Go version 1.11 - this does not happen with Go 1.10
Running
go test
on the twofactor package produces the error. If you rungo test --race
then the error does not happen.