go - 无法加载 github.com/open-policy-agent/opa/capability : no Go source files

标签 go rhel rhel7 opa open-policy-agent

我尝试使用命令安装 OPA 库 转到 github.com/open-policy-agent/opa/rego

但是安装过程中出现了消息

build github.com/open-policy-agent/opa/capabilities: cannot load github.com/open-policy-agent/opa/capabilities: no Go source files

下面是命令的操作:

-bash-4.2$ go get github.com/open-policy-agent/opa/rego
go: finding github.com/open-policy-agent/opa/rego latest
go: finding github.com/open-policy-agent/opa v0.53.1
go: downloading github.com/open-policy-agent/opa v0.53.1
go: extracting github.com/open-policy-agent/opa v0.53.1
go: downloading github.com/gorilla/mux v1.8.0
go: downloading github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
go: downloading github.com/sirupsen/logrus v1.9.2
go: downloading github.com/go-ini/ini v1.67.0
go: downloading go.opentelemetry.io/otel v1.14.0
go: extracting github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
go: downloading github.com/prometheus/client_golang v1.15.1
go: downloading github.com/OneOfOne/xxhash v1.2.8
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/gobwas/glob v0.2.3
go: extracting github.com/gorilla/mux v1.8.0
go: downloading github.com/tchap/go-patricia v2.2.6+incompatible
go: extracting github.com/prometheus/client_golang v1.15.1
go: extracting gopkg.in/yaml.v2 v2.4.0
go: extracting github.com/sirupsen/logrus v1.9.2
go: extracting github.com/OneOfOne/xxhash v1.2.8
go: extracting go.opentelemetry.io/otel v1.14.0
go: extracting github.com/tchap/go-patricia v2.2.6+incompatible
go: extracting github.com/go-ini/ini v1.67.0
go: downloading github.com/yashtewari/glob-intersection v0.1.0
go: downloading github.com/tchap/go-patricia/v2 v2.3.1
go: downloading github.com/ghodss/yaml v1.0.0
go: downloading github.com/agnivade/levenshtein v1.1.1
go: extracting github.com/tchap/go-patricia/v2 v2.3.1
go: downloading github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
go: extracting github.com/yashtewari/glob-intersection v0.1.0
go: extracting github.com/ghodss/yaml v1.0.0
go: extracting github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
go: extracting github.com/gobwas/glob v0.2.3
go: downloading github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb
go: downloading golang.org/x/sys v0.8.0
go: extracting github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb
go: extracting golang.org/x/sys v0.8.0
go: downloading google.golang.org/protobuf v1.30.0
go: downloading github.com/prometheus/client_model v0.3.0
go: downloading github.com/prometheus/common v0.42.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash v1.1.0
go: extracting github.com/agnivade/levenshtein v1.1.1
go: extracting github.com/prometheus/common v0.42.0
go: extracting github.com/beorn7/perks v1.0.1
go: extracting github.com/prometheus/client_model v0.3.0
go: extracting github.com/cespare/xxhash v1.1.0
go: downloading github.com/prometheus/procfs v0.9.0
go: downloading github.com/cespare/xxhash/v2 v2.2.0
go: extracting google.golang.org/protobuf v1.30.0
go: downloading github.com/golang/protobuf v1.5.3
go: extracting github.com/cespare/xxhash/v2 v2.2.0
go: extracting github.com/golang/protobuf v1.5.3
go: extracting github.com/prometheus/procfs v0.9.0
go: downloading go.opentelemetry.io/otel/sdk v1.14.0
go: extracting go.opentelemetry.io/otel/sdk v1.14.0
go: downloading github.com/go-logr/logr v1.2.4
go: extracting github.com/go-logr/logr v1.2.4
go: downloading github.com/go-logr/stdr v1.2.2
go: extracting github.com/go-logr/stdr v1.2.2
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.4
go: extracting github.com/matttproud/golang_protobuf_extensions v1.0.4
go: downloading go.opentelemetry.io/otel/trace v1.14.0
go: extracting go.opentelemetry.io/otel/trace v1.14.0
go: finding github.com/OneOfOne/xxhash v1.2.8
build github.com/open-policy-agent/opa/capabilities: cannot load github.com/open-policy-agent/opa/capabilities: no Go source files

安装 OPA 之前有什么先决条件吗?或者我在安装过程中遗漏了一些东西?

-bash-4.2$ uname -a
Linux dev-rh72-tas-1.in.intinfra.com 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

最佳答案

您的 Go 版本已经过时了好几年。 Opa 至少需要 Go 1.16

关于go - 无法加载 github.com/open-policy-agent/opa/capability : no Go source files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76528999/

相关文章:

firewall - 在 Centos7 中向 firewalld 添加规则以允许来自服务器的所有流量

vim - Red Hat EL7 默认设置的 vim colorcheme 是什么?如何将其移植到其他系统?

image - Go GC 似乎没有收集我未引用的图像加载指针?

centos - 打包RPM时如何设置已安装(谁在安装RPM)用户和组权限

function - 结构中缺少函数体和字符串标记

java - RHEL 5/RHEL 6 上的 libfaketime 和 java

postgresql - Chef PostgreSQL Cookbook 在 RHEL 7 上安装了错误的版本

hadoop - 是否可以在单独安装 Hadoop 和其他几个组件的 RHEL7 服务器上安装 CDH

go - 不内联简单函数

go - 如何使用 JSON 格式获取 Prometheus 节点导出器指标