sets.String is deprecated: use generic Set instead. new ways: s1 := Set[string]{} s2 := New[string]() (#9589)

Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
This commit is contained in:
Fish-pro 2023-02-16 22:05:48 +08:00 committed by GitHub
parent 1cdd61fb94
commit ac8dd3dd53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 18 deletions

View file

@ -80,7 +80,7 @@ type SocketCollector struct {
metricMapping map[string]interface{}
hosts sets.String
hosts sets.Set[string]
metricsPerHost bool
reportStatusClasses bool
@ -505,7 +505,7 @@ func (sc SocketCollector) Collect(ch chan<- prometheus.Metric) {
// SetHosts sets the hostnames that are being served by the ingress controller
// This set of hostnames is used to filter the metrics to be exposed
func (sc *SocketCollector) SetHosts(hosts sets.String) {
func (sc *SocketCollector) SetHosts(hosts sets.Set[string]) {
sc.hosts = hosts
}

View file

@ -485,7 +485,7 @@ func TestCollector(t *testing.T) {
t.Errorf("registering collector failed: %s", err)
}
sc.SetHosts(sets.NewString("testshop.com"))
sc.SetHosts(sets.New[string]("testshop.com"))
for _, d := range c.data {
sc.handleMessage([]byte(d))