Redeclared in this block build error

Problem

When trying to build Lotus, you encounter an error stating that some code has been redeclared in a block. It usually looks something similar to this:

/usr/local/go/../...go:15:6 xxxx redeclared in this block

Resolution

This error stems from a Go version being installed on top of the previous Go version. To fix the issue:

  1. Uninstall the existing Go version
sudo rm -rf /usr/local/go
  1. Install the new Go version needed to run Lotus.

This docs page will always be up to date with which Go version is needed to build Lotus.