diff --git a/.errcheck-excludes b/.errcheck-excludes index 524ce5a3ba..c46637a908 100644 --- a/.errcheck-excludes +++ b/.errcheck-excludes @@ -2,3 +2,6 @@ (github.com/mongodb/mongo-go-driver/core/connection.Connection).Close (*github.com/mongodb/mongo-go-driver/core/topology.Subscription).Unsubscribe (*github.com/mongodb/mongo-go-driver/core/topology.Server).Close +(*github.com/mongodb/mongo-go-driver/core/connection.pool).closeConnection +(net.Conn).Close +encoding/pem.Encode diff --git a/Makefile b/Makefile index 0b91e55f7f..b34d893bf4 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ lint-add-whitelist: .PHONY: errcheck errcheck: - errcheck -exclude .errcheck-excludes ./bson/... ./mongo/... + errcheck -exclude .errcheck-excludes ./bson/... ./mongo/... ./core/... .PHONY: test test: diff --git a/core/examples/cluster_monitoring/main.go b/core/examples/cluster_monitoring/main.go index 2c7df91eaa..35b75d64af 100644 --- a/core/examples/cluster_monitoring/main.go +++ b/core/examples/cluster_monitoring/main.go @@ -19,7 +19,10 @@ func main() { if err != nil { log.Fatalf("could not create topology: %v", err) } - topo.Connect(context.Background()) + err = topo.Connect(context.Background()) + if err != nil { + log.Fatalf("could not create topology: %v", err) + } sub, err := topo.Subscribe() if err != nil { diff --git a/core/examples/count/main.go b/core/examples/count/main.go index 4d17c62a19..698e4bbd20 100644 --- a/core/examples/count/main.go +++ b/core/examples/count/main.go @@ -42,7 +42,10 @@ func main() { if err != nil { log.Fatal(err) } - t.Connect(context.Background()) + err = t.Connect(context.Background()) + if err != nil { + log.Fatal(err) + } ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() diff --git a/core/topology/initial_dns_seedlist_discovery_test.go b/core/topology/initial_dns_seedlist_discovery_test.go index 682f242365..07cdac60bb 100644 --- a/core/topology/initial_dns_seedlist_discovery_test.go +++ b/core/topology/initial_dns_seedlist_discovery_test.go @@ -92,7 +92,8 @@ func runSeedlistTest(t *testing.T, filename string, test *seedlistTestCase) { // make a topology from the options c, err := New(WithConnString(func(connstring.ConnString) connstring.ConnString { return cs })) require.NoError(t, err) - c.Connect(context.Background()) + err = c.Connect(context.Background()) + require.NoError(t, err) for _, host := range test.Hosts { _, err := getServerByAddress(host, c) diff --git a/core/topology/topology.go b/core/topology/topology.go index 871175fb42..d68fd54f2f 100644 --- a/core/topology/topology.go +++ b/core/topology/topology.go @@ -367,7 +367,7 @@ func (t *Topology) apply(ctx context.Context, desc description.Server) (descript } for _, added := range diff.Added { - t.addServer(ctx, added.Addr) + _ = t.addServer(ctx, added.Addr) } t.serversLock.Unlock() return current, nil