Skip to content

Commit

Permalink
build: update nogo config to lint more generated code
Browse files Browse the repository at this point in the history
To date we have used a regex like `cockroach/pkg/.*/.*\\.go` to identify
first-party code, which does find our checked-in code, but does *not*
match generated code, which is not staged at that path in the Bazel
sandbox. Instead, these generated files are generally found in
`bazel-out/.../bin`. In places where we've set `only_files`, in addition
to the original regex, we add another regex to capture these generated
files.

Many packages are now (correctly) being flagged as missing package-level
comments. In these cases I have added a very short package-level
comment.

Closes #102191.

Epic: none
Release note: None
  • Loading branch information
rickystewart committed May 9, 2023
1 parent f614c52 commit 87db8b8
Show file tree
Hide file tree
Showing 41 changed files with 699 additions and 478 deletions.
1,128 changes: 652 additions & 476 deletions build/bazelutil/nogo_config.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pkg/base/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package base exposes basic utilities used across cockroach.
package base

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/ccl/backupccl/backup_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
// https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt

// Package backupccl implements backup logic.
package backupccl

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/ccl/changefeedccl/schemafeed/schema_feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
//
// https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt

// Package schemafeed provides SchemaFeed, which can be used to track schema
// updates.
package schemafeed

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/ccl/sqlproxyccl/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
// https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt

// Package sqlproxyccl implements a server to proxy SQL connections.
package sqlproxyccl

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/col/coldata/vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package coldata exposes utilities for handling columnarized data.
package coldata

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package config contains basic utilities and data definitions for zone
// configuration.
package config

import "github.com/cockroachdb/redact"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvnemesis/kvnemesisutil/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
//

// Package kvnemesisutil provides basic utilities for kvnemesis.
package kvnemesisutil

import "context"
Expand Down
1 change: 1 addition & 0 deletions pkg/kv/kvpb/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package kvpb contains basic utilities for the kv layer.
package kvpb

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/kv/kvserver/closedts/sidetransport/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package sidetransport contains definitions for the sidetransport layer of
// the kvserver.
package sidetransport

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/multitenant/tenantcapabilities/capability.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package tenantcapabilities describes the privileges allotted to tenants.
package tenantcapabilities

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/roachprod/vm/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package aws provides functionality for the aws provider.
package aws

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/spanconfig/spanconfigstore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package spanconfigstore exposes utilities for storing and retrieving
// SpanConfigs associated with a single span.
package spanconfigstore

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/catalog/catalogkeys/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package catalogkeys describes keys used by the SQL catalog.
package catalogkeys

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/catalog/descpb/descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package descpb exposes the "Descriptor" type and related utilities.
package descpb

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/colconv/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package colconv exposes utilities for working with vectorized columns.
package colconv

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/sql/colexec/colexeccmp/default_cmp_expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package colexeccmp exposes some comparison definitions for vectorized
// operations.
package colexeccmp

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/colexec/colexecspan/span_assembler.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package colexecspan implements utilities for manipulating spans.
package colexecspan

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/sql/colfetcher/cfetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package colfetcher implements logic for fetching kv's and forming table rows
// for an arbitrary number of tables.
package colfetcher

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/execinfra/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package execinfra contains the common interfaces for colexec and rowexec.
package execinfra

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/lexbase/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

// This code was derived from https://github.com/youtube/vitess.

// Package lexbase contains utilities for lexing sql.
package lexbase

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/opt/exec/explain/explain_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package explain implements "explaining" for cockroach.
package explain

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/opt/exec/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package exec contains execution-related utilities. (See README.md.)
package exec

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/opt/memo/memo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package memo exposes logic for `Memo`, the central data structure for `opt`.
package memo

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/opt/norm/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package norm implements normalization for queries.
package norm

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/opt/xform/general_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package xform contains logic for transforming SQL queries.
package xform

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/parser/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package parser contains exposes a SQL parser for cockroach.
package parser

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/plpgsql/parser/lexbase/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package lexbase contains utilities for lexing plpgsql.
package lexbase
1 change: 1 addition & 0 deletions pkg/sql/plpgsql/parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package parser exposes a parser for plpgsql.
package parser

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/privilege/privilege.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package privilege outlines the basic privilege system for cockroach.
package privilege

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/schemachange/alter_column_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// schemachange contains utilities describing type conversions.
package schemachange

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/schemachanger/rel/internal/comparetest/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package comparetest exposes a reltest.Suite.
package comparetest

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package cyclegraphtest contains test utilities and a "Suite" for reltest.
package cyclegraphtest

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package entitynodetest exposes a reltest.Suite.
package entitynodetest

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/schemachanger/scop/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package scop describes ops within a schema change.
package scop

// Op represents an action to be taken on a single descriptor.
Expand Down
2 changes: 2 additions & 0 deletions pkg/sql/schemachanger/scplan/internal/scgraph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package scgraph contains utilities for describing a schema change operation
// as a graph of screl nodes.
package scgraph

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/pebbleiter/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
# keep
go_library(
name = "pebbleiter",
srcs = select({
srcs = ["pebbleiter.go"] + select({
"//build/toolchains:crdb_test": [":gen-crdb-test-on"],
"//conditions:default": [":gen-crdb-test-off"],
}),
Expand Down
1 change: 1 addition & 0 deletions pkg/util/buildutil/crdb_test_off.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//go:build !crdb_test || crdb_test_off
// +build !crdb_test crdb_test_off

// Package buildutil provides a constant CrdbTestBuild.
package buildutil

// CrdbTestBuild is a flag that is set to true if the binary was compiled
Expand Down
1 change: 1 addition & 0 deletions pkg/util/buildutil/crdb_test_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//go:build crdb_test && !crdb_test_off
// +build crdb_test,!crdb_test_off

// Package buildutil provides a constant CrdbTestBuild.
package buildutil

// CrdbTestBuild is a flag that is set to true if the binary was compiled
Expand Down
1 change: 1 addition & 0 deletions pkg/util/encoding/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package encoding exposes some utilities for encoding data as bytes.
package encoding

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/workload/schemachange/schemachange.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package schemachange implements the schemachange workload.
package schemachange

import (
Expand Down

0 comments on commit 87db8b8

Please sign in to comment.