How To Install Gofmt On Debian, Ubuntu, Arch, Kali, CentOS, Fedora And Raspbian?
Install gofmt
-
Debian
apt-get install golang-1.12-goClick to copy -
Ubuntu
apt-get install golang-1.12-goClick to copy -
Arch Linux
pacman -S go-pieClick to copy -
Kali Linux
apt-get install golang-1.11-goClick to copy -
CentOS
yum install gcc-goClick to copy -
Fedora
dnf install gcc-goClick to copy -
Raspbian
apt-get install golang-1.6-goClick to copy
Tool for formatting Go source code.
How to use gofmt?
Below are few example commands for gofmt that you can use in the terminal.
Format a file and display the result to the console:gofmt source.goClick to copyFormat a file, overwriting the original file in-place:gofmt -w source.goClick to copyFormat a file, and then simplify the code, overwriting the original file:gofmt -s -w source.goClick to copyPrint all (including spurious) errors:gofmt -e source.goClick to copy
Installation of latest gofmt command is available for Debian, Ubuntu, Arch, Kali, CentOS, Fedora and Raspbian. You can copy the command for your OS from above and paste it into your terminal. Once you run the command it will download the 2026 latest package from the repository and install it in your computer/server.




