簡體   English   中英

如何在GoClipse中啟用自動導入?

[英]How to enable autoimport in GoClipse?

根據這篇文章,可以在GoClipse中啟用自動導入:

 1) install goimports: go get code.google.com/p/go.tools/cmd/goimports 2) in eclipse goto: Preferences -> Go -> Go Formatter and set it to be the path of the goimports bin This will fix all imports when you format. If you combine this with #67, then imports will be automatically fixed on save. 

問題

當我嘗試在Eclipse中搜索Go Formatter時,找不到它。

在此處輸入圖片說明

我的眼睛引起注意的一件事:

我知道goimports網址不再是google.com/p/go.tools/cmd/goimports。

因此,請嘗試以下操作:

  1. 執行go get golang.org/x/tools/cmd/goimports
  2. 轉到Preferences -> Go
  3. gofmt設置為${GOPATH}/bin/goimports (goimports所在的位置)
  4. 重新啟動Eclipse並確保在按下CTRL + SHIFT + F時使用goimports

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM