Why does it have to be the compiler? The thing about unused variables seems quite arbitrary to me. There are also other things the Go compiler doesn't enforce.
Why not pick a tool that's specialized for stuff like that, like a style checker. Put it into the build pipeline and let the build fail if the code doesn't adhere to your standards.