返回

普罗米修斯-错过围棋。为promhttp提供包的模块的总和条目

发布时间:2022-04-26 09:51:58 210
# golang# 服务器# git# 服务器# 软件

新来的,不理解为什么构建总是失败。

主要的开始:

package main

import (
    "log"
    "net/http"

    "github.com/prometheus/client_golang/prometheus/promhttp"
)

func main() {
   
    http.Handle("/metrics", promhttp.Handler())

    log.Fatal(http.ListenAndServe(":80", nil))
}

去国防部:

module github.com/t3ster897/go-service

go 1.18

require github.com/prometheus/client_golang v1.12.0

require (
    github.com/beorn7/perks v1.0.1 // indirect
    github.com/cespare/xxhash/v2 v2.1.2 // indirect
    github.com/golang/protobuf v1.5.2 // indirect
    github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
    github.com/prometheus/client_model v0.2.0 // indirect
    github.com/prometheus/common v0.32.1 // indirect
    github.com/prometheus/procfs v0.7.3 // indirect
    golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
    google.golang.org/protobuf v1.26.0 // indirect
)

去总数:

github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg=
github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=

以上是我的应用程序代码和模块文件。校验和文件确实包括普罗米修斯软件包。但我的构建失败,出现以下错误:

 > [6/6] RUN go build -o /go-service:
#10 0.247 main.go:9:2: missing go.sum entry for module providing package github.com/prometheus/client_golang/prometheus/promhttp (imported by github.com/v1jayr/simple-go-service); to add:
#10 0.247   go get github.com/t3ster897/go-service

为什么构建失败了。sum文件,包括客户_golang的条目

编辑:我已经跑了go mod tidygo get github.com/prometheus/client_golang/prometheus/promhttp,go get github.com/prometheus/client_golang.还是一样的错误。

更新:当我构建pkg或运行main时。直接去吧,工作正常,服务器启动正常。看起来只有在构建docker映像时才会发生错误。

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像