Go format in VSCode ========================== ###### tags: `Go` 1. Mac open visual studio code vscode 內打開```command palette```  搜尋```shell command``` 找到shell command: install code command in path  2. 修改goformat [^1] 到/usr/local/go/src/go/format/format.go 修改內容 ```go tabWidth = 4 printerMode = printer.UseSpaces ``` 3. 打開```command palette``` 搜尋 加入[^2][^3] ```jsonld= "go.testFlags": [ "-v" ], "github-enterprise.uri": "format", "[go]": { "editor.insertSpaces": true, "editor.snippetSuggestions": "none", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.organizeImports": true } }, "editor.renderControlCharacters": true, "editor.renderWhitespace": "all", "go.formatTool": "goformat", ``` 完成顯示如下  [^1]: [ref](https://www.cnblogs.com/hiwz/p/12642771.html) [^2]: [ref](https://www.cnblogs.com/weiweivip666/p/15972265.html) [^3]: [ref](https://code.visualstudio.com/docs/languages/go#_test)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up