Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthik Nayak <knayak@gitlab.com>2022-09-30 10:29:07 +0300
committerKarthik Nayak <knayak@gitlab.com>2022-09-30 14:38:41 +0300
commite6352b36bf6d9368a527f44d17e808d6444d785e (patch)
tree652d651e47dc87a4968c47e422ef7616745aa145
parent4325323c8f34ae2e0de8aca0a710a228e742ac9a (diff)
lint: Run `make lint-fix` on the repolint-fixes
Now that we have a `lint-fix` command, run it on the entire repository. This commit is untouched apart from running `make lint-fix` followed by `gofmt -l -s -w .`.
-rw-r--r--client/dial_test.go1
-rw-r--r--client/pool_options.go1
-rw-r--r--cmd/praefect/main.go22
-rw-r--r--internal/backchannel/backchannel.go18
-rw-r--r--internal/backup/locator.go18
-rw-r--r--internal/bootstrap/bootstrap.go26
-rw-r--r--internal/cgroups/noop.go3
-rw-r--r--internal/cgroups/v1_linux.go2
-rw-r--r--internal/command/stats.go6
-rw-r--r--internal/git/gitpipe/ls_tree.go6
-rw-r--r--internal/git/gittest/repo.go8
-rw-r--r--internal/git/stats/git.go29
-rw-r--r--internal/git/stats/packfile_negotiation.go2
-rw-r--r--internal/git/trailerparser/trailerparser.go14
-rw-r--r--internal/gitaly/config/config.go1
-rw-r--r--internal/gitaly/hook/check.go1
-rw-r--r--internal/gitaly/hook/postreceive.go1
-rw-r--r--internal/gitaly/hook/referencetransaction.go1
-rw-r--r--internal/gitaly/hook/update.go1
-rw-r--r--internal/gitaly/service/operations/apply_patch.go1
-rw-r--r--internal/gitaly/service/operations/branches.go2
-rw-r--r--internal/gitaly/service/operations/cherry_pick.go1
-rw-r--r--internal/gitaly/service/operations/merge.go2
-rw-r--r--internal/gitaly/service/operations/rebase.go1
-rw-r--r--internal/gitaly/service/operations/revert.go1
-rw-r--r--internal/gitaly/service/operations/server.go1
-rw-r--r--internal/gitaly/service/operations/submodules.go1
-rw-r--r--internal/gitaly/service/operations/tags.go2
-rw-r--r--internal/gitaly/service/smarthttp/server.go1
-rw-r--r--internal/gitaly/service/ssh/server.go1
-rw-r--r--internal/gitaly/storage/locator.go1
-rw-r--r--internal/gitlab/http_client_test.go1
-rw-r--r--internal/helper/security.go3
-rw-r--r--internal/helper/ticker.go4
-rw-r--r--internal/log/log_test.go5
-rw-r--r--internal/logsanitizer/url.go3
-rw-r--r--internal/metadata/featureflag/context_test.go5
-rw-r--r--internal/praefect/config/config.go1
-rw-r--r--internal/praefect/config/node.go1
-rw-r--r--internal/praefect/coordinator.go22
-rw-r--r--internal/praefect/datastore/assignment.go1
-rw-r--r--internal/praefect/datastore/collector.go3
-rw-r--r--internal/praefect/datastore/mock.go1
-rw-r--r--internal/praefect/datastore/queue.go11
-rw-r--r--internal/praefect/datastore/repository_store.go7
-rw-r--r--internal/praefect/datastore/repository_store_mock.go8
-rw-r--r--internal/praefect/grpc-proxy/proxy/director.go2
-rw-r--r--internal/praefect/grpc-proxy/proxy/handler.go9
-rw-r--r--internal/praefect/health_checker.go1
-rw-r--r--internal/praefect/metrics/prometheus.go3
-rw-r--r--internal/praefect/nodes/health_manager.go14
-rw-r--r--internal/praefect/nodes/manager.go4
-rw-r--r--internal/praefect/nodes/mock.go6
-rw-r--r--internal/praefect/nodes/ping.go3
-rw-r--r--internal/praefect/nodes/sql_elector.go19
-rw-r--r--internal/praefect/protoregistry/protoregistry.go1
-rw-r--r--internal/praefect/reconciler/reconciler.go18
-rw-r--r--internal/praefect/replicator.go2
-rw-r--r--internal/praefect/router_per_repository.go2
-rw-r--r--internal/praefect/server.go6
-rw-r--r--internal/praefect/service/info/dataloss.go1
-rw-r--r--internal/praefect/service/info/replication_factor.go1
-rw-r--r--internal/praefect/service/info/server.go1
-rw-r--r--internal/praefect/service/transaction/server.go2
-rw-r--r--internal/praefect/transactions/manager.go3
-rw-r--r--internal/streamcache/cache.go2
-rw-r--r--internal/testhelper/gitlabtest.go6
-rw-r--r--internal/testhelper/promtest/counter.go4
-rw-r--r--internal/testhelper/testdb/db.go8
-rw-r--r--packed_binaries.go4
-rw-r--r--streamio/stream.go1
-rw-r--r--tools/protoc-gen-gitaly-lint/lint.go6
-rw-r--r--tools/protoc-gen-gitaly-lint/main.go18
-rw-r--r--tools/protoc-gen-gitaly-lint/method.go4
-rw-r--r--tools/protoc-gen-gitaly-protolist/main.go2
75 files changed, 165 insertions, 240 deletions
diff --git a/client/dial_test.go b/client/dial_test.go
index e0870ee32..70858b6ef 100644
--- a/client/dial_test.go
+++ b/client/dial_test.go
@@ -566,6 +566,7 @@ func startUnixListener(tb testing.TB, factory func(credentials.TransportCredenti
}
// startTLSListener will start a secure TLS listener on a random unused port
+//
//go:generate openssl req -newkey rsa:4096 -new -nodes -x509 -days 3650 -out testdata/gitalycert.pem -keyout testdata/gitalykey.pem -subj "/C=US/ST=California/L=San Francisco/O=GitLab/OU=GitLab-Shell/CN=localhost" -addext "subjectAltName = IP:127.0.0.1, DNS:localhost"
func startTLSListener(tb testing.TB, factory func(credentials.TransportCredentials) *grpc.Server) (func(), string) {
listener, err := net.Listen("tcp", "localhost:0")
diff --git a/client/pool_options.go b/client/pool_options.go
index dc38132c1..facd08bf0 100644
--- a/client/pool_options.go
+++ b/client/pool_options.go
@@ -7,7 +7,6 @@ type poolOptions struct {
dialOptions []grpc.DialOption
}
-//nolint:stylecheck // This is unintentionally missing documentation.
type PoolOption func(*poolOptions)
func applyPoolOptions(options []PoolOption) *poolOptions {
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go
index 76cb2071b..078db25df 100644
--- a/cmd/praefect/main.go
+++ b/cmd/praefect/main.go
@@ -3,18 +3,18 @@
//
// Additionally, praefect has subcommands for common tasks:
//
-// SQL Ping
+// # SQL Ping
//
// The subcommand "sql-ping" checks if the database configured in the config
// file is reachable:
//
-// praefect -config PATH_TO_CONFIG sql-ping
+// praefect -config PATH_TO_CONFIG sql-ping
//
-// SQL Migrate
+// # SQL Migrate
//
// The subcommand "sql-migrate" will apply any outstanding SQL migrations.
//
-// praefect -config PATH_TO_CONFIG sql-migrate [-ignore-unknown=true|false]
+// praefect -config PATH_TO_CONFIG sql-migrate [-ignore-unknown=true|false]
//
// By default, the migration will ignore any unknown migrations that are
// not known by the Praefect binary.
@@ -24,36 +24,36 @@
// The subcommand "sql-migrate-status" will show which SQL migrations have
// been applied and which ones have not:
//
-// praefect -config PATH_TO_CONFIG sql-migrate-status
+// praefect -config PATH_TO_CONFIG sql-migrate-status
//
-// Dial Nodes
+// # Dial Nodes
//
// The subcommand "dial-nodes" helps diagnose connection problems to Gitaly or
// Praefect. The subcommand works by sourcing the connection information from
// the config file, and then dialing and health checking the remote nodes.
//
-// praefect -config PATH_TO_CONFIG dial-nodes
+// praefect -config PATH_TO_CONFIG dial-nodes
//
-// Dataloss
+// # Dataloss
//
// The subcommand "dataloss" identifies Gitaly nodes which are missing data from the
// previous write-enabled primary node. It does so by looking through incomplete
// replication jobs. This is useful for identifying potential data loss from a failover
// event.
//
-// praefect -config PATH_TO_CONFIG dataloss [-virtual-storage <virtual-storage>]
+// praefect -config PATH_TO_CONFIG dataloss [-virtual-storage <virtual-storage>]
//
// "-virtual-storage" specifies which virtual storage to check for data loss. If not specified,
// the check is performed for every configured virtual storage.
//
-// Accept Dataloss
+// # Accept Dataloss
//
// The subcommand "accept-dataloss" allows for accepting data loss in a repository to enable it for
// writing again. The current version of the repository on the authoritative storage is set to be
// the latest version and replications to other nodes are scheduled in order to bring them consistent
// with the new authoritative version.
//
-// praefect -config PATH_TO_CONFIG accept-dataloss -virtual-storage <virtual-storage> -relative-path <relative-path> -authoritative-storage <authoritative-storage>
+// praefect -config PATH_TO_CONFIG accept-dataloss -virtual-storage <virtual-storage> -relative-path <relative-path> -authoritative-storage <authoritative-storage>
package main
import (
diff --git a/internal/backchannel/backchannel.go b/internal/backchannel/backchannel.go
index e32494f63..a7da22f15 100644
--- a/internal/backchannel/backchannel.go
+++ b/internal/backchannel/backchannel.go
@@ -17,15 +17,15 @@
// The server side uses listenmux to support clients that are unaware of the multiplexing.
//
// Usage:
-// 1. Implement a ServerFactory, which is simply a function that returns a Server that can serve on the backchannel
-// connection. Plug in the ClientHandshake to the Clientconn via grpc.WithTransportCredentials when dialing.
-// This ensures all connections established by gRPC work with a multiplexing session and have a backchannel Server serving.
-// 2. Create a *listenmux.Mux and register a *ServerHandshaker with it.
-// 3. Pass the *listenmux.Mux into the grpc Server using grpc.Creds.
-// The Handshake method is called on each newly established connection that presents the backchannel magic bytes. It dials back to the client's backchannel server. Server
-// makes the backchannel connection's available later via the Registry's Backchannel method. The ID of the
-// peer associated with the current RPC handler can be fetched via GetPeerID. The returned ID can be used
-// to access the correct backchannel connection from the Registry.
+// 1. Implement a ServerFactory, which is simply a function that returns a Server that can serve on the backchannel
+// connection. Plug in the ClientHandshake to the Clientconn via grpc.WithTransportCredentials when dialing.
+// This ensures all connections established by gRPC work with a multiplexing session and have a backchannel Server serving.
+// 2. Create a *listenmux.Mux and register a *ServerHandshaker with it.
+// 3. Pass the *listenmux.Mux into the grpc Server using grpc.Creds.
+// The Handshake method is called on each newly established connection that presents the backchannel magic bytes. It dials back to the client's backchannel server. Server
+// makes the backchannel connection's available later via the Registry's Backchannel method. The ID of the
+// peer associated with the current RPC handler can be fetched via GetPeerID. The returned ID can be used
+// to access the correct backchannel connection from the Registry.
package backchannel
import (
diff --git a/internal/backup/locator.go b/internal/backup/locator.go
index 1cedd5913..ed9d6cc72 100644
--- a/internal/backup/locator.go
+++ b/internal/backup/locator.go
@@ -20,9 +20,10 @@ import (
// files.
//
// Structure:
-// <repo relative path>.bundle
-// <repo relative path>.refs
-// <repo relative path>/custom_hooks.tar
+//
+// <repo relative path>.bundle
+// <repo relative path>.refs
+// <repo relative path>/custom_hooks.tar
type LegacyLocator struct{}
// BeginFull returns the static paths for a legacy repository backup
@@ -65,11 +66,12 @@ func (l LegacyLocator) newFull(repo *gitalypb.Repository) *Step {
// file named LATEST.
//
// Structure:
-// <repo relative path>/LATEST
-// <repo relative path>/<backup id>/LATEST
-// <repo relative path>/<backup id>/<nnn>.bundle
-// <repo relative path>/<backup id>/<nnn>.refs
-// <repo relative path>/<backup id>/<nnn>.custom_hooks.tar
+//
+// <repo relative path>/LATEST
+// <repo relative path>/<backup id>/LATEST
+// <repo relative path>/<backup id>/<nnn>.bundle
+// <repo relative path>/<backup id>/<nnn>.refs
+// <repo relative path>/<backup id>/<nnn>.custom_hooks.tar
type PointerLocator struct {
Sink Sink
Fallback Locator
diff --git a/internal/bootstrap/bootstrap.go b/internal/bootstrap/bootstrap.go
index 23b39ff66..a0251fee0 100644
--- a/internal/bootstrap/bootstrap.go
+++ b/internal/bootstrap/bootstrap.go
@@ -51,8 +51,9 @@ type upgrader interface {
}
// New performs tableflip initialization
-// pidFile is optional, if provided it will always contain the current process PID
-// upgradesEnabled controls the upgrade process on SIGHUP signal
+//
+// pidFile is optional, if provided it will always contain the current process PID
+// upgradesEnabled controls the upgrade process on SIGHUP signal
//
// first boot:
// * gitaly starts as usual, we will refer to it as p1
@@ -63,16 +64,17 @@ type upgrader interface {
// * upg.Exit() channel will be closed when an upgrades completed successfully and the process must terminate
//
// graceful upgrade:
-// * user replaces gitaly binary and/or config file
-// * user sends SIGHUP to p1
-// * p1 will fork and exec the new gitaly, we will refer to it as p2
-// * from now on p1 will ignore other SIGHUP
-// * if p2 terminates with a non-zero exit code, SIGHUP handling will be restored
-// * p2 will follow the "first boot" sequence but upg.Fds will provide sockets and files from p1, when available
-// * when p2 invokes upg.Ready() all the shared file descriptors not claimed by p2 will be closed
-// * upg.Exit() channel in p1 will be closed now and p1 can gracefully terminate already accepted connections
-// * upgrades cannot starts again if p1 and p2 are both running, an hard termination should be scheduled to overcome
-// freezes during a graceful shutdown
+// - user replaces gitaly binary and/or config file
+// - user sends SIGHUP to p1
+// - p1 will fork and exec the new gitaly, we will refer to it as p2
+// - from now on p1 will ignore other SIGHUP
+// - if p2 terminates with a non-zero exit code, SIGHUP handling will be restored
+// - p2 will follow the "first boot" sequence but upg.Fds will provide sockets and files from p1, when available
+// - when p2 invokes upg.Ready() all the shared file descriptors not claimed by p2 will be closed
+// - upg.Exit() channel in p1 will be closed now and p1 can gracefully terminate already accepted connections
+// - upgrades cannot starts again if p1 and p2 are both running, an hard termination should be scheduled to overcome
+// freezes during a graceful shutdown
+//
// gitaly-wrapper is supposed to set EnvUpgradesEnabled in order to enable graceful upgrades
func New(totalConn *prometheus.CounterVec) (*Bootstrap, error) {
pidFile := os.Getenv(EnvPidFile)
diff --git a/internal/cgroups/noop.go b/internal/cgroups/noop.go
index 92839514f..28c1de44a 100644
--- a/internal/cgroups/noop.go
+++ b/internal/cgroups/noop.go
@@ -9,17 +9,14 @@ import (
// NoopManager is a cgroups manager that does nothing
type NoopManager struct{}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (cg *NoopManager) Setup() error {
return nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (cg *NoopManager) AddCommand(cmd *command.Command, repo repository.GitRepo) (string, error) {
return "", nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (cg *NoopManager) Cleanup() error {
return nil
}
diff --git a/internal/cgroups/v1_linux.go b/internal/cgroups/v1_linux.go
index 3ab99f411..87c95902f 100644
--- a/internal/cgroups/v1_linux.go
+++ b/internal/cgroups/v1_linux.go
@@ -56,7 +56,6 @@ func newV1Manager(cfg cgroupscfg.Config, pid int) *CGroupV1Manager {
}
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (cg *CGroupV1Manager) Setup() error {
var parentResources specs.LinuxResources
@@ -200,7 +199,6 @@ func (cg *CGroupV1Manager) Describe(ch chan<- *prometheus.Desc) {
prometheus.DescribeByCollect(cg, ch)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (cg *CGroupV1Manager) Cleanup() error {
processCgroupPath := cg.currentProcessCgroup()
diff --git a/internal/command/stats.go b/internal/command/stats.go
index d1d8c9ed2..89b926209 100644
--- a/internal/command/stats.go
+++ b/internal/command/stats.go
@@ -9,13 +9,11 @@ import (
type requestStatsKey struct{}
-//nolint:stylecheck // This is unintentionally missing documentation.
type Stats struct {
registry map[string]int
sync.Mutex
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (stats *Stats) RecordSum(key string, value int) {
stats.Lock()
defer stats.Unlock()
@@ -27,7 +25,6 @@ func (stats *Stats) RecordSum(key string, value int) {
stats.registry[key] = value
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (stats *Stats) RecordMax(key string, value int) {
stats.Lock()
defer stats.Unlock()
@@ -41,7 +38,6 @@ func (stats *Stats) RecordMax(key string, value int) {
stats.registry[key] = value
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (stats *Stats) Fields() logrus.Fields {
stats.Lock()
defer stats.Unlock()
@@ -53,13 +49,11 @@ func (stats *Stats) Fields() logrus.Fields {
return f
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func StatsFromContext(ctx context.Context) *Stats {
stats, _ := ctx.Value(requestStatsKey{}).(*Stats)
return stats
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func InitContextStats(ctx context.Context) context.Context {
return context.WithValue(ctx, requestStatsKey{}, &Stats{
registry: make(map[string]int),
diff --git a/internal/git/gitpipe/ls_tree.go b/internal/git/gitpipe/ls_tree.go
index 3c21c1eb0..70c9374fc 100644
--- a/internal/git/gitpipe/ls_tree.go
+++ b/internal/git/gitpipe/ls_tree.go
@@ -38,9 +38,9 @@ func LsTreeWithBlobFilter() LsTreeOption {
// LsTree runs git-ls-tree(1) for the given revisions. The returned channel will
// contain all object IDs listed by this command. This might include:
-// - Blobs
-// - Trees, unless you're calling it with LsTreeWithRecursive()
-// - Submodules, referring to the commit of the submodule
+// - Blobs
+// - Trees, unless you're calling it with LsTreeWithRecursive()
+// - Submodules, referring to the commit of the submodule
func LsTree(
ctx context.Context,
repo *localrepo.Repo,
diff --git a/internal/git/gittest/repo.go b/internal/git/gittest/repo.go
index 0086fcad0..6022f1e6b 100644
--- a/internal/git/gittest/repo.go
+++ b/internal/git/gittest/repo.go
@@ -335,7 +335,7 @@ func AddWorktree(tb testing.TB, cfg config.Cfg, repoPath string, worktreeName st
// date causes commit-graphs to become corrupt with the following error that's likely caused by
// an overflow:
//
-// commit date for commit ba3343bc4fa403a8dfbfcab7fc1a8c29ee34bd69 in commit-graph is 15668040695 != 9223372036854775
+// commit date for commit ba3343bc4fa403a8dfbfcab7fc1a8c29ee34bd69 in commit-graph is 15668040695 != 9223372036854775
//
// This is not a new error, but something that has existed for quite a while already in Git. And
// while the bug can also be easily hit in Gitaly because we do write commit-graphs in pool
@@ -355,9 +355,9 @@ func AddWorktree(tb testing.TB, cfg config.Cfg, repoPath string, worktreeName st
//
// You can easily test whether this bug still exists via the following commands:
//
-// $ git clone _build/testrepos/gitlab-test.git
-// $ git -C gitlab-test commit-graph write
-// $ git -C gitlab-test commit-graph verify
+// $ git clone _build/testrepos/gitlab-test.git
+// $ git -C gitlab-test commit-graph write
+// $ git -C gitlab-test commit-graph verify
func FixGitLabTestRepoForCommitGraphs(tb testing.TB, cfg config.Cfg, repoPath string) {
Exec(tb, cfg, "-C", repoPath, "update-ref", "-d", "refs/heads/spooky-stuff", "ba3343bc4fa403a8dfbfcab7fc1a8c29ee34bd69")
}
diff --git a/internal/git/stats/git.go b/internal/git/stats/git.go
index 5ec5dace0..ce9794c72 100644
--- a/internal/git/stats/git.go
+++ b/internal/git/stats/git.go
@@ -40,20 +40,25 @@ func LogObjectsInfo(ctx context.Context, repo git.RepositoryExecutor) {
}
}
-/* readObjectInfoStatistic parses output of 'git count-objects -v' command and represents it as dictionary
+/*
+ readObjectInfoStatistic parses output of 'git count-objects -v' command and represents it as dictionary
+
current supported format is:
- count: 12
- packs: 2
- size-garbage: 934
- alternate: /some/path/to/.git/objects
- alternate: "/some/other path/to/.git/objects"
+
+ count: 12
+ packs: 2
+ size-garbage: 934
+ alternate: /some/path/to/.git/objects
+ alternate: "/some/other path/to/.git/objects"
+
will result in:
- {
- "count": 12,
- "packs": 2,
- "size-garbage": 934,
- "alternate": ["/some/path/to/.git/objects", "/some/other path/to/.git/objects"]
- }
+
+ {
+ "count": 12,
+ "packs": 2,
+ "size-garbage": 934,
+ "alternate": ["/some/path/to/.git/objects", "/some/other path/to/.git/objects"]
+ }
*/
func readObjectInfoStatistic(reader io.Reader) (map[string]interface{}, error) {
stats := map[string]interface{}{}
diff --git a/internal/git/stats/packfile_negotiation.go b/internal/git/stats/packfile_negotiation.go
index f043507ee..1e3cf2949 100644
--- a/internal/git/stats/packfile_negotiation.go
+++ b/internal/git/stats/packfile_negotiation.go
@@ -11,7 +11,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/internal/helper/text"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
type PackfileNegotiation struct {
// Total size of all pktlines' data
PayloadSize int64
@@ -31,7 +30,6 @@ type PackfileNegotiation struct {
Filter string
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func ParsePackfileNegotiation(body io.Reader) (PackfileNegotiation, error) {
n := PackfileNegotiation{}
return n, n.Parse(body)
diff --git a/internal/git/trailerparser/trailerparser.go b/internal/git/trailerparser/trailerparser.go
index 64e97cf96..ab1d115be 100644
--- a/internal/git/trailerparser/trailerparser.go
+++ b/internal/git/trailerparser/trailerparser.go
@@ -28,7 +28,7 @@ const (
// The expected input is a single line containing trailers in the following
// format:
//
-// KEY:VALUE\0KEY:VALUE
+// KEY:VALUE\0KEY:VALUE
//
// Where \0 is a NULL byte. The input should not end in a NULL byte.
//
@@ -47,12 +47,12 @@ const (
// The limits this parser imposes on the sizes/amounts are loosely based on
// trailers found in GitLab's own repository. Here are just a few examples:
//
-// Change-Id: I009c716ce2475b9efa3fd07aee9215fca7a1c150
-// Changelog: https://github.com/nahi/httpclient/blob/b51d7a8bb78f71726b08fbda5abfb900d627569f/CHANGELOG.md#changes-in-282
-// Co-Authored-By: Alex Kalderimis <akalderimis@gitlab.com>
-// fixes: https://gitlab.com/gitlab-org/gitlab-ce/issues/44458
-// Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-// See: https://gitlab.com/gitlab-org/gitlab-ee/blob/ff9ad690650c23665439499d23f3ed22103b55bb/spec/spec_helper.rb#L50
+// Change-Id: I009c716ce2475b9efa3fd07aee9215fca7a1c150
+// Changelog: https://github.com/nahi/httpclient/blob/b51d7a8bb78f71726b08fbda5abfb900d627569f/CHANGELOG.md#changes-in-282
+// Co-Authored-By: Alex Kalderimis <akalderimis@gitlab.com>
+// fixes: https://gitlab.com/gitlab-org/gitlab-ce/issues/44458
+// Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
+// See: https://gitlab.com/gitlab-org/gitlab-ee/blob/ff9ad690650c23665439499d23f3ed22103b55bb/spec/spec_helper.rb#L50
func Parse(input []byte) []*gitalypb.CommitTrailer {
// The choice of a nil slice instead of an empty one is deliberate: gRPC
// turns empty slices into nil.
diff --git a/internal/gitaly/config/config.go b/internal/gitaly/config/config.go
index 9c5510bb9..6ee204687 100644
--- a/internal/gitaly/config/config.go
+++ b/internal/gitaly/config/config.go
@@ -92,7 +92,6 @@ type Hooks struct {
CustomHooksDir string `toml:"custom_hooks_dir" json:"custom_hooks_dir"`
}
-//nolint:stylecheck // This is unintentionally missing documentation.
type HTTPSettings struct {
ReadTimeout int `toml:"read_timeout" json:"read_timeout"`
User string `toml:"user" json:"user"`
diff --git a/internal/gitaly/hook/check.go b/internal/gitaly/hook/check.go
index cb71aecc6..4fb5873d4 100644
--- a/internal/gitaly/hook/check.go
+++ b/internal/gitaly/hook/check.go
@@ -6,7 +6,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/internal/gitlab"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *GitLabHookManager) Check(ctx context.Context) (*gitlab.CheckInfo, error) {
return m.gitlabClient.Check(ctx)
}
diff --git a/internal/gitaly/hook/postreceive.go b/internal/gitaly/hook/postreceive.go
index cbe26ed4b..510a880d0 100644
--- a/internal/gitaly/hook/postreceive.go
+++ b/internal/gitaly/hook/postreceive.go
@@ -116,7 +116,6 @@ func printAlert(m gitlab.PostReceiveMessage, w io.Writer) error {
return nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *GitLabHookManager) PostReceiveHook(ctx context.Context, repo *gitalypb.Repository, pushOptions, env []string, stdin io.Reader, stdout, stderr io.Writer) error {
payload, err := git.HooksPayloadFromEnv(env)
if err != nil {
diff --git a/internal/gitaly/hook/referencetransaction.go b/internal/gitaly/hook/referencetransaction.go
index 711975647..9f5fa6444 100644
--- a/internal/gitaly/hook/referencetransaction.go
+++ b/internal/gitaly/hook/referencetransaction.go
@@ -16,7 +16,6 @@ import (
// reference without checking its current value.
var forceDeletionPrefix = fmt.Sprintf("%[1]s %[1]s ", git.ObjectHashSHA1.ZeroOID.String())
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *GitLabHookManager) ReferenceTransactionHook(ctx context.Context, state ReferenceTransactionState, env []string, stdin io.Reader) error {
payload, err := git.HooksPayloadFromEnv(env)
if err != nil {
diff --git a/internal/gitaly/hook/update.go b/internal/gitaly/hook/update.go
index d420eb483..3d73a0acd 100644
--- a/internal/gitaly/hook/update.go
+++ b/internal/gitaly/hook/update.go
@@ -11,7 +11,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *GitLabHookManager) UpdateHook(ctx context.Context, repo *gitalypb.Repository, ref, oldValue, newValue string, env []string, stdout, stderr io.Writer) error {
payload, err := git.HooksPayloadFromEnv(env)
if err != nil {
diff --git a/internal/gitaly/service/operations/apply_patch.go b/internal/gitaly/service/operations/apply_patch.go
index 4b3f2358e..cc27d1017 100644
--- a/internal/gitaly/service/operations/apply_patch.go
+++ b/internal/gitaly/service/operations/apply_patch.go
@@ -33,7 +33,6 @@ func (er gitError) Error() string {
return er.ErrMsg + ": " + er.Err.Error()
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserApplyPatch(stream gitalypb.OperationService_UserApplyPatchServer) error {
firstRequest, err := stream.Recv()
if err != nil {
diff --git a/internal/gitaly/service/operations/branches.go b/internal/gitaly/service/operations/branches.go
index b80ec8627..560b308a0 100644
--- a/internal/gitaly/service/operations/branches.go
+++ b/internal/gitaly/service/operations/branches.go
@@ -13,7 +13,6 @@ import (
"google.golang.org/grpc/status"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserCreateBranch(ctx context.Context, req *gitalypb.UserCreateBranchRequest) (*gitalypb.UserCreateBranchResponse, error) {
if len(req.BranchName) == 0 {
return nil, status.Errorf(codes.InvalidArgument, "Bad Request (empty branch name)")
@@ -117,7 +116,6 @@ func validateUserUpdateBranchGo(req *gitalypb.UserUpdateBranchRequest) error {
return nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserUpdateBranch(ctx context.Context, req *gitalypb.UserUpdateBranchRequest) (*gitalypb.UserUpdateBranchResponse, error) {
// Validate the request
if err := validateUserUpdateBranchGo(req); err != nil {
diff --git a/internal/gitaly/service/operations/cherry_pick.go b/internal/gitaly/service/operations/cherry_pick.go
index 1a8727298..25fde3e84 100644
--- a/internal/gitaly/service/operations/cherry_pick.go
+++ b/internal/gitaly/service/operations/cherry_pick.go
@@ -16,7 +16,6 @@ import (
"google.golang.org/grpc/status"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserCherryPick(ctx context.Context, req *gitalypb.UserCherryPickRequest) (*gitalypb.UserCherryPickResponse, error) {
if err := validateCherryPickOrRevertRequest(req); err != nil {
return nil, status.Errorf(codes.InvalidArgument, "UserCherryPick: %v", err)
diff --git a/internal/gitaly/service/operations/merge.go b/internal/gitaly/service/operations/merge.go
index 2fbb37964..075bef50b 100644
--- a/internal/gitaly/service/operations/merge.go
+++ b/internal/gitaly/service/operations/merge.go
@@ -44,7 +44,6 @@ func validateMergeBranchRequest(request *gitalypb.UserMergeBranchRequest) error
return nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserMergeBranch(stream gitalypb.OperationService_UserMergeBranchServer) error {
ctx := stream.Context()
@@ -243,7 +242,6 @@ func validateFFRequest(in *gitalypb.UserFFBranchRequest) error {
return nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserFFBranch(ctx context.Context, in *gitalypb.UserFFBranchRequest) (*gitalypb.UserFFBranchResponse, error) {
if err := validateFFRequest(in); err != nil {
return nil, helper.ErrInvalidArgument(err)
diff --git a/internal/gitaly/service/operations/rebase.go b/internal/gitaly/service/operations/rebase.go
index cd5e8d470..386c69f19 100644
--- a/internal/gitaly/service/operations/rebase.go
+++ b/internal/gitaly/service/operations/rebase.go
@@ -14,7 +14,6 @@ import (
"google.golang.org/grpc/status"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserRebaseConfirmable(stream gitalypb.OperationService_UserRebaseConfirmableServer) error {
firstRequest, err := stream.Recv()
if err != nil {
diff --git a/internal/gitaly/service/operations/revert.go b/internal/gitaly/service/operations/revert.go
index 91777022e..f5a3a43d6 100644
--- a/internal/gitaly/service/operations/revert.go
+++ b/internal/gitaly/service/operations/revert.go
@@ -14,7 +14,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserRevert(ctx context.Context, req *gitalypb.UserRevertRequest) (*gitalypb.UserRevertResponse, error) {
if err := validateCherryPickOrRevertRequest(req); err != nil {
return nil, helper.ErrInvalidArgument(err)
diff --git a/internal/gitaly/service/operations/server.go b/internal/gitaly/service/operations/server.go
index 59782f1d7..4ea71acbd 100644
--- a/internal/gitaly/service/operations/server.go
+++ b/internal/gitaly/service/operations/server.go
@@ -18,7 +18,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
type Server struct {
gitalypb.UnimplementedOperationServiceServer
hookManager hook.Manager
diff --git a/internal/gitaly/service/operations/submodules.go b/internal/gitaly/service/operations/submodules.go
index 91a0108f6..f105c1351 100644
--- a/internal/gitaly/service/operations/submodules.go
+++ b/internal/gitaly/service/operations/submodules.go
@@ -19,7 +19,6 @@ import (
const userUpdateSubmoduleName = "UserUpdateSubmodule"
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserUpdateSubmodule(ctx context.Context, req *gitalypb.UserUpdateSubmoduleRequest) (*gitalypb.UserUpdateSubmoduleResponse, error) {
if err := validateUserUpdateSubmoduleRequest(req); err != nil {
return nil, status.Errorf(codes.InvalidArgument, userUpdateSubmoduleName+": %v", err)
diff --git a/internal/gitaly/service/operations/tags.go b/internal/gitaly/service/operations/tags.go
index df96027c6..7e56c2347 100644
--- a/internal/gitaly/service/operations/tags.go
+++ b/internal/gitaly/service/operations/tags.go
@@ -19,7 +19,6 @@ import (
"google.golang.org/grpc/status"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserDeleteTag(ctx context.Context, req *gitalypb.UserDeleteTagRequest) (*gitalypb.UserDeleteTagResponse, error) {
if len(req.TagName) == 0 {
return nil, status.Errorf(codes.InvalidArgument, "empty tag name")
@@ -82,7 +81,6 @@ func validateUserCreateTag(req *gitalypb.UserCreateTagRequest) error {
return nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) UserCreateTag(ctx context.Context, req *gitalypb.UserCreateTagRequest) (*gitalypb.UserCreateTagResponse, error) {
if err := validateUserCreateTag(req); err != nil {
return nil, helper.ErrInvalidArgumentf("validating request: %w", err)
diff --git a/internal/gitaly/service/smarthttp/server.go b/internal/gitaly/service/smarthttp/server.go
index ac8d6fb0e..87b0c2db5 100644
--- a/internal/gitaly/service/smarthttp/server.go
+++ b/internal/gitaly/service/smarthttp/server.go
@@ -47,7 +47,6 @@ func NewServer(
// ServerOpt is a self referential option for server
type ServerOpt func(s *server)
-//nolint:stylecheck // This is unintentionally missing documentation.
func WithPackfileNegotiationMetrics(c *prometheus.CounterVec) ServerOpt {
return func(s *server) {
s.packfileNegotiationMetrics = c
diff --git a/internal/gitaly/service/ssh/server.go b/internal/gitaly/service/ssh/server.go
index b82ab9bf1..ec7a210f7 100644
--- a/internal/gitaly/service/ssh/server.go
+++ b/internal/gitaly/service/ssh/server.go
@@ -68,7 +68,6 @@ func WithArchiveRequestTimeout(d time.Duration) ServerOpt {
}
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func WithPackfileNegotiationMetrics(c *prometheus.CounterVec) ServerOpt {
return func(s *server) {
s.packfileNegotiationMetrics = c
diff --git a/internal/gitaly/storage/locator.go b/internal/gitaly/storage/locator.go
index de44309c9..ac527c471 100644
--- a/internal/gitaly/storage/locator.go
+++ b/internal/gitaly/storage/locator.go
@@ -34,7 +34,6 @@ type Locator interface {
StateDir(storageName string) (string, error)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
var ErrRelativePathEscapesRoot = errors.New("relative path escapes root directory")
// ValidateRelativePath validates a relative path by joining it with rootDir and verifying the result
diff --git a/internal/gitlab/http_client_test.go b/internal/gitlab/http_client_test.go
index 4f6bf150a..1179fbb3d 100644
--- a/internal/gitlab/http_client_test.go
+++ b/internal/gitlab/http_client_test.go
@@ -29,6 +29,7 @@ type postReceiveRequest struct {
// TestAllowedVerifyParams uses client cert fixtures to test TLS connections. To
// regenerate these certs, run `go generate access_test.go`.
+//
//go:generate openssl req -newkey rsa:4096 -new -nodes -x509 -days 3650 -out testdata/certs/server.crt -keyout testdata/certs/server.key -subj "/C=US/ST=California/L=San Francisco/O=GitLab/OU=GitLab-Shell/CN=localhost" -addext "subjectAltName = IP:127.0.0.1"
func TestAccess_verifyParams(t *testing.T) {
user, password := "user", "password"
diff --git a/internal/helper/security.go b/internal/helper/security.go
index f074c5605..c46e1e938 100644
--- a/internal/helper/security.go
+++ b/internal/helper/security.go
@@ -6,7 +6,8 @@ import (
)
// Pattern taken from Regular Expressions Cookbook, slightly modified though
-// |Scheme |User |Named/IPv4 host|IPv6+ host
+//
+// |Scheme |User |Named/IPv4 host|IPv6+ host
var hostPattern = regexp.MustCompile(`(?i)([a-z][a-z0-9+\-.]*://)([a-z0-9\-._~%!$&'()*+,;=:]+@)([a-z0-9\-._~%]+|\[[a-z0-9\-._~%!$&'()*+,;=:]+\])`)
// SanitizeString will clean password and tokens from URLs, and replace them
diff --git a/internal/helper/ticker.go b/internal/helper/ticker.go
index 7bd094c01..1d10981dc 100644
--- a/internal/helper/ticker.go
+++ b/internal/helper/ticker.go
@@ -47,16 +47,12 @@ type ManualTicker struct {
ResetFunc func()
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (mt *ManualTicker) C() <-chan time.Time { return mt.c }
-//nolint:stylecheck // This is unintentionally missing documentation.
func (mt *ManualTicker) Stop() { mt.StopFunc() }
-//nolint:stylecheck // This is unintentionally missing documentation.
func (mt *ManualTicker) Reset() { mt.ResetFunc() }
-//nolint:stylecheck // This is unintentionally missing documentation.
func (mt *ManualTicker) Tick() { mt.c <- time.Now() }
// NewManualTicker returns a Ticker that can be manually controlled.
diff --git a/internal/log/log_test.go b/internal/log/log_test.go
index 7c72064fb..ec493de09 100644
--- a/internal/log/log_test.go
+++ b/internal/log/log_test.go
@@ -442,8 +442,11 @@ func TestStreamLogDataCatcherServerInterceptor(t *testing.T) {
})
}
-//nolint:forbidigo // We cannot use `testhelper.Context()` because of a cyclic dependency between
// this package and the `testhelper` package.
+//
+// this package and the `testhelper` package.
+//
+//nolint:forbidigo // We cannot use `testhelper.Context()` because of a cyclic dependency between
func createContext() context.Context {
return context.Background()
}
diff --git a/internal/logsanitizer/url.go b/internal/logsanitizer/url.go
index 8640570f5..5c59eb5c2 100644
--- a/internal/logsanitizer/url.go
+++ b/internal/logsanitizer/url.go
@@ -7,7 +7,8 @@ import (
)
// Pattern taken from Regular Expressions Cookbook, slightly modified though
-// |Scheme |User |Named/IPv4 host|IPv6+ host
+//
+// |Scheme |User |Named/IPv4 host|IPv6+ host
var hostPattern = regexp.MustCompile(`(?i)([a-z][a-z0-9+\-.]*://)?([a-z0-9\-._~%!$&'()*+,;=:]+@)([a-z0-9\-._~%]+|\[[a-z0-9\-._~%!$&'()*+,;=:]+\])`)
// URLSanitizerHook stores which gRPC methods to perform sanitization for.
diff --git a/internal/metadata/featureflag/context_test.go b/internal/metadata/featureflag/context_test.go
index 934a3abfa..58a079996 100644
--- a/internal/metadata/featureflag/context_test.go
+++ b/internal/metadata/featureflag/context_test.go
@@ -16,8 +16,11 @@ var (
ffB = FeatureFlag{"feature-b", false}
)
-//nolint:forbidigo // We cannot use `testhelper.Context()` given that it would inject feature flags
// already.
+//
+// already.
+//
+//nolint:forbidigo // We cannot use `testhelper.Context()` given that it would inject feature flags
func createContext() context.Context {
return context.Background()
}
diff --git a/internal/praefect/config/config.go b/internal/praefect/config/config.go
index 9e6603300..8f02be8b8 100644
--- a/internal/praefect/config/config.go
+++ b/internal/praefect/config/config.go
@@ -41,7 +41,6 @@ const (
minimalSyncRunInterval = time.Minute
)
-//nolint:stylecheck // This is unintentionally missing documentation.
type Failover struct {
Enabled bool `toml:"enabled,omitempty"`
// ElectionStrategy is the strategy to use for electing primaries nodes.
diff --git a/internal/praefect/config/node.go b/internal/praefect/config/node.go
index fccf473a5..7385b1181 100644
--- a/internal/praefect/config/node.go
+++ b/internal/praefect/config/node.go
@@ -12,7 +12,6 @@ type Node struct {
Token string `toml:"token,omitempty"`
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (n Node) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"storage": n.Storage,
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go
index 1f0e34784..196c747c1 100644
--- a/internal/praefect/coordinator.go
+++ b/internal/praefect/coordinator.go
@@ -235,12 +235,10 @@ func NewCoordinator(
return coordinator
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (c *Coordinator) Describe(descs chan<- *prometheus.Desc) {
prometheus.DescribeByCollect(c, descs)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (c *Coordinator) Collect(metrics chan<- prometheus.Metric) {
c.votersMetric.Collect(metrics)
c.txReplicationCountMetric.Collect(metrics)
@@ -844,18 +842,18 @@ func (c *Coordinator) createTransactionFinalizer(
// getUpdatedAndOutdatedSecondaries returns all nodes which can be considered up-to-date or outdated
// after the given transaction. A node is considered outdated, if one of the following is true:
//
-// - No subtransactions were created and the RPC was successful on the primary. This really is only
-// a safeguard in case the RPC wasn't aware of transactions and thus failed to correctly assert
-// its state matches across nodes. This is rather pessimistic, as it could also indicate that an
-// RPC simply didn't change anything. If the RPC was a failure on the primary and there were no
-// subtransactions, we assume no changes were done and that the nodes failed prior to voting.
+// - No subtransactions were created and the RPC was successful on the primary. This really is only
+// a safeguard in case the RPC wasn't aware of transactions and thus failed to correctly assert
+// its state matches across nodes. This is rather pessimistic, as it could also indicate that an
+// RPC simply didn't change anything. If the RPC was a failure on the primary and there were no
+// subtransactions, we assume no changes were done and that the nodes failed prior to voting.
//
-// - The node failed to be part of the quorum. As a special case, if the primary fails the vote, all
-// nodes need to get replication jobs.
+// - The node failed to be part of the quorum. As a special case, if the primary fails the vote, all
+// nodes need to get replication jobs.
//
-// - The node has a different error state than the primary. If both primary and secondary have
-// returned the same error, then we assume they did the same thing and failed in the same
-// controlled way.
+// - The node has a different error state than the primary. If both primary and secondary have
+// returned the same error, then we assume they did the same thing and failed in the same
+// controlled way.
//
// Note that this function cannot and should not fail: if anything goes wrong, we need to create
// replication jobs to repair state.
diff --git a/internal/praefect/datastore/assignment.go b/internal/praefect/datastore/assignment.go
index 4c9a7c4f1..d07ce7f91 100644
--- a/internal/praefect/datastore/assignment.go
+++ b/internal/praefect/datastore/assignment.go
@@ -37,7 +37,6 @@ func NewAssignmentStore(db glsql.Querier, configuredStorages map[string][]string
return AssignmentStore{db: db, configuredStorages: configuredStorages}
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s AssignmentStore) GetHostAssignments(ctx context.Context, virtualStorage string, repositoryID int64) ([]string, error) {
configuredStorages, ok := s.configuredStorages[virtualStorage]
if !ok {
diff --git a/internal/praefect/datastore/collector.go b/internal/praefect/datastore/collector.go
index 7a964fd0e..ed20dd9e7 100644
--- a/internal/praefect/datastore/collector.go
+++ b/internal/praefect/datastore/collector.go
@@ -49,12 +49,10 @@ func NewRepositoryStoreCollector(
}
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (c *RepositoryStoreCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- descUnavailableRepositories
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (c *RepositoryStoreCollector) Collect(ch chan<- prometheus.Metric) {
ctx, cancel := context.WithTimeout(context.TODO(), c.timeout)
defer cancel()
@@ -110,7 +108,6 @@ type QueueDepthCollector struct {
db glsql.Querier
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (q *QueueDepthCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- descReplicationQueueDepth
}
diff --git a/internal/praefect/datastore/mock.go b/internal/praefect/datastore/mock.go
index 2ad504e12..74886dc83 100644
--- a/internal/praefect/datastore/mock.go
+++ b/internal/praefect/datastore/mock.go
@@ -9,7 +9,6 @@ type MockReplicationEventQueue struct {
EnqueueFunc func(context.Context, ReplicationEvent) (ReplicationEvent, error)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockReplicationEventQueue) Enqueue(ctx context.Context, event ReplicationEvent) (ReplicationEvent, error) {
return m.EnqueueFunc(ctx, event)
}
diff --git a/internal/praefect/datastore/queue.go b/internal/praefect/datastore/queue.go
index 253e21382..7c774ac57 100644
--- a/internal/praefect/datastore/queue.go
+++ b/internal/praefect/datastore/queue.go
@@ -66,7 +66,6 @@ type ReplicationJob struct {
Params Params `json:"params"`
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (job *ReplicationJob) Scan(value interface{}) error {
if value == nil {
return nil
@@ -80,7 +79,6 @@ func (job *ReplicationJob) Scan(value interface{}) error {
return json.Unmarshal(d, job)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (job ReplicationJob) Value() (driver.Value, error) {
data, err := json.Marshal(job)
if err != nil {
@@ -208,7 +206,6 @@ type PostgresReplicationEventQueue struct {
qc glsql.Querier
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (rq PostgresReplicationEventQueue) Enqueue(ctx context.Context, event ReplicationEvent) (ReplicationEvent, error) {
// When `Enqueue` method is called:
// 1. Insertion of the new record into `replication_queue_lock` table, so we are ensured all events have
@@ -241,7 +238,6 @@ func (rq PostgresReplicationEventQueue) Enqueue(ctx context.Context, event Repli
return events[0], nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (rq PostgresReplicationEventQueue) Dequeue(ctx context.Context, virtualStorage, nodeStorage string, count int) ([]ReplicationEvent, error) {
// When `Dequeue` method is called:
// 1. Events with attempts left that are either in `ready` or `failed` state are candidates for dequeuing.
@@ -322,7 +318,6 @@ func (rq PostgresReplicationEventQueue) Dequeue(ctx context.Context, virtualStor
return res, nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (rq PostgresReplicationEventQueue) Acknowledge(ctx context.Context, state JobState, ids []uint64) ([]uint64, error) {
// When `Acknowledge` method is called:
// 1. The list of event `id`s and corresponding <lock>s retrieved from `replication_queue` table as passed in by the
@@ -476,8 +471,10 @@ func (rq PostgresReplicationEventQueue) StartHealthUpdate(ctx context.Context, t
// AcknowledgeStale moves replication events that are 'in_progress' state for too long (more then staleAfter)
// into the next state:
-// 'failed' - in case it has more attempts to be executed
-// 'dead' - in case it has no more attempts to be executed
+//
+// 'failed' - in case it has more attempts to be executed
+// 'dead' - in case it has no more attempts to be executed
+//
// The job considered 'in_progress' if it has corresponding entry in the 'replication_queue_job_lock' table.
// When moving from 'in_progress' to other state the entry from 'replication_queue_job_lock' table will be
// removed and entry in the 'replication_queue_lock' will be updated if needed (release of the lock).
diff --git a/internal/praefect/datastore/repository_store.go b/internal/praefect/datastore/repository_store.go
index 94234cea6..8e750d4d8 100644
--- a/internal/praefect/datastore/repository_store.go
+++ b/internal/praefect/datastore/repository_store.go
@@ -213,7 +213,6 @@ func (rs *PostgresRepositoryStore) MarkStorageUnverified(ctx context.Context, vi
return result.RowsAffected()
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (rs *PostgresRepositoryStore) GetGeneration(ctx context.Context, repositoryID int64, storage string) (int, error) {
const q = `
SELECT generation
@@ -234,7 +233,6 @@ AND storage = $2
return gen, nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (rs *PostgresRepositoryStore) IncrementGeneration(ctx context.Context, repositoryID int64, primary string, secondaries []string) error {
const q = `
WITH updated_replicas AS (
@@ -288,7 +286,6 @@ SELECT
return nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (rs *PostgresRepositoryStore) SetGeneration(ctx context.Context, repositoryID int64, storage, relativePath string, generation int) error {
const q = `
WITH repository AS (
@@ -352,7 +349,6 @@ ON CONFLICT (virtual_storage, relative_path, storage) DO UPDATE
return nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (rs *PostgresRepositoryStore) GetReplicatedGeneration(ctx context.Context, repositoryID int64, source, target string) (int, error) {
const q = `
SELECT storage, generation
@@ -487,7 +483,6 @@ FROM (
return nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (rs *PostgresRepositoryStore) DeleteRepository(ctx context.Context, virtualStorage, relativePath string) (string, []string, error) {
var (
replicaPath string
@@ -571,7 +566,6 @@ WHERE repository_id = (SELECT repository_id FROM repository)
return nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (rs *PostgresRepositoryStore) RenameRepository(ctx context.Context, virtualStorage, relativePath, storage, newRelativePath string) error {
const q = `
WITH repo AS (
@@ -657,7 +651,6 @@ func (rs *PostgresRepositoryStore) getConsistentStorages(ctx context.Context, qu
return replicaPath, consistentStorages, nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (rs *PostgresRepositoryStore) RepositoryExists(ctx context.Context, virtualStorage, relativePath string) (bool, error) {
const q = `
SELECT true
diff --git a/internal/praefect/datastore/repository_store_mock.go b/internal/praefect/datastore/repository_store_mock.go
index 860e164de..f3b78097b 100644
--- a/internal/praefect/datastore/repository_store_mock.go
+++ b/internal/praefect/datastore/repository_store_mock.go
@@ -28,7 +28,6 @@ type MockRepositoryStore struct {
GetRepositoryMetadataByPathFunc func(ctx context.Context, virtualStorage, relativePath string) (RepositoryMetadata, error)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m MockRepositoryStore) GetGeneration(ctx context.Context, repositoryID int64, storage string) (int, error) {
if m.GetGenerationFunc == nil {
return GenerationUnknown, nil
@@ -37,7 +36,6 @@ func (m MockRepositoryStore) GetGeneration(ctx context.Context, repositoryID int
return m.GetGenerationFunc(ctx, repositoryID, storage)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m MockRepositoryStore) IncrementGeneration(ctx context.Context, repositoryID int64, primary string, secondaries []string) error {
if m.IncrementGenerationFunc == nil {
return nil
@@ -46,7 +44,6 @@ func (m MockRepositoryStore) IncrementGeneration(ctx context.Context, repository
return m.IncrementGenerationFunc(ctx, repositoryID, primary, secondaries)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m MockRepositoryStore) GetReplicatedGeneration(ctx context.Context, repositoryID int64, source, target string) (int, error) {
if m.GetReplicatedGenerationFunc == nil {
return GenerationUnknown, nil
@@ -55,7 +52,6 @@ func (m MockRepositoryStore) GetReplicatedGeneration(ctx context.Context, reposi
return m.GetReplicatedGenerationFunc(ctx, repositoryID, source, target)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m MockRepositoryStore) SetGeneration(ctx context.Context, repositoryID int64, storage, relativePath string, generation int) error {
if m.SetGenerationFunc == nil {
return nil
@@ -82,7 +78,6 @@ func (m MockRepositoryStore) SetAuthoritativeReplica(ctx context.Context, virtua
return m.SetAuthoritativeReplicaFunc(ctx, virtualStorage, relativePath, storage)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m MockRepositoryStore) DeleteRepository(ctx context.Context, virtualStorage, relativePath string) (string, []string, error) {
if m.DeleteRepositoryFunc == nil {
return "", nil, nil
@@ -105,7 +100,6 @@ func (m MockRepositoryStore) RenameRepositoryInPlace(ctx context.Context, virtua
return m.RenameRepositoryInPlaceFunc(ctx, virtualStorage, relativePath, newRelativePath)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m MockRepositoryStore) RenameRepository(ctx context.Context, virtualStorage, relativePath, storage, newRelativePath string) error {
if m.RenameRepositoryFunc == nil {
return nil
@@ -141,7 +135,6 @@ func (m MockRepositoryStore) GetPartiallyAvailableRepositories(ctx context.Conte
return m.GetPartiallyAvailableRepositoriesFunc(ctx, virtualStorage)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m MockRepositoryStore) DeleteInvalidRepository(ctx context.Context, repositoryID int64, storage string) error {
if m.DeleteInvalidRepositoryFunc == nil {
return nil
@@ -150,7 +143,6 @@ func (m MockRepositoryStore) DeleteInvalidRepository(ctx context.Context, reposi
return m.DeleteInvalidRepositoryFunc(ctx, repositoryID, storage)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m MockRepositoryStore) RepositoryExists(ctx context.Context, virtualStorage, relativePath string) (bool, error) {
if m.RepositoryExistsFunc == nil {
return true, nil
diff --git a/internal/praefect/grpc-proxy/proxy/director.go b/internal/praefect/grpc-proxy/proxy/director.go
index d8e4e4de3..8a156668a 100644
--- a/internal/praefect/grpc-proxy/proxy/director.go
+++ b/internal/praefect/grpc-proxy/proxy/director.go
@@ -58,12 +58,10 @@ func NewStreamParameters(primary Destination, secondaries []Destination, reqFina
}
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *StreamParameters) Primary() Destination {
return s.primary
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *StreamParameters) Secondaries() []Destination {
return s.secondaries
}
diff --git a/internal/praefect/grpc-proxy/proxy/handler.go b/internal/praefect/grpc-proxy/proxy/handler.go
index 82c252526..b0ca206ca 100644
--- a/internal/praefect/grpc-proxy/proxy/handler.go
+++ b/internal/praefect/grpc-proxy/proxy/handler.go
@@ -24,10 +24,11 @@ var clientStreamDescForProxying = &grpc.StreamDesc{
// RegisterStreamHandlers sets up stream handlers for a set of gRPC methods for a given service.
// streamers is a map of method to grpc.StreamHandler eg:
//
-// streamHandler := func(srv interface{}, stream ServerStream) error {
-// /** do some stuff **/
-// return nil
-// }
+// streamHandler := func(srv interface{}, stream ServerStream) error {
+// /** do some stuff **/
+// return nil
+// }
+//
// RegisterStreamHandlers(grpcServer, "MyGrpcService", map[string]grpc.StreamHandler{"Method1": streamHandler})
// note: multiple calls with the same serviceName will result in a fatal
func RegisterStreamHandlers(server *grpc.Server, serviceName string, streamers map[string]grpc.StreamHandler) {
diff --git a/internal/praefect/health_checker.go b/internal/praefect/health_checker.go
index ba142d420..2bd4721ea 100644
--- a/internal/praefect/health_checker.go
+++ b/internal/praefect/health_checker.go
@@ -9,7 +9,6 @@ type HealthChecker interface {
// StaticHealthChecker returns the nodes as always healthy.
type StaticHealthChecker map[string][]string
-//nolint:stylecheck // This is unintentionally missing documentation.
func (healthyNodes StaticHealthChecker) HealthyNodes() map[string][]string {
return healthyNodes
}
diff --git a/internal/praefect/metrics/prometheus.go b/internal/praefect/metrics/prometheus.go
index 6dc257a10..6b0533214 100644
--- a/internal/praefect/metrics/prometheus.go
+++ b/internal/praefect/metrics/prometheus.go
@@ -54,7 +54,6 @@ func RegisterNodeLatency(conf gitalycfgprom.Config, registerer prometheus.Regist
return nodeLatency, registerer.Register(nodeLatency)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
var MethodTypeCounter = promauto.NewCounterVec(
prometheus.CounterOpts{
Namespace: "gitaly",
@@ -63,7 +62,6 @@ var MethodTypeCounter = promauto.NewCounterVec(
}, []string{"method_type"},
)
-//nolint:stylecheck // This is unintentionally missing documentation.
var PrimaryGauge = promauto.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "gitaly",
@@ -72,7 +70,6 @@ var PrimaryGauge = promauto.NewGaugeVec(
}, []string{"virtual_storage", "gitaly_storage"},
)
-//nolint:stylecheck // This is unintentionally missing documentation.
var NodeLastHealthcheckGauge = promauto.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "gitaly",
diff --git a/internal/praefect/nodes/health_manager.go b/internal/praefect/nodes/health_manager.go
index ca758f459..21cdfc9fe 100644
--- a/internal/praefect/nodes/health_manager.go
+++ b/internal/praefect/nodes/health_manager.go
@@ -20,13 +20,13 @@ type HealthClients map[string]map[string]grpc_health_v1.HealthClient
// HealthManager monitors the health status of the storage cluster. The monitoring frequency
// is controlled by the Ticker passed in to Run method. On each tick, the HealthManager:
//
-// 1. Runs health checks on configured physical storages by performing a gRPC call
-// to the health checking endpoint. If an error tracker is configured, it also considers
-// its view of the node's health.
-// 2. Stores its health check results in the `node_status` table.
-// 3. Checks if the clusters consensus of healthy nodes has changed by querying the `node_status`
-// table for results of the other Praefect instances. If so, it sends to the Updated channel
-// to signal a change in the cluster status.
+// 1. Runs health checks on configured physical storages by performing a gRPC call
+// to the health checking endpoint. If an error tracker is configured, it also considers
+// its view of the node's health.
+// 2. Stores its health check results in the `node_status` table.
+// 3. Checks if the clusters consensus of healthy nodes has changed by querying the `node_status`
+// table for results of the other Praefect instances. If so, it sends to the Updated channel
+// to signal a change in the cluster status.
//
// To determine the participants for the quorum, we use a lightweight service discovery protocol.
// A Praefect instance is deemed to be voting member if it has a recent health check in the
diff --git a/internal/praefect/nodes/manager.go b/internal/praefect/nodes/manager.go
index 0413c2533..ed0325a6e 100644
--- a/internal/praefect/nodes/manager.go
+++ b/internal/praefect/nodes/manager.go
@@ -33,7 +33,6 @@ type Shard struct {
Secondaries []Node
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s Shard) GetNode(storage string) (Node, error) {
if storage == s.Primary.GetStorage() {
return s.Primary, nil
@@ -262,7 +261,6 @@ func (n *Mgr) GetPrimary(ctx context.Context, virtualStorage string, _ int64) (s
return shard.Primary.GetStorage(), nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (n *Mgr) GetSyncedNode(ctx context.Context, virtualStorageName, repoPath string) (Node, error) {
_, upToDateStorages, err := n.csg.GetConsistentStorages(ctx, virtualStorageName, repoPath)
if err != nil && !errors.As(err, new(commonerr.RepositoryNotFoundError)) {
@@ -299,7 +297,6 @@ func (n *Mgr) GetSyncedNode(ctx context.Context, virtualStorageName, repoPath st
return healthyStorages[rand.Intn(len(healthyStorages))], nil
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (n *Mgr) HealthyNodes() map[string][]string {
healthy := make(map[string][]string, len(n.nodes))
for vs, nodes := range n.nodes {
@@ -316,7 +313,6 @@ func (n *Mgr) HealthyNodes() map[string][]string {
return healthy
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (n *Mgr) Nodes() map[string][]Node { return n.nodes }
func newConnectionStatus(node config.Node, cc *grpc.ClientConn, l logrus.FieldLogger, latencyHist prommetrics.HistogramVec, errorTracker tracker.ErrorTracker) *nodeStatus {
diff --git a/internal/praefect/nodes/mock.go b/internal/praefect/nodes/mock.go
index e4dee08ff..4d4def3da 100644
--- a/internal/praefect/nodes/mock.go
+++ b/internal/praefect/nodes/mock.go
@@ -14,7 +14,6 @@ type MockManager struct {
Storage string
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockManager) GetShard(_ context.Context, storage string) (Shard, error) {
return m.GetShardFunc(storage)
}
@@ -58,17 +57,12 @@ type MockNode struct {
Healthy bool
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockNode) GetStorage() string { return m.GetStorageMethod() }
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockNode) IsHealthy() bool { return m.Healthy }
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockNode) GetConnection() *grpc.ClientConn { return m.Conn }
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockNode) GetAddress() string { return "" }
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockNode) GetToken() string { return "" }
diff --git a/internal/praefect/nodes/ping.go b/internal/praefect/nodes/ping.go
index e0bcd9b9b..8b1b67540 100644
--- a/internal/praefect/nodes/ping.go
+++ b/internal/praefect/nodes/ping.go
@@ -191,7 +191,8 @@ func (t *TextPrinter) Printf(format string, args ...interface{}) {
}
// CheckNode checks network connectivity by issuing a healthcheck request, and
-// also calls the ServerInfo RPC to check disk read/write access.
+//
+// also calls the ServerInfo RPC to check disk read/write access.
func (p *Ping) CheckNode(ctx context.Context) {
p.log("dialing...")
cc, err := p.dial(ctx)
diff --git a/internal/praefect/nodes/sql_elector.go b/internal/praefect/nodes/sql_elector.go
index 224e5b3e4..12d12eded 100644
--- a/internal/praefect/nodes/sql_elector.go
+++ b/internal/praefect/nodes/sql_elector.go
@@ -42,19 +42,20 @@ type sqlCandidate struct {
// 1. For each node, Praefect updates a row in a new table
// (`node_status`) with the following information:
//
-// a. The name of the Praefect instance (`praefect_name`)
-// b. The name of the virtual storage name (`shard_name`)
-// c. The name of the Gitaly storage name (`storage_name`)
-// d. The timestamp of the last time Praefect tried to reach that node (`last_contact_attempt_at`)
-// e. The timestamp of the last successful health check (`last_seen_active_at`)
+// a. The name of the Praefect instance (`praefect_name`)
+// b. The name of the virtual storage name (`shard_name`)
+// c. The name of the Gitaly storage name (`storage_name`)
+// d. The timestamp of the last time Praefect tried to reach that node (`last_contact_attempt_at`)
+// e. The timestamp of the last successful health check (`last_seen_active_at`)
//
// 2. Once the health checks are complete, Praefect node does a `SELECT` from
// `node_status` to determine healthy nodes. A healthy node is
// defined by:
-// a. A node that has a recent successful error check (e.g. one in
-// the last 10 s).
-// b. A majority of the available Praefect nodes have entries that
-// match the two above.
+//
+// a. A node that has a recent successful error check (e.g. one in
+// the last 10 s).
+// b. A majority of the available Praefect nodes have entries that
+// match the two above.
//
// To determine the majority, we use a lightweight service discovery
// protocol: a Praefect node is deemed a voting member if the
diff --git a/internal/praefect/protoregistry/protoregistry.go b/internal/praefect/protoregistry/protoregistry.go
index d06bd9de1..dde47c289 100644
--- a/internal/praefect/protoregistry/protoregistry.go
+++ b/internal/praefect/protoregistry/protoregistry.go
@@ -100,7 +100,6 @@ func (mi MethodInfo) AdditionalRepo(msg proto.Message) (*gitalypb.Repository, bo
return repo, true, err
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (mi MethodInfo) FullMethodName() string {
return mi.fullMethodName
}
diff --git a/internal/praefect/reconciler/reconciler.go b/internal/praefect/reconciler/reconciler.go
index 3d731563a..d5daffc25 100644
--- a/internal/praefect/reconciler/reconciler.go
+++ b/internal/praefect/reconciler/reconciler.go
@@ -49,12 +49,10 @@ func NewReconciler(log logrus.FieldLogger, db glsql.Querier, hc praefect.HealthC
return r
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (r *Reconciler) Describe(ch chan<- *prometheus.Desc) {
prometheus.DescribeByCollect(r, ch)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (r *Reconciler) Collect(ch chan<- prometheus.Metric) {
r.reconciliationSchedulingDuration.Collect(ch)
}
@@ -99,14 +97,14 @@ type job struct {
//
// It currently handles fixing two discrepancies:
//
-// 1. Assigned storage having an outdated replica of a repository. This is fixed by scheduling
-// an `update` type job from any healthy storage with an up to date replica. These are only
-// scheduled if there is no other active `update` type job targeting the outdated replica.
-// 2. Unassigned storage having an unnecessary replica. This is fixed by scheduling a `delete_replica`
-// type job to remove the unneeded replica from the storage. These are only scheduled if all assigned
-// storages are up to date and the replica is not used as a source or target storage in any other job.
-// Only one job of this type is allowed to be queued for a given repository at a time. This is to avoid
-// deleting too many replicas if assignments are changed while the jobs are queued.
+// 1. Assigned storage having an outdated replica of a repository. This is fixed by scheduling
+// an `update` type job from any healthy storage with an up to date replica. These are only
+// scheduled if there is no other active `update` type job targeting the outdated replica.
+// 2. Unassigned storage having an unnecessary replica. This is fixed by scheduling a `delete_replica`
+// type job to remove the unneeded replica from the storage. These are only scheduled if all assigned
+// storages are up to date and the replica is not used as a source or target storage in any other job.
+// Only one job of this type is allowed to be queued for a given repository at a time. This is to avoid
+// deleting too many replicas if assignments are changed while the jobs are queued.
//
// The fixes are only scheduled if the target node is healthy, and if there is a healthy source node
// available should the job need one.
diff --git a/internal/praefect/replicator.go b/internal/praefect/replicator.go
index 4cc6a99b1..b7b05bb62 100644
--- a/internal/praefect/replicator.go
+++ b/internal/praefect/replicator.go
@@ -287,12 +287,10 @@ func NewReplMgr(log logrus.FieldLogger, storageNames map[string][]string, queue
return r
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (r ReplMgr) Describe(ch chan<- *prometheus.Desc) {
prometheus.DescribeByCollect(r, ch)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (r ReplMgr) Collect(ch chan<- prometheus.Metric) {
r.replInFlightMetric.Collect(ch)
}
diff --git a/internal/praefect/router_per_repository.go b/internal/praefect/router_per_repository.go
index c39f755b1..ea664fd7e 100644
--- a/internal/praefect/router_per_repository.go
+++ b/internal/praefect/router_per_repository.go
@@ -135,7 +135,6 @@ func (r *PerRepositoryRouter) RouteStorageMutator(ctx context.Context, virtualSt
return StorageMutatorRoute{}, errors.New("RouteStorageMutator is not implemented on PerRepositoryRouter")
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (r *PerRepositoryRouter) RouteRepositoryAccessor(ctx context.Context, virtualStorage, relativePath string, forcePrimary bool) (RepositoryAccessorRoute, error) {
healthyNodes, err := r.healthyNodes(virtualStorage)
if err != nil {
@@ -208,7 +207,6 @@ func (r *PerRepositoryRouter) resolveAdditionalReplicaPath(ctx context.Context,
return r.rs.GetReplicaPath(ctx, additionalRepositoryID)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (r *PerRepositoryRouter) RouteRepositoryMutator(ctx context.Context, virtualStorage, relativePath, additionalRelativePath string) (RepositoryMutatorRoute, error) {
healthyNodes, err := r.healthyNodes(virtualStorage)
if err != nil {
diff --git a/internal/praefect/server.go b/internal/praefect/server.go
index 202eb2e6d..a31d4b071 100644
--- a/internal/praefect/server.go
+++ b/internal/praefect/server.go
@@ -1,5 +1,7 @@
-/*Package praefect is a Gitaly reverse proxy for transparently routing gRPC
-calls to a set of Gitaly services.*/
+/*
+Package praefect is a Gitaly reverse proxy for transparently routing gRPC
+calls to a set of Gitaly services.
+*/
package praefect
import (
diff --git a/internal/praefect/service/info/dataloss.go b/internal/praefect/service/info/dataloss.go
index c8394d202..a8879f920 100644
--- a/internal/praefect/service/info/dataloss.go
+++ b/internal/praefect/service/info/dataloss.go
@@ -6,7 +6,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) DatalossCheck(ctx context.Context, req *gitalypb.DatalossCheckRequest) (*gitalypb.DatalossCheckResponse, error) {
repos, err := s.rs.GetPartiallyAvailableRepositories(ctx, req.GetVirtualStorage())
if err != nil {
diff --git a/internal/praefect/service/info/replication_factor.go b/internal/praefect/service/info/replication_factor.go
index 9e94452f6..e4c5ce9ac 100644
--- a/internal/praefect/service/info/replication_factor.go
+++ b/internal/praefect/service/info/replication_factor.go
@@ -10,7 +10,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) SetReplicationFactor(ctx context.Context, req *gitalypb.SetReplicationFactorRequest) (*gitalypb.SetReplicationFactorResponse, error) {
resp, err := s.setReplicationFactor(ctx, req)
if err != nil {
diff --git a/internal/praefect/service/info/server.go b/internal/praefect/service/info/server.go
index add45b1f3..07dfa32fc 100644
--- a/internal/praefect/service/info/server.go
+++ b/internal/praefect/service/info/server.go
@@ -60,7 +60,6 @@ func NewServer(
}
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (s *Server) SetAuthoritativeStorage(ctx context.Context, req *gitalypb.SetAuthoritativeStorageRequest) (*gitalypb.SetAuthoritativeStorageResponse, error) {
storages := s.conf.StorageNames()[req.VirtualStorage]
if storages == nil {
diff --git a/internal/praefect/service/transaction/server.go b/internal/praefect/service/transaction/server.go
index 93f880719..c5a8ca1c0 100644
--- a/internal/praefect/service/transaction/server.go
+++ b/internal/praefect/service/transaction/server.go
@@ -10,13 +10,11 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
type Server struct {
gitalypb.UnimplementedRefTransactionServer
txMgr *transactions.Manager
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func NewServer(txMgr *transactions.Manager) gitalypb.RefTransactionServer {
return &Server{
txMgr: txMgr,
diff --git a/internal/praefect/transactions/manager.go b/internal/praefect/transactions/manager.go
index e122f6c0e..131955b98 100644
--- a/internal/praefect/transactions/manager.go
+++ b/internal/praefect/transactions/manager.go
@@ -15,7 +15,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/internal/transaction/voting"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
var ErrNotFound = errors.New("transaction not found")
// Manager handles reference transactions for Praefect. It is required in order
@@ -63,12 +62,10 @@ func NewManager(cfg config.Config) *Manager {
}
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (mgr *Manager) Describe(descs chan<- *prometheus.Desc) {
prometheus.DescribeByCollect(mgr, descs)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (mgr *Manager) Collect(metrics chan<- prometheus.Metric) {
mgr.counterMetric.Collect(metrics)
mgr.delayMetric.Collect(metrics)
diff --git a/internal/streamcache/cache.go b/internal/streamcache/cache.go
index 333be63c7..857140220 100644
--- a/internal/streamcache/cache.go
+++ b/internal/streamcache/cache.go
@@ -12,7 +12,7 @@
// readers). A cache entry consists of a key, an maximum age, a
// pipe and the error result of the thing writing to the pipe.
//
-// Eviction
+// # Eviction
//
// There are two eviction goroutines: one for Cache and one for filestore.
// The Cache eviction goroutine evicts entries after a set amount of time,
diff --git a/internal/testhelper/gitlabtest.go b/internal/testhelper/gitlabtest.go
index 46632874b..bfcd0856f 100644
--- a/internal/testhelper/gitlabtest.go
+++ b/internal/testhelper/gitlabtest.go
@@ -6,9 +6,9 @@ import (
)
/*
- This is a manually maintained map to remove duplicate variable
- assignments. Please do not use go generate or such to maintain
- these, as we'd effectively test one parser against another.
+This is a manually maintained map to remove duplicate variable
+assignments. Please do not use go generate or such to maintain
+these, as we'd effectively test one parser against another.
*/
var commitMap = map[string]*gitalypb.GitCommit{
"b83d6e391c22777fca1ed3012fce84f633d7fed0": {
diff --git a/internal/testhelper/promtest/counter.go b/internal/testhelper/promtest/counter.go
index ec0e04c4f..665023436 100644
--- a/internal/testhelper/promtest/counter.go
+++ b/internal/testhelper/promtest/counter.go
@@ -4,25 +4,21 @@ import (
"sync"
)
-//nolint:stylecheck // This is unintentionally missing documentation.
type MockCounter struct {
m sync.RWMutex
value float64
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockCounter) Value() float64 {
m.m.RLock()
defer m.m.RUnlock()
return m.value
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockCounter) Inc() {
m.Add(1)
}
-//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockCounter) Add(v float64) {
m.m.Lock()
defer m.m.Unlock()
diff --git a/internal/testhelper/testdb/db.go b/internal/testhelper/testdb/db.go
index c909859c1..0a42e4468 100644
--- a/internal/testhelper/testdb/db.go
+++ b/internal/testhelper/testdb/db.go
@@ -126,9 +126,11 @@ func (db DB) Close() error {
// Must be used only for testing.
// The new database with empty relations will be created for each call of this function.
// It uses env vars:
-// PGHOST - required, URL/socket/dir
-// PGPORT - required, binding port
-// PGUSER - optional, user - `$ whoami` would be used if not provided
+//
+// PGHOST - required, URL/socket/dir
+// PGPORT - required, binding port
+// PGUSER - optional, user - `$ whoami` would be used if not provided
+//
// Once the test is completed the database will be dropped on test cleanup execution.
func New(tb testing.TB) DB {
tb.Helper()
diff --git a/packed_binaries.go b/packed_binaries.go
index 6b0774988..f3b532aba 100644
--- a/packed_binaries.go
+++ b/packed_binaries.go
@@ -11,10 +11,10 @@ import (
// buildDir is the directory path where our build target places the built binaries.
const buildDir = "_build/bin"
-//go:embed _build/bin/gitaly-hooks _build/bin/gitaly-ssh _build/bin/gitaly-git2go _build/bin/gitaly-lfs-smudge
-//
// packedBinariesFS contains embedded binaries. If you modify the above embeddings, you must also update
// GITALY_PACKED_EXECUTABLES in Makefile and packedBinaries in internal/gitaly/config/config.go.
+//
+//go:embed _build/bin/gitaly-hooks _build/bin/gitaly-ssh _build/bin/gitaly-git2go _build/bin/gitaly-lfs-smudge
var packedBinariesFS embed.FS
// UnpackAuxiliaryBinaries unpacks the packed auxiliary binaries of Gitaly into destination directory.
diff --git a/streamio/stream.go b/streamio/stream.go
index 68e6bd687..9d953eb66 100644
--- a/streamio/stream.go
+++ b/streamio/stream.go
@@ -1,7 +1,6 @@
// Package streamio contains wrappers intended for turning gRPC streams
// that send/receive messages with a []byte field into io.Writers and
// io.Readers.
-//
package streamio
import (
diff --git a/tools/protoc-gen-gitaly-lint/lint.go b/tools/protoc-gen-gitaly-lint/lint.go
index 8bb4c9e70..28dcd54ad 100644
--- a/tools/protoc-gen-gitaly-lint/lint.go
+++ b/tools/protoc-gen-gitaly-lint/lint.go
@@ -14,9 +14,9 @@ import (
// ensureMethodOpType will ensure that method includes the op_type option.
// See proto example below:
//
-// rpc ExampleMethod(ExampleMethodRequest) returns (ExampleMethodResponse) {
-// option (op_type).op = ACCESSOR;
-// }
+// rpc ExampleMethod(ExampleMethodRequest) returns (ExampleMethodResponse) {
+// option (op_type).op = ACCESSOR;
+// }
func ensureMethodOpType(fileDesc *descriptorpb.FileDescriptorProto, m *descriptorpb.MethodDescriptorProto, req *pluginpb.CodeGeneratorRequest) error {
opMsg, err := protoutil.GetOpExtension(m)
if err != nil {
diff --git a/tools/protoc-gen-gitaly-lint/main.go b/tools/protoc-gen-gitaly-lint/main.go
index be7de808b..9a1a610c8 100644
--- a/tools/protoc-gen-gitaly-lint/main.go
+++ b/tools/protoc-gen-gitaly-lint/main.go
@@ -1,49 +1,49 @@
// Command protoc-gen-gitaly-lint is designed to be used as a protobuf compiler
// plugin to verify Gitaly processes are being followed when writing RPC's.
//
-// Usage
+// # Usage
//
// The protoc-gen-gitaly linter can be chained into any protoc workflow that
// requires verification that Gitaly RPC guidelines are followed. Typically
// this can be done by adding the following argument to an existing protoc
// command:
//
-// --gitaly_lint_out=.
+// --gitaly_lint_out=.
//
// For example, you may add the linter as an argument to the command responsible
// for generating Go code:
//
-// protoc --go_out=. --gitaly_lint_out=. *.proto
+// protoc --go_out=. --gitaly_lint_out=. *.proto
//
// Or, you can run the Gitaly linter by itself. To try out, run the following
// command while in the project root:
//
-// protoc --gitaly_lint_out=. ./go/internal/cmd/protoc-gen-gitaly-lint/testdata/incomplete.proto
+// protoc --gitaly_lint_out=. ./go/internal/cmd/protoc-gen-gitaly-lint/testdata/incomplete.proto
//
// You should see some errors printed to screen for improperly written
// RPC's in the incomplete.proto file.
//
-// Prerequisites
+// # Prerequisites
//
// The protobuf compiler (protoc) can be obtained from the GitHub page:
// https://github.com/protocolbuffers/protobuf/releases
//
-// Background
+// # Background
//
// The protobuf compiler accepts plugins to analyze protobuf files and generate
// language specific code.
//
// These plugins require the following executable naming convention:
//
-// protoc-gen-$NAME
+// protoc-gen-$NAME
//
// Where $NAME is the plugin name of the compiler desired. The protobuf compiler
// will search the PATH until an executable with that name is found for a
// desired plugin. For example, the following protoc command:
//
-// protoc --gitaly_lint_out=. *.proto
+// protoc --gitaly_lint_out=. *.proto
//
-// The above will search the PATH for an executable named protoc-gen-gitaly-lint
+// # The above will search the PATH for an executable named protoc-gen-gitaly-lint
//
// The plugin accepts a protobuf message in STDIN that describes the parsed
// protobuf files. A response is sent back on STDOUT that contains any errors.
diff --git a/tools/protoc-gen-gitaly-lint/method.go b/tools/protoc-gen-gitaly-lint/method.go
index 39329b521..5d2c00741 100644
--- a/tools/protoc-gen-gitaly-lint/method.go
+++ b/tools/protoc-gen-gitaly-lint/method.go
@@ -32,8 +32,8 @@ func (ml methodLinter) validateAccessor() error {
}
// validateMutator will ensure the following rules:
-// - Mutator RPC's with repository level scope must specify a target repo
-// - Mutator RPC's without target repo must not be scoped at repo level
+// - Mutator RPC's with repository level scope must specify a target repo
+// - Mutator RPC's without target repo must not be scoped at repo level
func (ml methodLinter) validateMutator() error {
switch scope := ml.opMsg.GetScopeLevel(); scope {
diff --git a/tools/protoc-gen-gitaly-protolist/main.go b/tools/protoc-gen-gitaly-protolist/main.go
index 7e775360e..c05facdae 100644
--- a/tools/protoc-gen-gitaly-protolist/main.go
+++ b/tools/protoc-gen-gitaly-protolist/main.go
@@ -3,7 +3,7 @@
//
// This plugin can be accessed by invoking the protoc compiler with the following arguments:
//
-// protoc --plugin=protoc-gen-gitaly-protolist --gitaly_protolist_out=.
+// protoc --plugin=protoc-gen-gitaly-protolist --gitaly_protolist_out=.
//
// The plugin accepts a protobuf message in STDIN that describes the parsed protobuf files. A
// response is sent back on STDOUT that contains any errors.