[GODRIVER-86] Lint source code with errcheck Created: 19/Sep/17  Updated: 28/Oct/23  Resolved: 25/Oct/17

Status: Closed
Project: Go Driver
Component/s: Testing
Affects Version/s: None
Fix Version/s: 0.0.1

Type: Task Priority: Minor - P4
Reporter: David Golden Assignee: Samuel Rossi (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The errcheck program checks for unchecked errors. We should correct such errors and add errcheck to the makefile.

Sample output currently is:

yamgo/internal/servertest/monitor.go:43:16:	m.conn.Close()
yamgo/internal/testconfig/ops.go:40:15:	defer c.Close()
yamgo/internal/testconfig/ops.go:57:15:	defer c.Close()
yamgo/internal/testconfig/ops.go:81:15:	defer c.Close()
yamgo/internal/testconfig/ops.go:121:15:	defer c.Close()
yamgo/internal/testconfig/ops.go:131:15:	defer c.Close()
yamgo/internal/testconfig/ops.go:153:15:	defer c.Close()
yamgo/private/auth/auth.go:50:14:	conn.Close()
yamgo/private/auth/auth.go:57:13:	conn.Close()
yamgo/private/auth/mongodbcr.go:84:16:	io.WriteString(h, nonce)
yamgo/private/auth/mongodbcr.go:85:16:	io.WriteString(h, a.Username)
yamgo/private/auth/mongodbcr.go:86:16:	io.WriteString(h, mongoPasswordDigest(a.Username, a.Password))
yamgo/private/auth/scramsha1.go:183:9:	h.Write(data)
yamgo/private/auth/scramsha1.go:189:16:	io.WriteString(h, key)
yamgo/private/auth/util.go:13:16:	io.WriteString(h, username)
yamgo/private/auth/util.go:14:16:	io.WriteString(h, ":mongo:")
yamgo/private/auth/util.go:15:16:	io.WriteString(h, password)
yamgo/private/conn/conn.go:183:10:	c.Close()
yamgo/private/conn/conn.go:206:10:	c.Close()
yamgo/private/conn/conn.go:267:10:	c.Close()
yamgo/private/conn/pool.go:75:10:	c.Close()
yamgo/private/conn/pool.go:105:22:	c.Connection.Close()
yamgo/private/conn/pool_test.go:36:10:	c3.Close()
yamgo/private/conn/pool_test.go:42:10:	c4.Close()
yamgo/private/conn/pool_test.go:43:10:	c2.Close()
yamgo/private/conn/pool_test.go:52:10:	c6.Close()
yamgo/private/conn/pool_test.go:53:10:	c5.Close()
yamgo/private/conn/pool_test.go:54:10:	c1.Close()
yamgo/private/conn/pool_test.go:80:10:	c1.Close()
yamgo/private/conn/pool_test.go:236:10:	c1.Close()
yamgo/private/conn/pool_test.go:238:10:	c2.Close()
yamgo/private/conn/pool_test.go:240:10:	c3.Close()
yamgo/private/conn/pool_test.go:283:10:	c1.Close()
yamgo/private/conn/pool_test.go:285:10:	c2.Close()
yamgo/private/conn/pool_test.go:329:10:	c1.Close()
yamgo/private/conn/pool_test.go:331:10:	c2.Close()
yamgo/private/conn/protocol.go:98:28:	rawElem.Value.Unmarshal(&errmsg)
yamgo/private/conn/protocol.go:100:28:	rawElem.Value.Unmarshal(&codeName)
yamgo/private/conn/protocol.go:102:28:	rawElem.Value.Unmarshal(&code)
yamgo/private/conn/provider_test.go:23:16:	cappedProvider(context.Background())
yamgo/private/conn/provider_test.go:24:16:	cappedProvider(context.Background())
yamgo/private/conn/provider_test.go:45:16:	cappedProvider(context.Background())
yamgo/private/conn/provider_test.go:49:11:	c1.Close()
yamgo/private/conn/tracked_test.go:25:15:	tracked.Close()
yamgo/private/conn/tracked_test.go:29:15:	tracked.Close()
yamgo/private/ops/cursor.go:134:24:	defer connection.Close()
yamgo/private/ops/cursor.go:202:24:	defer connection.Close()
yamgo/private/ops/helpers_test.go:46:15:	defer c.Close()
yamgo/private/ops/list_databases.go:48:17:	bson.Unmarshal(cursor.databases[cursor.current].Data, result)
yamgo/private/ops/run.go:32:16:	defer c.Close()
yamgo/private/ops/run.go:58:16:	defer c.Close()
yamgo/private/server/monitor.go:206:16:	m.conn.Close()
yamgo/private/server/monitor.go:220:16:	conn.Close()
yamgo/private/server/monitor.go:232:16:	m.conn.Close()
yamgo/private/server/server_test.go:101:10:	c1.Close()
yamgo/private/server/server_test.go:102:10:	c2.Close()
yamgo/private/server/server_test.go:137:10:	c1.Close()
yamgo/private/server/server_test.go:138:10:	c2.Close()
yamgo/private/server/server_test.go:176:10:	c1.Write(context.Background(), &msg.Query{})
yamgo/private/server/server_test.go:177:9:	c1.Read(context.Background(), 0)
yamgo/private/server/server_test.go:180:10:	c1.Close()
yamgo/private/server/server_test.go:181:10:	c2.Close()
yamgo/private/server/server_test.go:238:12:	c1.Write(context.Background(), &msg.Query{})
yamgo/private/server/server_test.go:239:11:	c1.Read(context.Background(), 0)
yamgo/private/server/server_test.go:242:12:	c1.Close()
yamgo/private/server/server_test.go:243:12:	c2.Close()
yamgo/private/server/server_test.go:283:10:	c1.Write(context.Background(), &msg.Query{})
yamgo/private/server/server_test.go:286:10:	c1.Close()
yamgo/private/server/server_test.go:287:10:	c2.Close()
yamgo/private/server/server_test.go:327:12:	c1.Write(context.Background(), &msg.Query{})
yamgo/private/server/server_test.go:330:12:	c1.Close()
yamgo/private/server/server_test.go:331:12:	c2.Close()



 Comments   
Comment by Githook User [ 10/Nov/17 ]

Author:

{'name': 'Saghm Rossi', 'username': 'saghm', 'email': 'saghmrossi@gmail.com'}

Message: GODRIVER-86 Lint source code with errcheck
Branch: GODRIVER-33
https://github.com/10gen/mongo-go-driver/commit/41c8d6f9effda87b5ad3023b56721769c43059b4

Comment by Samuel Rossi (Inactive) [ 25/Oct/17 ]

Git commit: https://github.com/10gen/mongo-go-driver/commit/41c8d6f9effda87b5ad3023b56721769c43059b4

Generated at Thu Feb 08 08:33:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.