After reading about go list I made a small powershell script that will list all dependencies of a project, but also query the Github API for license information for all github imported packages

blov · 2017-11-08 06:00:28 · 608 次点击    
这是一个分享于 2017-11-08 06:00:28 的资源,其中的信息可能已经有所发展或是发生改变。

https://gist.github.com/elvarb/c680e52b83f069cc5e4cd2e8033999d3

Because the API has a rate limit it is better to generate an API key for this.

https://github.com/settings/tokens

Example output

encoding/hex
encoding/json
encoding/pem
errors
flag
fmt
github.com/BurntSushi/toml
-> License:  MIT License
github.com/fsnotify/fsnotify
-> License:  BSD 3-clause "New" or "Revised" License
github.com/hashicorp/hcl
-> License:  Mozilla Public License 2.0

This really should be a go program or a feature in go list.


评论:

ChristophBerger:

Nice!

The next iteration could be a re-write in Go (= cross-platform)... (Or does someone have a powershell-to-fish converter around?)

noonexx:

The newest PowerShell is cross-platform and afaik open source. The script above works just as well on my Linux installation.

ChristophBerger:

Wow, didn't know that. But it appears to be true...

Guess I'll have to check this out...

Redundancy_:

I think the question is why anyone would want to read or write powershell by choice. I've provisioned machines with it, but I really hate using it due to the way that it's more a shell script than a programming language (in error handling and string manipulation etc)

slantview:

Honestly, being written for go but using powershell is just kinda head scratching.

DudPug:

It was just something I needed to do quickly and I'm still more proficient in powershell than in go.

Should be very easy to do in go though and might be something I do in the future.

anxiousalpaca:

sweet


入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

608 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传