Skip to content

Commit

Permalink
Fix new lint failures and drop deprecated linters. (#1055)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdale authored and benjirewis committed Sep 6, 2022
1 parent 0618fdf commit 688e74b
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .golangci.yml
Expand Up @@ -5,7 +5,6 @@ linters:
disable-all: true
# TODO(GODRIVER-2156): Enable all commented-out linters.
enable:
- deadcode
- errcheck
# - errorlint
- gocritic
Expand All @@ -20,12 +19,10 @@ linters:
- prealloc
- revive
- staticcheck
- structcheck
- typecheck
- unused
- unconvert
- unparam
- varcheck

linters-settings:
errcheck:
Expand Down Expand Up @@ -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
Expand All @@ -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
8 changes: 8 additions & 0 deletions 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
1 change: 1 addition & 0 deletions bson/bsonrw/bsonrwtest/bsonrwtest.go
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions mongo/address/addr.go
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions mongo/description/description.go
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions 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
1 change: 1 addition & 0 deletions mongo/readconcern/readconcern.go
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions mongo/readpref/readpref.go
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions mongo/writeconcern/writeconcern.go
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions tag/tag.go
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions version/version.go
Expand Up @@ -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.
Expand Down

0 comments on commit 688e74b

Please sign in to comment.