从GitHub安装Go工具并遇到安装错误。

huangapple go评论100阅读模式
英文:

Installing a Go tool from github and facing installation errors

问题

我想安装这个来自GitHub的工具:https://github.com/ethicalhackingplayground/ssrf-tool

我正在使用以下命令:go install github.com/ethicalhackingplayground/ssrf-tool@latest

输出:

go: 找到 github.com/projectdiscovery/gologger 包的模块
go: 找到 github.com/briandowns/spinner 包的模块
go: 找到 github.com/logrusorgru/aurora 包的模块
go: 在 github.com/briandowns/spinner v1.18.1 中找到
go: 在 github.com/logrusorgru/aurora v2.0.3+incompatible 中找到
go: 在 github.com/projectdiscovery/gologger v1.1.4 中找到
# github.com/ethicalhackingplayground/ssrf-tool
..\..\..\go\pkg\mod\github.com\ethicalhackingplayground\ssrf-tool@v0.0.0-20200901082948-7f3cffc3c7bb\ssrftool.go:34:2: 未定义:gologger.Printf
..\..\..\go\pkg\mod\github.com\ethicalhackingplayground\ssrf-tool@v0.0.0-20200901082948-7f3cffc3c7bb\ssrftool.go:35:2: 未定义:gologger.Infof
..\..\..\go\pkg\mod\github.com\ethicalhackingplayground\ssrf-tool@v0.0.0-20200901082948-7f3cffc3c7bb\ssrftool.go:36:2: 未定义:gologger.Infof

我对Go语言非常陌生,因为其他来自GitHub的工具都可以正常工作,所以我的系统中的Go安装是正常的。
如果需要对这个工具的代码进行一些更改,请提供建议。

英文:

I want to install this tool from github : https://github.com/ethicalhackingplayground/ssrf-tool

I am using the cmd : go install github.com/ethicalhackingplayground/ssrf-tool@latest

Output :

go: finding module for package github.com/projectdiscovery/gologger
go: finding module for package github.com/briandowns/spinner
go: finding module for package github.com/logrusorgru/aurora
go: found github.com/briandowns/spinner in github.com/briandowns/spinner v1.18.1
go: found github.com/logrusorgru/aurora in github.com/logrusorgru/aurora v2.0.3+incompatible
go: found github.com/projectdiscovery/gologger in github.com/projectdiscovery/gologger v1.1.4
# github.com/ethicalhackingplayground/ssrf-tool
..\..\..\go\pkg\mod\github.com\ethicalhackingplayground\ssrf-tool@v0.0.0-20200901082948-7f3cffc3c7bb\ssrftool.go:34:2: undefined: gologger.Printf
..\..\..\go\pkg\mod\github.com\ethicalhackingplayground\ssrf-tool@v0.0.0-20200901082948-7f3cffc3c7bb\ssrftool.go:35:2: undefined: gologger.Infof
..\..\..\go\pkg\mod\github.com\ethicalhackingplayground\ssrf-tool@v0.0.0-20200901082948-7f3cffc3c7bb\ssrftool.go:36:2: undefined: gologger.Infof

I am super new to golang, go installation is fine in my system because other tools from github are working fine.
If some changes are required in the code of this tool, please suggest so.

答案1

得分: 3

这个源码是没有使用Go模块支持和旧版本的gologger创建的,以下是解决方法:

  1. 克隆仓库 git clone git@github.com:ethicalhackingplayground/ssrf-tool.git
  2. 进入 ssrf-tool 目录,创建 go.mod 文件并添加以下内容:
module github.com/ethicalhackingplayground/ssrf-tool

go 1.17

require (
	github.com/briandowns/spinner v1.18.1
	github.com/logrusorgru/aurora v2.0.3+incompatible
	github.com/projectdiscovery/gologger v1.0.1
)

require (
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/fatih/color v1.7.0 // indirect
	github.com/mattn/go-colorable v0.1.2 // indirect
	github.com/mattn/go-isatty v0.0.8 // indirect
	golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 // indirect
)

  1. 下载依赖 go mod download
  2. 构建可执行文件 go build .
  3. 运行 ./ssrf-tool --help

完成。

英文:

This sources created without go module support and an old version of gologger, here is a workaround:

  1. Clone repository git clone git@github.com:ethicalhackingplayground/ssrf-tool.git
  2. cd ssrf-tool create go.mod file with content:
module github.com/ethicalhackingplayground/ssrf-tool

go 1.17

require (
	github.com/briandowns/spinner v1.18.1
	github.com/logrusorgru/aurora v2.0.3+incompatible
	github.com/projectdiscovery/gologger v1.0.1
)

require (
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/fatih/color v1.7.0 // indirect
	github.com/mattn/go-colorable v0.1.2 // indirect
	github.com/mattn/go-isatty v0.0.8 // indirect
	golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 // indirect
)

  1. download deps go mod download
  2. Build executable go build .
  3. ./ssrf-tool --help

Profit.

答案2

得分: 1

这是修复了问题的仓库

go install github.com/R0X4R/ssrf-tool@latest

或者

git clone https://github.com/R0X4R/ssrf-tool.git
cd ssrf-tool
go build ssrftool.go && mv ssrftool /usr/bin/
英文:

Here is the repo with the problem fixed.

go install github.com/R0X4R/ssrf-tool@latest

or

git clone https://github.com/R0X4R/ssrf-tool.git
cd ssrf-tool
go build ssrftool.go && mv ssrftool /usr/bin/

huangapple
  • 本文由 发表于 2022年3月4日 17:58:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/71349626.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定