Go already has a secure comparison function in the standard library:

http://golang.org/pkg/crypto/subtle/#ConstantTimeCompare