编译postgresexporter遇到的问题该如何解决

编译postgres exporter遇到的问题该如何解决,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

专注于为中小企业提供成都网站制作、网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业长宁免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了近1000家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

在编译prometheus的postgres exporter时,遇到了以下错误:

[parallels@centos7 postgres_exporter]$ go run mage.go binary
go: finding github.com/magefile/mage v1.10.0
go: downloading github.com/magefile/mage v1.10.0
go: extracting github.com/magefile/mage v1.10.0
Error determining list of magefiles: failed to list non-mage gofiles: exit status 1: go: cannot find main module, but found vendor/vendor.json in /home/parallels/Go/src/postgres_exporter
	to create a module there, run:
	go mod init

exit status 1

经过调查,发现是之前配置的go mod环境变量导致的编译失败,具体原因还有待研究。

于是手工通过关闭GO111MODULE环境变量编译成功,如下:

[parallels@centos7 postgres_exporter]$ export GO111MODULE=off
[parallels@centos7 postgres_exporter]$ go run mage.go binary
2020/09/15 01:17:33 exec: git rev-parse --abbrev-ref HEAD
2020/09/15 01:17:33 exec: git rev-parse HEAD
2020/09/15 01:17:33 exec: git describe --dirty
2020/09/15 01:17:33 exec: git describe --abbrev=0
2020/09/15 01:17:34 exec: go list ./...
golang.org/x/tools/cover
github.com/pelletier/go-buffruneio
github.com/google/shlex
github.com/mattn/goveralls
github.com/nicksnyder/go-i18n/i18n/language
github.com/alecthomas/units
github.com/nicksnyder/go-i18n/i18n/translation
github.com/pelletier/go-toml
gopkg.in/yaml.v2
github.com/nicksnyder/go-i18n/i18n/bundle
github.com/nicksnyder/go-i18n/i18n
Finished 1 of 6
gopkg.in/alecthomas/kingpin.v3-unstable
github.com/alecthomas/gometalinter
github.com/kardianos/govendor/prompt
golang.org/x/sys/unix
github.com/dchest/safefile
github.com/kardianos/govendor/internal/pathos
github.com/Bowery/prompt
github.com/kardianos/govendor/internal/vos
github.com/kardianos/govendor/cliprompt
github.com/kardianos/govendor/internal/vfilepath
github.com/kardianos/govendor/pkgspec
github.com/kardianos/govendor/vendorfile
github.com/kardianos/govendor/vcs
github.com/pkg/errors
golang.org/x/tools/go/vcs
Finished 2 of 6
github.com/kardianos/govendor/context
github.com/wadey/gocovmerge
github.com/kardianos/govendor/migrate
Finished 3 of 6
github.com/kardianos/govendor/help
github.com/kardianos/govendor/run
github.com/kardianos/govendor
github.com/tmthrgd/go-bindata/internal/identifier
github.com/tmthrgd/go-bindata
github.com/tmthrgd/go-bindata/go-bindata
Finished 4 of 6
Finished 5 of 6
github.com/nbutton23/zxcvbn-go/match
golang.org/x/tools/go/ast/astutil
golang.org/x/tools/go/buildutil
golang.org/x/tools/go/loader
github.com/nbutton23/zxcvbn-go/data
github.com/GoASTScanner/gas
github.com/nbutton23/zxcvbn-go/adjacency
github.com/GoASTScanner/gas/output
github.com/nbutton23/zxcvbn-go/utils/math
github.com/nbutton23/zxcvbn-go/entropy
github.com/nbutton23/zxcvbn-go/frequency
github.com/nbutton23/zxcvbn-go/scoring
github.com/kisielk/gotool
github.com/nbutton23/zxcvbn-go/matching
github.com/ryanuber/go-glob
github.com/nbutton23/zxcvbn-go
github.com/GoASTScanner/gas/rules
github.com/GoASTScanner/gas/cmd/gas
Finished 6 of 6
golang.org/x/tools/cmd/gotype
github.com/opennota/check/cmd/structcheck
Finished 1 of 25
Finished 2 of 25
github.com/alexflint/go-scalar
github.com/walle/lll
github.com/alexflint/go-arg
github.com/walle/lll/cmd/lll
honnef.co/go/tools/deprecated
golang.org/x/tools/go/types/typeutil
honnef.co/go/tools/version
honnef.co/go/tools/ssa
Finished 3 of 25
honnef.co/go/tools/callgraph
honnef.co/go/tools/ssa/ssautil
golang.org/x/text/transform
honnef.co/go/tools/lint
honnef.co/go/tools/lint/lintutil
honnef.co/go/tools/staticcheck/vrp
golang.org/x/text/width
honnef.co/go/tools/internal/sharedcheck
honnef.co/go/tools/simple
github.com/mdempsky/unconvert
honnef.co/go/tools/callgraph/static
honnef.co/go/tools/unused
honnef.co/go/tools/functions
honnef.co/go/tools/staticcheck
honnef.co/go/tools/cmd/megacheck
Finished 4 of 25
Finished 5 of 25
github.com/jgautheron/goconst
github.com/jgautheron/goconst/cmd/goconst
Finished 6 of 25
Finished 7 of 25
honnef.co/go/tools/cmd/gosimple
golang.org/x/tools/go/ssa
mvdan.cc/lint
golang.org/x/tools/go/ssa/ssautil
Finished 8 of 25
mvdan.cc/interfacer/check
mvdan.cc/interfacer
golang.org/x/tools/go/callgraph
golang.org/x/tools/go/callgraph/cha
golang.org/x/tools/go/callgraph/rta
mvdan.cc/unparam/check
mvdan.cc/unparam
Finished 9 of 25
github.com/opennota/check/cmd/varcheck
Finished 10 of 25
github.com/dnephin/govet/internal/whitelist
github.com/dnephin/govet/internal/cfg
github.com/dnephin/govet
Finished 11 of 25
honnef.co/go/tools/cmd/unused
Finished 12 of 25
Finished 13 of 25
github.com/alecthomas/gocyclo
golang.org/x/tools/imports
Finished 14 of 25
golang.org/x/tools/cmd/goimports
github.com/mdempsky/maligned
Finished 15 of 25
github.com/tsenart/deadcode
Finished 16 of 25
github.com/mibk/dupl/suffixtree
github.com/mibk/dupl/syntax
github.com/mibk/dupl/syntax/golang
github.com/mibk/dupl/printer
Finished 17 of 25
github.com/mibk/dupl/job
github.com/mibk/dupl
github.com/client9/misspell
Finished 18 of 25
github.com/alexkohler/nakedret
github.com/client9/misspell/cmd/misspell
Finished 19 of 25
golang.org/x/tools/container/intsets
golang.org/x/tools/go/pointer
github.com/stripe/safesql
Finished 20 of 25
golang.org/x/tools/go/gcimporter15
golang.org/x/tools/go/gcexportdata
golang.org/x/lint
Finished 21 of 25
github.com/golang/lint/golint
github.com/kisielk/errcheck/internal/errcheck
github.com/kisielk/errcheck
Finished 22 of 25
github.com/gordonklaus/ineffassign
Finished 23 of 25
Finished 24 of 25
honnef.co/go/tools/cmd/staticcheck
Finished 25 of 25
Building /home/parallels/Go/src/postgres_exporter/bin/postgres_exporter_v0.0.0_linux-amd64/postgres_exporter
[parallels@centos7 postgres_exporter]$

关于编译postgres exporter遇到的问题该如何解决问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。


标题名称:编译postgresexporter遇到的问题该如何解决
文章分享:http://hbruida.cn/article/igdshd.html