diff --git a/.golangci.yml b/.golangci.yml index 044916ff3b..1dfc582fa7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,7 +5,6 @@ linters: disable-all: true # TODO(GODRIVER-2156): Enable all commented-out linters. enable: - - deadcode - errcheck # - errorlint - gocritic @@ -20,12 +19,10 @@ linters: - prealloc - revive - staticcheck - - structcheck - typecheck - unused - unconvert - unparam - - varcheck linters-settings: errcheck: @@ -97,7 +94,6 @@ issues: - path: x/mongo/driver/auth/internal/awsv4 linters: - unused - - structcheck # Disable "unused" linter for code files that depend on the "mongocrypt.MongoCrypt" type because # the linter build doesn't work correctly with CGO enabled. As a result, all calls to a # "mongocrypt.MongoCrypt" API appear to always panic (see mongocrypt_not_enabled.go), leading @@ -115,9 +111,12 @@ issues: # "benchmark" directories. - path: (internal\/|benchmark\/) text: exported (.+) should have comment( \(or a comment on this block\))? or be unexported - # Disable deadcode and unused linter for "golang.org/x/exp/rand" package in internal/randutil/rand. + # Ignore missing package comments for directories that aren't frequently used by external users. + # TODO(GODRIVER-2517): Remove "mongo/testaws" and "mongo/testatlas" from the ignored paths when + # TODO we move those packages to the "cmd/" directory. + - path: (internal\/|benchmark\/|x\/|cmd\/|mongo\/integration\/|mongo\/(testaws\/|testatlas\/)) + text: should have a package comment + # Disable unused linter for "golang.org/x/exp/rand" package in internal/randutil/rand. - path: internal/randutil/rand linters: - - deadcode - unused - - varcheck diff --git a/bson/bsonoptions/doc.go b/bson/bsonoptions/doc.go new file mode 100644 index 0000000000..c40973c8d4 --- /dev/null +++ b/bson/bsonoptions/doc.go @@ -0,0 +1,8 @@ +// Copyright (C) MongoDB, Inc. 2022-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + +// Package bsonoptions defines the optional configurations for the BSON codecs. +package bsonoptions diff --git a/bson/bsonrw/bsonrwtest/bsonrwtest.go b/bson/bsonrw/bsonrwtest/bsonrwtest.go index bbb2570daf..355c4b3bdb 100644 --- a/bson/bsonrw/bsonrwtest/bsonrwtest.go +++ b/bson/bsonrw/bsonrwtest/bsonrwtest.go @@ -4,6 +4,7 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Package bsonrwtest provides utilities for testing the "bson/bsonrw" package. package bsonrwtest // import "go.mongodb.org/mongo-driver/bson/bsonrw/bsonrwtest" import ( diff --git a/mongo/address/addr.go b/mongo/address/addr.go index 5655b3462f..fb6abbcd7c 100644 --- a/mongo/address/addr.go +++ b/mongo/address/addr.go @@ -4,6 +4,7 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Package address provides structured representations of network addresses. package address // import "go.mongodb.org/mongo-driver/mongo/address" import ( diff --git a/mongo/description/description.go b/mongo/description/description.go index 40b1af1361..e750e33b14 100644 --- a/mongo/description/description.go +++ b/mongo/description/description.go @@ -4,6 +4,7 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Package description contains types and functions for describing the state of MongoDB clusters. package description // import "go.mongodb.org/mongo-driver/mongo/description" // Unknown is an unknown server or topology kind. diff --git a/mongo/options/doc.go b/mongo/options/doc.go new file mode 100644 index 0000000000..23ef4c30a6 --- /dev/null +++ b/mongo/options/doc.go @@ -0,0 +1,8 @@ +// Copyright (C) MongoDB, Inc. 2022-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + +// Package options defines the optional configurations for the MongoDB Go Driver. +package options diff --git a/mongo/readconcern/readconcern.go b/mongo/readconcern/readconcern.go index ce235ba8f2..92429007ff 100644 --- a/mongo/readconcern/readconcern.go +++ b/mongo/readconcern/readconcern.go @@ -4,6 +4,7 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Package readconcern defines read concerns for MongoDB operations. package readconcern // import "go.mongodb.org/mongo-driver/mongo/readconcern" import ( diff --git a/mongo/readpref/readpref.go b/mongo/readpref/readpref.go index a3ac0edf89..a07e2f8bc6 100644 --- a/mongo/readpref/readpref.go +++ b/mongo/readpref/readpref.go @@ -4,6 +4,7 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Package readpref defines read preferences for MongoDB queries. package readpref // import "go.mongodb.org/mongo-driver/mongo/readpref" import ( diff --git a/mongo/writeconcern/writeconcern.go b/mongo/writeconcern/writeconcern.go index d5b02f477a..29c667e330 100644 --- a/mongo/writeconcern/writeconcern.go +++ b/mongo/writeconcern/writeconcern.go @@ -4,6 +4,7 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Package writeconcern defines write concerns for MongoDB operations. package writeconcern // import "go.mongodb.org/mongo-driver/mongo/writeconcern" import ( diff --git a/tag/tag.go b/tag/tag.go index 55cf7e31e4..dc45f1e476 100644 --- a/tag/tag.go +++ b/tag/tag.go @@ -4,6 +4,7 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Package tag provides a way to define filters for tagged servers. package tag // import "go.mongodb.org/mongo-driver/tag" import ( diff --git a/version/version.go b/version/version.go index db77ae5851..26e6ba1e8b 100644 --- a/version/version.go +++ b/version/version.go @@ -4,6 +4,7 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Package version defines the Go Driver version. package version // import "go.mongodb.org/mongo-driver/version" // Driver is the current version of the driver.