VSCode - Replace Tab with 4 Spaces for Go

发布时间 2023-06-14 19:18:28作者: ZhangZhihuiAAA

Check below settings:

If got below error message, just run the command:

The "goformat" command is not available. Run "go install -v winterdrache.de/goformat/goformat@v0.0.0-20180512004123-256ef38c4271" to install.

 

Open a file, click 'Tab Size: 4' in the status bar:

Select 'Indent Using Spaces':

Select '4'.

Then you can see 'Spaces: 4' in the status bar:

 

All done.

When you save the file, all tab indentations will be replaced by 4 spaces and new tab indentation will be replaced by 4 spaces too.