首先,我想說謝謝你閱讀我的主題。我是 Golang 的新手,很高興收到您的幫助。我正在將 golang 用于php-fpm-exporter (https://github.com/hipages/php-fpm_exporter)我的環境go envGO111MODULE=""GOARCH="amd64"GOBIN=""GOCACHE="/home/toandp99/.cache/go-build"GOENV="/home/toandp99/.config/go/env"GOEXE=""GOFLAGS=""GOHOSTARCH="amd64"GOHOSTOS="linux"GOINSECURE=""GONOPROXY=""GONOSUMDB=""GOOS="linux"GOPATH="/home/toandp99/go"GOPRIVATE=""GOPROXY="https://proxy.golang.org,direct"GOROOT="/home/toandp99/local/go"GOSUMDB="sum.golang.org"GOTMPDIR=""GOTOOLDIR="/home/toandp99/local/go/pkg/tool/linux_amd64"GCCGO="gccgo"AR="ar"CC="gcc"CXX="g++"CGO_ENABLED="1"GOMOD=""CGO_CFLAGS="-g -O2"CGO_CPPFLAGS=""CGO_CXXFLAGS="-g -O2"CGO_FFLAGS="-g -O2"CGO_LDFLAGS="-g -O2"PKG_CONFIG="pkg-config"GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build100112555=/tmp/go-build -gno-record-gcc-switches"當我嘗試php-fpm-exportertoandp99@toandp99-x555uj:~/php-fpm_exporter$ lscmd Dockerfile LICENSE phpfpm README.mdCODE_OF_CONDUCT.md go.mod main.go PHP-FPM.pid sonar-project.propertiesconfig.sh go.sum Makefile PHP-FPM.sh testtoandp99@toandp99-x555uj:~/php-fpm_exporter$ ./PHP-FPM.sh startStarting Monitoring FastCGI Process Manager...go: downloading github.com/spf13/cobra v0.0.7go: downloading github.com/speps/go-hashids v2.0.0+incompatiblego: downloading github.com/davecgh/go-spew v1.1.1go: downloading github.com/gosuri/uitable v0.0.4go: downloading github.com/tomasen/fcgi_client v0.0.0-20180423082037-2bb3d819fd19go: downloading github.com/fatih/color v1.9.0go: downloading github.com/mattn/go-isatty v0.0.12go: downloading golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527go: downloading github.com/spf13/pflag v1.0.5go: downloading github.com/mattn/go-colorable v0.1.6go: downloading github.com/prometheus/client_golang v1.5.1go: downloading github.com/mattn/go-runewidth v0.0.8
“運行”時出現錯誤“包...不在 GOROOT 中”
慕的地6264312
2022-07-25 12:03:46