hsanjuan/ipfs-lite

panic: duplicate metrics collector registration attempted

Closed this issue · 1 comments

mg98 commented
package main

import (
	ipfslite "github.com/hsanjuan/ipfs-lite"
)

var ipfsNode *ipfslite.Peer

func main() {}

for me crashes with

panic: duplicate metrics collector registration attempted

goroutine 1 [running]:
github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(0x4b00469?, {0xc000796b60?, 0x1, 0x12?})
        /Users/marcel/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/registry.go:403 +0x7f
github.com/prometheus/client_golang/prometheus.MustRegister(...)
        /Users/marcel/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/registry.go:178
github.com/libp2p/go-tcp-transport.init.0()
        /Users/marcel/go/pkg/mod/github.com/libp2p/go-tcp-transport@v0.5.1/metrics.go:37 +0x1b3
exit status 2

go version

go version go1.18.1 darwin/amd64

go.mod

go 1.18
require github.com/hsanjuan/ipfs-lite v1.4.0

Also tested with v1.3.0. It's weird cause the library used to work with me. Paused the work on my project for ~2 weeks and can't get it started now. But I also isolated the issue fairly much so I don't know what is going on :/ Any idea?

I cannot reproduce. Hopefully it is fixed now! Sorry I missed this.