无法加载 github.com/open-policy-agent/opa/capabilities:没有 Go 源文件

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

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

问题

我正在为您翻译以下内容:

我试图使用以下命令安装OPA库:
go get 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
英文:

I was trying to install the OPA library using command
go get github.com/open-policy-agent/opa/rego

but installation is getting stuck with message

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

Below is the o/p of command:

-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

Is there any pre-requisite before installation of OPA? or am I missing something during installation?

-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

答案1

得分: 2

您的Go版本已经过时了几年。Opa要求至少使用Go 1.16版本。

英文:

Your Go version is outdated since several years. Opa requires at least Go 1.16

huangapple
  • 本文由 发表于 2023年6月22日 14:07:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76528999.html
匿名

发表评论

匿名网友

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

确定