dongyi4170
2014-11-09 02:10
浏览 124

vim-go写入磁盘时删除未使用的代码

I have imported several packages into a file in a Go package (package commands) I am writing (following along with a golang tutorial) using Vim with the Vim-Go plugin. Several of these packages are not yet used in the package. When I save the file :w, Vim seems to be deleting the unused packages, which is really annoying because those unused packages are going to be used. I just haven't added the necessary code for them. Is there a way to turn off this functionality in Vim-Go or do I have to delete the whole plugin to get rid of this annoying behavior?

Before Write

package commands
import (
    "fmt"
    "os"
    "time"

    rss "github.com/jteeuwen/go-pkg-rss"
    "github.com/spf13/cobra"
    "github.com/spf13/viper"
)

After Save

import (
    "github.com/spf13/cobra"
    "github.com/spf13/viper"
)

图片转代码服务由CSDN问答提供 功能建议

我已将多个软件包导入Go软件包的文件中( package命令</ code>) 正在使用带有Vim-Go插件的Vim编写(跟随golang教程)。 这些软件包中有几个尚未在软件包中使用。 当我保存文件:w </ code>时,Vim似乎正在删除未使用的软件包,这确实很烦人,因为这些未使用的软件包将被使用。 我只是没有为他们添加必要的代码。 有没有办法在Vim-Go中关闭此功能,还是我必须删除整个插件才能摆脱这种烦人的行为?</ p>

写之前</ p> \ n

 包命令
import(
“ fmt” 
“ os” 
“ time” 
 
 rss“ github.com/jteeuwen/go-pkg-rss"
” github。  com / spf13 / cobra“ 
” github.com/spf13/viper"
)
 </ pre> 
 
 

保存后</ p>

   import(
“ github.com/spf13/cobra"
” github.com/spf13/viper"
)
</ div>

1条回答 默认 最新

相关推荐 更多相似问题