Skip to content

Commit

Permalink
Fix errcheck and ensure errcheck runs on core
Browse files Browse the repository at this point in the history
Change-Id: I9ad05110b5f69dee896e3d47e24241633d52e596
  • Loading branch information
skriptble committed Apr 19, 2018
1 parent 01bdd07 commit c722234
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .errcheck-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion core/examples/cluster_monitoring/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion core/examples/count/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion core/topology/initial_dns_seedlist_discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion core/topology/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c722234

Please sign in to comment.