今天開始學習go,發現go  有一個很好的功能便是使用gofmt可以在你儲存檔案時自動編排你的程式碼為標準格式,換言之就是會幫你自動做對齊格式,完全不用擔心格式的問題了,真好

若要使用請執行以下動作:

  1. Execute go get golang.org/x/tools/cmd/goimports
  2. Go to Preferences -> Go(->Tools)
  3. Set gofmt to ${GOPATH}/bin/goimports (which is where goimports is located)
  4. Restart Eclipse and make sure it uses goimports when CTRL+SHIFT+F is pressed.

 ps:若要每次存檔都執行記得勾選Format automatically on edit save

arrow
arrow

    狼翔月影 發表在 痞客邦 留言(0) 人氣()