gofmt: command not found

Have You tried accessing the binary with the full path?

Maybe Your $PATH variable doesn't contain the default paths? echo $PATH should give something like:

[root@server ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

If it's empty, You may set the PATH variable with this command

export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

On CentOS possible default full paths are:

/usr/bin/gofmt - from package: golang-bin
/usr/lib/golang/bin/gofmt - from package: golang-bin

You may install the required package with command yum install {package}

On Debian possible default full paths are:

/usr/bin/gofmt - from package: golang-go

You may install the required package with command apt-get install {package}
Error in other languages:
gofmt: bevel nie gevind nie
gofmt: comandă negăsită
gofmt: comando não encontrado
gofmt: commande introuvable
gofmt: command not found
gofmt: käsku ei ole
gofmt: không tìm thấy lệnh
gofmt: komanda nerasta
gofmt: Kommando nicht gefunden.
gofmt: kommandot finns inte
gofmt: komut yok
gofmt: nie znaleziono polecenia
gofmt: níor aimsíodh an t-ordú
gofmt: no se encontró la orden
gofmt: no s'ha trobat l'ordre
gofmt: opdracht niet gevonden
gofmt: parancs nem található
gofmt: perintah tidak ditemukan
gofmt: príkaz nenájdený
gofmt: příkaz nenalezen
gofmt: команда не найдена
gofmt: командата не е открита
gofmt: 命令找不到
gofmt: コマンドが見つかりません