x/tools/cmd/gomvpkg: // import未改变

xwbd5t1u  于 9个月前  发布在  Go
关注(0)|答案(3)|浏览(86)

请在提交问题之前回答以下问题。谢谢!

您正在使用的Go版本是什么(go version)?

1.10.3

这个问题在最新版本中是否重现?

1.10.3是最新的

您正在使用什么操作系统和处理器架构(go env)?

您做了什么?

  1. go get -u golang.org/x/tools/cmd/gomvpkg
  2. gomvpkg -from istio.io/fortio -to fortio.org/fortio
  3. # the fnet/network.go file has the other package changed but not itself (same for all files):
  4. package fnet // import "istio.io/fortio/fnet"
  5. import (
  6. "fmt"
  7. "io"
  8. "io/ioutil"
  9. "math/rand"
  10. "net"
  11. "os"
  12. "strconv"
  13. "strings"
  14. "sync"
  15. "fortio.org/fortio/log"
  16. "fortio.org/fortio/version"
  17. )

您期望看到什么?

将import注解更改为新位置

您实际上看到了什么?

// import没有改变

8nuwlpux

8nuwlpux1#

另一个无关的错误是,它在顶级go文件中将包名main更改为了fortio。

6g8kf2rb

6g8kf2rb2#

你测试了最新的gomvpkg版本吗?我在那里看到了一些代码,用于更新导入路径注解:
https://github.com/golang/tools/blob/5fad05c8188830251/refactor/rename/mvpkg.go#L247-L262
它似乎在golang/tools@13be4df版本中为#10508问题实现了。

5uzkadbs

5uzkadbs3#

我确实看到了三年前的一个链接:https://github.com/golang/tools/blame/master/refactor/rename/mvpkg.go#L253,但是我按照描述/复现中的方法使用了go get -u来获取最新的gomvpkg,但它并没有改变这些行,不知道为什么(是否与包作为给定参数的子包有关?)

相关问题