'Error shfmt not found

When i open visual studio code editor in ubuntu 16.04 it shown below error at the top.

shfmt not found! run go get -u github.com/mvdan/sh/cmd/shfmt to install

However i tried to find out solution from his official website but didn't get any solution.

After installing golang-go getting below error.

#go get -u github.com/mvdan/sh/cmd/shfmt

Output:

go/src/github.com/mvdan/sh/cmd/shfmt/main.go:156: undefined: io.SeekStart


Solution 1:[1]

shfmt is also available on snap store:

snap install shfmt

Solution 2:[2]

You will have to install go first. Once you do then you can run

go get -u github.com/mvdan/sh/cmd/shfmt

Solution 3:[3]

Another option is to use:

curl -sS https://webinstall.dev/shfmt | bash

See https://ostechnix.com/how-to-format-shell-programs-using-shfmt-in-linux/.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Panagiotis Simakis
Solution 2 asembereng
Solution 3 Raul Santelices