今天開始學習go,發現go 有一個很好的功能便是使用gofmt可以在你儲存檔案時自動編排你的程式碼為標準格式,換言之就是會幫你自動做對齊格式,完全不用擔心格式的問題了,真好
若要使用請執行以下動作:
- Execute
go get golang.org/x/tools/cmd/goimports
- Go to
Preferences
->Go(->Tools)
- Set
gofmt
to${GOPATH}/bin/goimports
(which is where goimports is located) - Restart
Eclipse
and make sure it usesgoimports
when CTRL+SHIFT+F is pressed.
ps:若要每次存檔都執行記得勾選Format automatically on edit save
文章標籤
全站熱搜