如何从下载的源代码安装Go编程应用程序

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

How to install Go programming application from a downloaded source code

问题

已经过去几个小时了,但是没有任何成功的进展...我正在尝试安装一个名为"Siegfried"的应用程序。
我有一台没有任何互联网访问权限的Redhat服务器,所以我无法运行wget、brew或其他类似的命令。

我从以下网址下载了源代码:

https://github.com/richardlehane/siegfried
我以为我可以构建和安装...简单得像吃蛋糕一样。

根据这个页面上的说明,我意识到我需要Go编程编译器。

https://github.com/richardlehane/siegfried/wiki/Getting-started

我下载了Go并修复了$PATH,Go正在工作。现在怎么办?我已经下载了源代码,我有了Go,现在我需要,我猜是构建,或安装,或...先构建再安装。我在这里快要疯了。我该怎么做?非常感谢任何建议。

补充:
现在我在.profile中有以下设置:

[madde@m101010 etc]$ echo $PATH
/opt/apache-maven-3.6.3/bin:/opt/apache-maven-3.6.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/local/arkiv/bin:/opt/pupal/go/bin:/usr/local/arkiv/bin:/usr/lib/jvm/java/bin:/usr/local/tomcat9:/usr/local/go/bin:/bin:/home/madde/go/bin
[madde@m101010 etc]$ echo $GOPATH
/home/madde/go
[madde@m101010 etc]$ go version
go version go1.18.2 linux/amd64

仍然出现以下错误:

[madde@m101010 siegfried-main]$ go install ./cmd/sf
go: github.com/richardlehane/characterize@v1.0.0: reading https://proxy.golang.org/github.com/richardlehane/characterize/@v/v1.0.0.mod: 403 Forbidden
go: downloading github.com/richardlehane/characterize v1.0.0
go: downloading github.com/richardlehane/webarchive v1.0.0
go: downloading github.com/richardlehane/mscfb v1.0.4
go: downloading github.com/richardlehane/match v1.0.0
go: downloading golang.org/x/image v0.0.0-20211028202545-6944b10bf410
go: downloading github.com/richardlehane/xmldetect v1.0.2
go: downloading golang.org/x/sys v0.0.0-20220114195835-da31bd327af9
go: downloading github.com/ross-spencer/wikiprov v0.2.0
go: github.com/richardlehane/characterize@v1.0.0: reading https://proxy.golang.org/github.com/richardlehane/characterize/@v/v1.0.0.mod: 403 Forbidden

英文:

It has been few hours now without any success.... I am trying to install an application "Siegfried".
I have a Redhat server without any internet access why I cannot run wget or brew or anything like as

wget -qO - https://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
echo "deb http://dl.bintray.com/siegfried/debian wheezy main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update && sudo apt-get install siegfried

I downloaded the source code from

https://github.com/richardlehane/siegfried

I thought I could build and install... easy as pie.

I realized according to instructions in this page, I need Go programming compiler

https://github.com/richardlehane/siegfried/wiki/Getting-started

I downloaded Go and fixed the $PATH and Go is working. Now what? I have downloaded the source, I have Go, and now I need to, I guess build, or install or... first build then install. I am going nuts here. How do i proceed? Many thanks for any advices.

ADDING:
Now I have settings i .profile which gives me following:

[madde@m101010 etc]$ echo $PATH
/opt/apache-maven-3.6.3/bin:/opt/apache-maven-3.6.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/local/arkiv/bin:/opt/pupal/go/bin:/usr/local/arkiv/bin:/usr/lib/jvm/java/bin:/usr/local/tomcat9:/usr/local/go/bin:/bin:/home/madde/go/bin
[madde@m101010 etc]$ echo $GOPATH
/home/madde/go
[madde@m101010 etc]$ go version
go version go1.18.2 linux/amd64

Still get:

[madde@m101010 siegfried-main]$ go install ./cmd/sf
go: github.com/richardlehane/characterize@v1.0.0: reading https://proxy.golang.org/github.com/richardlehane/characterize/@v/v1.0.0.mod: 403 Forbidden
go: downloading github.com/richardlehane/characterize v1.0.0
go: downloading github.com/richardlehane/webarchive v1.0.0
go: downloading github.com/richardlehane/mscfb v1.0.4
go: downloading github.com/richardlehane/match v1.0.0
go: downloading golang.org/x/image v0.0.0-20211028202545-6944b10bf410
go: downloading github.com/richardlehane/xmldetect v1.0.2
go: downloading golang.org/x/sys v0.0.0-20220114195835-da31bd327af9
go: downloading github.com/ross-spencer/wikiprov v0.2.0
go: github.com/richardlehane/characterize@v1.0.0: reading https://proxy.golang.org/github.com/richardlehane/characterize/@v/v1.0.0.mod: 403 Forbidden

答案1

得分: 2

使用git clone(您要克隆的存储库/软件包的链接),但您必须检查您的$GOPATH或将其移动到文件夹中。

英文:

using git clone (your link for repo/package you want)
but you must check in your or move to folder $GOPATH

答案2

得分: 1

我相信你正在寻找go install命令。

go install [编译标志] []

我按照以下步骤进行操作,它成功安装了:

git clone https://github.com/richardlehane/siegfried.git
cd siegfried
go install ./cmd/sf
go install ./cmd/roy

➜ which sf
/Users/h4s/projects/go/bin/sf

➜ which roy
/Users/h4s/projects/go/bin/roy
英文:

I believe you're looking for the go install command.

go install [build flags] [packages]

I followed these steps, and it installed just fine:

git clone https://github.com/richardlehane/siegfried.git
cd siegfried
go install ./cmd/sf
go install ./cmd/roy

➜ which sf
/Users/h4s/projects/go/bin/sf

➜ which roy
/Users/h4s/projects/go/bin/roy

huangapple
  • 本文由 发表于 2022年5月20日 01:55:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/72309113.html
匿名

发表评论

匿名网友

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

确定