gpt4 book ai didi

go - 如何在 Go 源代码目录中列出导入的模块

转载 作者:数据小太阳 更新时间:2023-10-29 03:37:41 25 4
gpt4 key购买 nike

是否有工具或最简单的方法来列出go源代码目录中的所有导入包?例如:

$ go list_imports a_directory/
github.com/bla/bla
github.com/foo/bar
LOCAL/module/path

最佳答案

啊找到了way ..

go list -f '{{join .Deps "\n"}}' |  xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}} ' | sort | uniq

关于go - 如何在 Go 源代码目录中列出导入的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28710397/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com