diff options
Diffstat (limited to 'internal')
54 files changed, 77 insertions, 77 deletions
diff --git a/internal/backup/sink_test.go b/internal/backup/sink_test.go index 5eb337147..4c5942492 100644 --- a/internal/backup/sink_test.go +++ b/internal/backup/sink_test.go @@ -39,7 +39,7 @@ func TestResolveSink(t *testing.T) { "type": "service_account", "project_id": "hostfactory-179005", "private_key_id": "6253b144ccd94f50ce1224a73ffc48bda256d0a7", - "private_key": "-----BEGIN PRIVATE KEY-----\nXXXX<KEY CONTENT OMMIT HERR> \n-----END PRIVATE KEY-----\n", + "private_key": "-----BEGIN PRIVATE KEY-----\nXXXX<KEY CONTENT OMIT HERE> \n-----END PRIVATE KEY-----\n", "client_email": "303721356529-compute@developer.gserviceaccount.com", "client_id": "116595416948414952474", "auth_uri": "https://accounts.google.com/o/oauth2/auth", diff --git a/internal/cli/praefect/serve.go b/internal/cli/praefect/serve.go index 74f155e3e..cf9d84b57 100644 --- a/internal/cli/praefect/serve.go +++ b/internal/cli/praefect/serve.go @@ -344,7 +344,7 @@ func server( } else { if conf.Failover.Enabled { logger.WithField("election_strategy", conf.Failover.ElectionStrategy).Warn( - "Deprecated election stategy in use, migrate to repository specific primary nodes following https://docs.gitlab.com/ee/administration/gitaly/praefect.html#migrate-to-repository-specific-primary-gitaly-nodes. The other election strategies are scheduled for removal in GitLab 14.0.") + "Deprecated election strategy in use, migrate to repository specific primary nodes following https://docs.gitlab.com/ee/administration/gitaly/praefect.html#migrate-to-repository-specific-primary-gitaly-nodes. The other election strategies are scheduled for removal in GitLab 14.0.") } nodeMgr, err := nodes.NewManager(logger, conf, db, csg, nodeLatencyHistogram, protoregistry.GitalyProtoPreregistered, errTracker, clientHandshaker, sidechannelRegistry) diff --git a/internal/cli/praefect/subcmd_list_storages.go b/internal/cli/praefect/subcmd_list_storages.go index 816a811bf..c2b89202c 100644 --- a/internal/cli/praefect/subcmd_list_storages.go +++ b/internal/cli/praefect/subcmd_list_storages.go @@ -18,7 +18,7 @@ Returns a table with the following columns: - VIRTUAL_STORAGE: Name of the virtual storage Praefect provides to clients. - NODE: Name the physical storage connected to the virtual storage. -- ADDRESS: Address of the Gitaly node that manages the physial storage for the virtual storage. +- ADDRESS: Address of the Gitaly node that manages the physical storage for the virtual storage. If the virtual-storage flag: diff --git a/internal/cli/praefect/subcmd_set_replication_factor_test.go b/internal/cli/praefect/subcmd_set_replication_factor_test.go index d2f3615cf..7c70d28ca 100644 --- a/internal/cli/praefect/subcmd_set_replication_factor_test.go +++ b/internal/cli/praefect/subcmd_set_replication_factor_test.go @@ -30,7 +30,7 @@ func TestSetReplicationFactorSubcommand(t *testing.T) { }{ { desc: "unexpected positional arguments", - args: []string{"-virtual-storage=virtual-storage", "-relative-path=relative-path", "-replication-factor=1", "positonal-arg"}, + args: []string{"-virtual-storage=virtual-storage", "-relative-path=relative-path", "-replication-factor=1", "positional-arg"}, error: cli.Exit(unexpectedPositionalArgsError{Command: "set-replication-factor"}, 1), }, { diff --git a/internal/cli/praefect/subcmd_sql_migrate_test.go b/internal/cli/praefect/subcmd_sql_migrate_test.go index 880c01555..387dd7588 100644 --- a/internal/cli/praefect/subcmd_sql_migrate_test.go +++ b/internal/cli/praefect/subcmd_sql_migrate_test.go @@ -33,7 +33,7 @@ func TestSubCmdSqlMigrate(t *testing.T) { }{ { desc: "unexpected positional arguments", - args: []string{"positonal-arg"}, + args: []string{"positional-arg"}, expectedErr: cli.Exit(unexpectedPositionalArgsError{Command: "sql-migrate"}, 1), }, { diff --git a/internal/git/command.go b/internal/git/command.go index f5645fc96..d14568856 100644 --- a/internal/git/command.go +++ b/internal/git/command.go @@ -18,7 +18,7 @@ var ( // Command represent a Git command. type Command struct { - // Name is the name of the Git command to run, e.g. "log", "cat-flie" or "worktree". + // Name is the name of the Git command to run, e.g. "log", "cat-file" or "worktree". Name string // Action is the action of the Git command, e.g. "set-url" in `git remote set-url` Action string diff --git a/internal/git/gittest/command.go b/internal/git/gittest/command.go index c5eef143c..c917388e9 100644 --- a/internal/git/gittest/command.go +++ b/internal/git/gittest/command.go @@ -128,7 +128,7 @@ type RepositoryPathExecutor struct { factory git.CommandFactory } -// NewRepositoryPathExecutor creates a new ReposiotryPathExecutor for the given repository. +// NewRepositoryPathExecutor creates a new RepositoryPathExecutor for the given repository. func NewRepositoryPathExecutor(tb testing.TB, cfg config.Cfg, repoPath string) RepositoryPathExecutor { relativePath, err := filepath.Rel(cfg.Storages[0].Path, repoPath) require.NoError(tb, err) diff --git a/internal/git/gittest/commit_test.go b/internal/git/gittest/commit_test.go index 4f35f7ad2..9efb5a9ac 100644 --- a/internal/git/gittest/commit_test.go +++ b/internal/git/gittest/commit_test.go @@ -69,7 +69,7 @@ func TestWriteCommit(t *testing.T) { }, "\n"), }, { - desc: "with commiter", + desc: "with committer", opts: []WriteCommitOption{ WithCommitterName("John Doe"), WithCommitterDate(time.Date(2005, 4, 7, 15, 13, 13, 0, time.FixedZone("UTC-7", -7*60*60))), diff --git a/internal/git/gittest/tree_test.go b/internal/git/gittest/tree_test.go index c922deb31..35d37ef0f 100644 --- a/internal/git/gittest/tree_test.go +++ b/internal/git/gittest/tree_test.go @@ -120,7 +120,7 @@ func TestWriteTree(t *testing.T) { }, }, { - desc: "two entries with nonexistant objects", + desc: "two entries with nonexistent objects", entries: []TreeEntry{ { OID: git.ObjectID(strings.Repeat("1", DefaultObjectHash.Hash().Size()*2)), diff --git a/internal/git/housekeeping/clean_stale_data.go b/internal/git/housekeeping/clean_stale_data.go index 22149d639..a425449e3 100644 --- a/internal/git/housekeeping/clean_stale_data.go +++ b/internal/git/housekeeping/clean_stale_data.go @@ -290,7 +290,7 @@ func findStaleFiles(repoPath string, gracePeriod time.Duration, files ...string) } // findStaleLockfiles finds a subset of lockfiles which may be created by git -// commands. We're quite conservative with what we're removing, we certaintly +// commands. We're quite conservative with what we're removing, we certainly // don't just scan the repo for `*.lock` files. Instead, we only remove a known // set of lockfiles which have caused problems in the past. func findStaleLockfiles(ctx context.Context, repoPath string) ([]string, error) { diff --git a/internal/git/housekeeping/objects.go b/internal/git/housekeeping/objects.go index d83a13ef5..c3d4c3696 100644 --- a/internal/git/housekeeping/objects.go +++ b/internal/git/housekeeping/objects.go @@ -153,7 +153,7 @@ func RepackObjects(ctx context.Context, repo *localrepo.Repo, cfg RepackObjectsC }, }, // Note: we explicitly do not pass `GetRepackGitConfig()` here as none of - // its opitons apply to this kind of repack: we have no delta islands given + // its options apply to this kind of repack: we have no delta islands given // that we do not walk the revision graph, and we won't ever write bitmaps. git.WithStderr(&stderr), ); err != nil { diff --git a/internal/git/housekeeping/optimize_repository.go b/internal/git/housekeeping/optimize_repository.go index 1dc0d9337..0396d39ad 100644 --- a/internal/git/housekeeping/optimize_repository.go +++ b/internal/git/housekeeping/optimize_repository.go @@ -160,7 +160,7 @@ func optimizeRepository( timer := prometheus.NewTimer(m.tasksLatency.WithLabelValues("clean-stale-data")) if err := m.CleanStaleData(ctx, repo, DefaultStaleDataCleanup()); err != nil { - return fmt.Errorf("could not execute houskeeping: %w", err) + return fmt.Errorf("could not execute housekeeping: %w", err) } timer.ObserveDuration() diff --git a/internal/git/localrepo/commit.go b/internal/git/localrepo/commit.go index 2f77069ef..bdb7bb990 100644 --- a/internal/git/localrepo/commit.go +++ b/internal/git/localrepo/commit.go @@ -21,13 +21,13 @@ import ( ) var ( - // ErrMissingTree indicates a missing tree when attemping to write a commit + // ErrMissingTree indicates a missing tree when attempting to write a commit ErrMissingTree = errors.New("missing tree") // ErrMissingCommitterName indicates an attempt to write a commit without a - // comitter name + // committer name ErrMissingCommitterName = errors.New("missing committer name") // ErrMissingAuthorName indicates an attempt to write a commit without a - // comitter name + // committer name ErrMissingAuthorName = errors.New("missing author name") // ErrDisallowedCharacters indicates the name and/or email contains disallowed // characters diff --git a/internal/git/localrepo/merge.go b/internal/git/localrepo/merge.go index c721268ba..44bbae3ef 100644 --- a/internal/git/localrepo/merge.go +++ b/internal/git/localrepo/merge.go @@ -167,7 +167,7 @@ func parseMergeTreeError(objectHash git.ObjectHash, cfg mergeTreeConfig, output } fields := strings.Split(infoMsg, "\x00") - // The git output contains a null characted at the end, which creates a stray empty field. + // The git output contains a null character at the end, which creates a stray empty field. fields = fields[:len(fields)-1] for i := 0; i < len(fields); { diff --git a/internal/git/localrepo/tree.go b/internal/git/localrepo/tree.go index b436e4c56..ed8464999 100644 --- a/internal/git/localrepo/tree.go +++ b/internal/git/localrepo/tree.go @@ -504,7 +504,7 @@ func (t *TreeEntry) populate( stack := treeStack{t} - // The outpout of ls-tree -r is the following: + // The output of ls-tree -r is the following: // a1 // dir1/file2 // dir2/file3 diff --git a/internal/git/localrepo/tree_test.go b/internal/git/localrepo/tree_test.go index 3e7398f18..a68999d12 100644 --- a/internal/git/localrepo/tree_test.go +++ b/internal/git/localrepo/tree_test.go @@ -1393,7 +1393,7 @@ func TestTreeEntry_Delete(t *testing.T) { }, }, { - desc: "nested tree with only single childs", + desc: "nested tree with only single child", tree: &TreeEntry{ Type: Tree, Mode: "040000", diff --git a/internal/git/updateref/updateref.go b/internal/git/updateref/updateref.go index 9979e7d83..b8a86df1d 100644 --- a/internal/git/updateref/updateref.go +++ b/internal/git/updateref/updateref.go @@ -360,7 +360,7 @@ func (u *Updater) checkState(expected state) error { return nil } -// Start begins a new reference transaction. The reference changes are not perfromed until Commit +// Start begins a new reference transaction. The reference changes are not performed until Commit // is explicitly called. func (u *Updater) Start() error { if err := u.expectState(stateIdle); err != nil { diff --git a/internal/gitaly/gitalyclient/upload_pack.go b/internal/gitaly/gitalyclient/upload_pack.go index bd4f697c8..48ca39eca 100644 --- a/internal/gitaly/gitalyclient/upload_pack.go +++ b/internal/gitaly/gitalyclient/upload_pack.go @@ -66,7 +66,7 @@ func UploadPackWithSidechannel( return stream.ProxyPktLine(c, stdin, stdout, stderr) }) defer func() { - // We aleady check the error further down. + // We already check the error further down. _ = wt.Close() }() diff --git a/internal/gitaly/service/conflicts/resolve_conflicts_test.go b/internal/gitaly/service/conflicts/resolve_conflicts_test.go index 65c5fd71b..ac7faff31 100644 --- a/internal/gitaly/service/conflicts/resolve_conflicts_test.go +++ b/internal/gitaly/service/conflicts/resolve_conflicts_test.go @@ -1320,7 +1320,7 @@ func testResolveConflicts(t *testing.T, ctx context.Context) { skipCommitCheck: true, additionalChecks: func() { objectsAfter := len(strings.Split(text.ChompBytes(gittest.Exec(t, cfg, "-C", repoPath, "rev-list", "--objects", "--all")), "\n")) - require.Equal(t, objectsBefore, objectsAfter, "No new objets should've been added") + require.Equal(t, objectsBefore, objectsAfter, "No new objects should've been added") }, } }, diff --git a/internal/gitaly/service/objectpool/create.go b/internal/gitaly/service/objectpool/create.go index 29691d41f..53d52cdc8 100644 --- a/internal/gitaly/service/objectpool/create.go +++ b/internal/gitaly/service/objectpool/create.go @@ -32,7 +32,7 @@ func (s *server) CreateObjectPool(ctx context.Context, in *gitalypb.CreateObject // repoutil.Create creates the repositories in a temporary directory. This means the repository is not created in the location // expected by the transaction manager. This makes sense without transactions, but with transactions, there's no real point in // doing so given a failed transaction's state is anyway removed. Creating the repository in a temporary directory is problematic - // as the reference transcation hook is invoked for the repository from unexpected location, causing the transaction to fail to + // as the reference transaction hook is invoked for the repository from unexpected location, causing the transaction to fail to // associate the reference updates with the repository. // // Run the repository creation without the transaction in the context. The transactions reads the created repository's state from diff --git a/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go b/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go index 4e1a5343e..574e3b596 100644 --- a/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go +++ b/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go @@ -125,7 +125,7 @@ func TestFetchIntoObjectPool_transactional(t *testing.T) { poolProto, pool, poolPath := createObjectPool(t, ctx, cfg, repo) - // Inject transaction information so that FetchInotObjectPool knows to perform + // Inject transaction information so that FetchIntoObjectPool knows to perform // transactional voting. ctx, err = txinfo.InjectTransaction(peer.NewContext(ctx, &peer.Peer{}), 1, "node", true) require.NoError(t, err) diff --git a/internal/gitaly/service/operations/merge_to_ref_test.go b/internal/gitaly/service/operations/merge_to_ref_test.go index 28863e136..3781ffd71 100644 --- a/internal/gitaly/service/operations/merge_to_ref_test.go +++ b/internal/gitaly/service/operations/merge_to_ref_test.go @@ -218,7 +218,7 @@ func testUserMergeToRefConflicts(t *testing.T, ctx context.Context) { require.False(t, hasRevision, "branch should not have been created") }) - t.Run("target reference is ambigous", func(t *testing.T) { + t.Run("target reference is ambiguous", func(t *testing.T) { gittest.WriteRef(t, cfg, repoPath, "refs/merge-requests/x/written-before", right) request := &gitalypb.UserMergeToRefRequest{ diff --git a/internal/gitaly/service/operations/revert.go b/internal/gitaly/service/operations/revert.go index 90d03a7dd..98efe8e84 100644 --- a/internal/gitaly/service/operations/revert.go +++ b/internal/gitaly/service/operations/revert.go @@ -199,7 +199,7 @@ func (s *Server) UserRevert(ctx context.Context, req *gitalypb.UserRevertRequest // housekeeping. func (s *Server) writeCommitWithEmptyTree(ctx context.Context, quarantineRepo *localrepo.Repo) (git.ObjectID, error) { const fakeName = "GitLab Bot" - const fakcEmail = "gitlab-bot@gitlab.com" + const fakeEmail = "gitlab-bot@gitlab.com" fakeDate := time.Unix(694540800, 0).UTC() hash, err := quarantineRepo.ObjectHash(ctx) @@ -209,10 +209,10 @@ func (s *Server) writeCommitWithEmptyTree(ctx context.Context, quarantineRepo *l return quarantineRepo.WriteCommit(ctx, localrepo.WriteCommitConfig{ AuthorName: fakeName, - AuthorEmail: fakcEmail, + AuthorEmail: fakeEmail, AuthorDate: fakeDate, CommitterName: fakeName, - CommitterEmail: fakcEmail, + CommitterEmail: fakeEmail, CommitterDate: fakeDate, TreeID: hash.EmptyTreeOID, }) diff --git a/internal/gitaly/service/operations/squash_test.go b/internal/gitaly/service/operations/squash_test.go index 1225c1a05..80b613e9d 100644 --- a/internal/gitaly/service/operations/squash_test.go +++ b/internal/gitaly/service/operations/squash_test.go @@ -260,7 +260,7 @@ func testUserSquashStableID(t *testing.T, ctx context.Context) { startCommitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithParents(baseCommitID)) midCommitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithParents(startCommitID)) endTreeID := gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{ - {Path: "path", Mode: "100644", Content: "contnet"}, + {Path: "path", Mode: "100644", Content: "content"}, }) endCommitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithParents(midCommitID), gittest.WithTree(endTreeID)) @@ -281,8 +281,8 @@ func testUserSquashStableID(t *testing.T, ctx context.Context) { require.NoError(t, err) require.Equal(t, &gitalypb.GitCommit{ Id: gittest.ObjectHashDependent(t, map[string]string{ - "sha1": "9b09504be226a140ca5335bfbfd70bea049233c6", - "sha256": "879204016902e3773af456d01465da8749adb17bdc3a974d5500231b80d497fa", + "sha1": "81a602b7dbbc79e6aae871477d62902c61373741", + "sha256": "fe8de63f9481d39a3db08ebf1ce692844eb35fef6d5baf9ccc748f97d079ff54", }), TreeId: endTreeID.String(), ParentIds: []string{ diff --git a/internal/gitaly/service/ref/find_all_tags_test.go b/internal/gitaly/service/ref/find_all_tags_test.go index 91288dca5..13a8c4b5d 100644 --- a/internal/gitaly/service/ref/find_all_tags_test.go +++ b/internal/gitaly/service/ref/find_all_tags_test.go @@ -350,7 +350,7 @@ type commit tag signed-tag tagger Some Author <some.author@example.com> 100000000 +0100 gpgsig -----BEGIN PGP SIGNATURE----- - this is a pseude PGP signature + this is a pseudo PGP signature -----END PGP SIGNATURE----- signed tag message diff --git a/internal/gitaly/service/ref/find_tag_test.go b/internal/gitaly/service/ref/find_tag_test.go index 7439358f2..3e1df7d00 100644 --- a/internal/gitaly/service/ref/find_tag_test.go +++ b/internal/gitaly/service/ref/find_tag_test.go @@ -315,7 +315,7 @@ type commit tag signed-tag tagger Some Author <some.author@example.com> 100000000 +0100 gpgsig -----BEGIN PGP SIGNATURE----- - this is a pseude PGP signature + this is a pseudo PGP signature -----END PGP SIGNATURE----- signed tag message diff --git a/internal/gitaly/service/repository/create_repository_from_snapshot_test.go b/internal/gitaly/service/repository/create_repository_from_snapshot_test.go index a0dee4caa..11feb1117 100644 --- a/internal/gitaly/service/repository/create_repository_from_snapshot_test.go +++ b/internal/gitaly/service/repository/create_repository_from_snapshot_test.go @@ -249,7 +249,7 @@ func TestCreateRepositoryFromSnapshot_malformedArchive(t *testing.T) { // to https://gitlab.com/gitlab-org/gitaly/-/issues/5503. _, sourceRepoPath := gittest.CreateRepository(t, ctx, cfg) gittest.WriteCommit(t, cfg, sourceRepoPath, gittest.WithBranch(git.DefaultBranch), gittest.WithTreeEntries( - gittest.TreeEntry{Path: "blob", Mode: "100644", Content: string(uncompressibleData(16 * 1024))}, + gittest.TreeEntry{Path: "blob", Mode: "100644", Content: string(incompressibleData(16 * 1024))}, )) data, _ := generateTarFile(t, sourceRepoPath) diff --git a/internal/gitaly/service/repository/fetch_remote_test.go b/internal/gitaly/service/repository/fetch_remote_test.go index 6f0c1ea17..c11328cec 100644 --- a/internal/gitaly/service/repository/fetch_remote_test.go +++ b/internal/gitaly/service/repository/fetch_remote_test.go @@ -623,7 +623,7 @@ Issue: https://gitlab.com/gitlab-org/gitaly/-/issues/3780`) setup: func(t *testing.T, cfg config.Cfg) setupData { // We set up two branches in both repositories: // - // - "main" diverges as both repostiories have different commits on + // - "main" diverges as both repositories have different commits on // it. // - "branch" does not diverge, but is out-of-date in the local // repository. diff --git a/internal/gitaly/service/repository/size_test.go b/internal/gitaly/service/repository/size_test.go index d955d33ad..1684793b0 100644 --- a/internal/gitaly/service/repository/size_test.go +++ b/internal/gitaly/service/repository/size_test.go @@ -38,7 +38,7 @@ Object pools are not yet supported with transaction management.`) // a packfile or otherwise it won't get pulled into the object pool. We thus repack the repository first before // linking it to the pool repository. gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(git.DefaultBranch), gittest.WithTreeEntries( - gittest.TreeEntry{Mode: "100644", Path: "16kbblob", Content: string(uncompressibleData(16 * 1000))}, + gittest.TreeEntry{Mode: "100644", Path: "16kbblob", Content: string(incompressibleData(16 * 1000))}, )) gittest.Exec(t, cfg, "-C", repoPath, "repack", "-Adl") requireRepositorySize(t, ctx, client, repo, 17) @@ -66,15 +66,15 @@ func TestRepositorySize_normalRepository(t *testing.T) { requireRepositorySize(t, ctx, client, repo, 0) // When writing a largish blob into the repository it's expected to grow. - gittest.WriteBlob(t, cfg, repoPath, uncompressibleData(16*1024)) + gittest.WriteBlob(t, cfg, repoPath, incompressibleData(16*1024)) requireRepositorySize(t, ctx, client, repo, 16) // Also, updating any other files should cause a size increase. - require.NoError(t, os.WriteFile(filepath.Join(repoPath, "packed-refs"), uncompressibleData(7*1024), perm.PrivateFile)) + require.NoError(t, os.WriteFile(filepath.Join(repoPath, "packed-refs"), incompressibleData(7*1024), perm.PrivateFile)) requireRepositorySize(t, ctx, client, repo, 23) // Even garbage should increase the size. - require.NoError(t, os.WriteFile(filepath.Join(repoPath, "garbage"), uncompressibleData(5*1024), perm.PrivateFile)) + require.NoError(t, os.WriteFile(filepath.Join(repoPath, "garbage"), incompressibleData(5*1024), perm.PrivateFile)) requireRepositorySize(t, ctx, client, repo, 28) } @@ -169,7 +169,7 @@ func TestGetObjectDirectorySize_successful(t *testing.T) { requireObjectDirectorySize(t, ctx, client, repo, 0) // Writing an object into the repository should increase the size accordingly. - gittest.WriteBlob(t, cfg, repoPath, uncompressibleData(16*1024)) + gittest.WriteBlob(t, cfg, repoPath, incompressibleData(16*1024)) requireObjectDirectorySize(t, ctx, client, repo, 16) } @@ -184,7 +184,7 @@ func TestGetObjectDirectorySize_quarantine(t *testing.T) { t.Run("quarantined repo", func(t *testing.T) { repo, repoPath := gittest.CreateRepository(t, ctx, cfg) repo.GitObjectDirectory = "objects/" - gittest.WriteBlob(t, cfg, repoPath, uncompressibleData(16*1024)) + gittest.WriteBlob(t, cfg, repoPath, incompressibleData(16*1024)) // Rails sends the repository's relative path from the access checks as provided by Gitaly. If transactions are enabled, // this is the snapshot's relative path. Include the metadata in the test as well as we're testing requests with quarantine @@ -274,10 +274,10 @@ func requireObjectDirectorySize(tb testing.TB, ctx context.Context, client gital require.Equal(tb, expectedSize, response.GetSize()) } -// uncompressibleData returns data that will not be easily compressible by Git. This is required because +// incompressibleData returns data that will not be easily compressible by Git. This is required because // well-compressible objects would not lead to a repository size increase due to the zlib compression used for Git // objects. -func uncompressibleData(bytes int) []byte { +func incompressibleData(bytes int) []byte { data := make([]byte, bytes) _, _ = rand.Read(data[:]) return data diff --git a/internal/gitaly/storage/metadata_test.go b/internal/gitaly/storage/metadata_test.go index 78b0f5ff9..fd7beefcf 100644 --- a/internal/gitaly/storage/metadata_test.go +++ b/internal/gitaly/storage/metadata_test.go @@ -22,7 +22,7 @@ func readFilesystemID(t *testing.T, path string) string { return metadata["gitaly_filesystem_id"] } -func TestWriteMetdataFile(t *testing.T) { +func TestWriteMetadataFile(t *testing.T) { tempDir := testhelper.TempDir(t) require.NoError(t, WriteMetadataFile(tempDir)) diff --git a/internal/gitaly/storage/storagemgr/partition_manager.go b/internal/gitaly/storage/storagemgr/partition_manager.go index 045da1d0a..ad36f4f5e 100644 --- a/internal/gitaly/storage/storagemgr/partition_manager.go +++ b/internal/gitaly/storage/storagemgr/partition_manager.go @@ -178,7 +178,7 @@ func (sm *storageManager) newFinalizableTransaction(ptn *partition, tx *Transact type partition struct { // closing is closed when the partition has no longer any active transactions. closing chan struct{} - // transactionManagerClosed is closed to signal when the partition's TranscationManager.Run has returned. + // transactionManagerClosed is closed to signal when the partition's TransactionManager.Run has returned. // Clients stumbling on the partition when it is closing wait on this channel to know when the previous // TransactionManager has closed and it is safe to start another one. transactionManagerClosed chan struct{} diff --git a/internal/gitaly/storage/storagemgr/transaction_manager.go b/internal/gitaly/storage/storagemgr/transaction_manager.go index 59dce61cd..bd7653a04 100644 --- a/internal/gitaly/storage/storagemgr/transaction_manager.go +++ b/internal/gitaly/storage/storagemgr/transaction_manager.go @@ -200,7 +200,7 @@ type Transaction struct { // Transaction queues in admissionQueue to be committed, and is considered admitted once it has // been dequeued by TransactionManager.Run(). Once the transaction is admitted, its ownership moves // from the client goroutine to the TransactionManager.Run() goroutine, and the client goroutine must - // not do any modifications to the state of the transcation anymore to avoid races. + // not do any modifications to the state of the transaction anymore to avoid races. admitted bool // finish cleans up the transaction releasing the resources associated with it. It must be called // once the transaction is done with. @@ -1417,7 +1417,7 @@ func (mgr *TransactionManager) isClosing() bool { } } -// initialize initializes the TransactionManager's state from the database. It loads the appendend and the applied +// initialize initializes the TransactionManager's state from the database. It loads the appended and the applied // LSNs and initializes the notification channels that synchronize transaction beginning with log entry applying. func (mgr *TransactionManager) initialize(ctx context.Context) error { defer close(mgr.initialized) @@ -1444,7 +1444,7 @@ func (mgr *TransactionManager) initialize(ctx context.Context) error { mgr.appendedLSN = mgr.appliedLSN - // The iterator seeks to a key that is greater than or equal than seeked key. Since we are doing a reverse + // The iterator seeks to a key that is greater than or equal than sought key. Since we are doing a reverse // seek, we need to add 0xff to the prefix so the first iterated key is the latest log entry. if iterator.Seek(append(logPrefix, 0xff)); iterator.Valid() { mgr.appendedLSN = LSN(binary.BigEndian.Uint64(bytes.TrimPrefix(iterator.Item().Key(), logPrefix))) @@ -1785,7 +1785,7 @@ func (mgr *TransactionManager) verifyReferencesWithGit(ctx context.Context, refe return nil } -// verifyDefaultBranchUpdate verifies the default branch referance update. This is done by first checking if it is one of +// verifyDefaultBranchUpdate verifies the default branch reference update. This is done by first checking if it is one of // the references in the current transaction which is not scheduled to be deleted. If not, we check if its a valid reference // name in the repository. We don't do reference name validation because any reference going through the transaction manager // has name validation and we can rely on that. diff --git a/internal/gitaly/storage/storagemgr/transaction_manager_hook_test.go b/internal/gitaly/storage/storagemgr/transaction_manager_hook_test.go index c21df6497..63679547c 100644 --- a/internal/gitaly/storage/storagemgr/transaction_manager_hook_test.go +++ b/internal/gitaly/storage/storagemgr/transaction_manager_hook_test.go @@ -18,7 +18,7 @@ import ( // influence the execution of the test. type hookFunc func(hookContext) -// hookContext are the control toggels available in a hook. +// hookContext are the control toggles available in a hook. type hookContext struct { // closeManager calls the calls Close on the TransactionManager. closeManager func() @@ -28,7 +28,7 @@ type hookContext struct { } // hooks are functions that get invoked at specific points of the TransactionManager Run method. They allow -// for hooking into the Run method at specific poins which would otherwise to do assertions that would otherwise +// for hooking into the Run method at specific points which would otherwise to do assertions that would otherwise // not be possible. type hooks struct { // beforeReadLogEntry is invoked before a log entry is read from the database. diff --git a/internal/grpc/client/dial.go b/internal/grpc/client/dial.go index a4f076c3a..b87eba079 100644 --- a/internal/grpc/client/dial.go +++ b/internal/grpc/client/dial.go @@ -156,7 +156,7 @@ func Dial(ctx context.Context, rawAddress string, opts ...DialOption) (*grpc.Cli } else { certPool, err := gitalyx509.SystemCertPool() if err != nil { - return nil, fmt.Errorf("failed to get system certificat pool for 'tls' connection: %w", err) + return nil, fmt.Errorf("failed to get system certificate pool for 'tls' connection: %w", err) } transportCredentials = credentials.NewTLS(&tls.Config{ diff --git a/internal/grpc/middleware/limithandler/middleware.go b/internal/grpc/middleware/limithandler/middleware.go index 7ea9064e9..24993d40e 100644 --- a/internal/grpc/middleware/limithandler/middleware.go +++ b/internal/grpc/middleware/limithandler/middleware.go @@ -35,7 +35,7 @@ type LimiterMiddleware struct { } // New creates a new middleware that limits requests. SetupFunc sets up the -// middlware with a specific kind of limiter. +// middleware with a specific kind of limiter. func New(cfg config.Cfg, getLockKey GetLockKey, setupMiddleware SetupFunc) *LimiterMiddleware { middleware := &LimiterMiddleware{ getLockKey: getLockKey, diff --git a/internal/grpc/middleware/sentryhandler/sentryhandler_test.go b/internal/grpc/middleware/sentryhandler/sentryhandler_test.go index 1edbd4033..12e8f5a31 100644 --- a/internal/grpc/middleware/sentryhandler/sentryhandler_test.go +++ b/internal/grpc/middleware/sentryhandler/sentryhandler_test.go @@ -105,7 +105,7 @@ func TestGenerateSentryEvent(t *testing.T) { expectedEvent: nil, }, { - desc: "DeadlineExceeded erorr is ignored", + desc: "DeadlineExceeded error is ignored", method: "/gitaly.RepoService/RepoExists", err: status.Errorf(codes.DeadlineExceeded, "Something failed"), expectedEvent: nil, diff --git a/internal/grpc/proxy/peeker.go b/internal/grpc/proxy/peeker.go index 6825d7f37..645c4d618 100644 --- a/internal/grpc/proxy/peeker.go +++ b/internal/grpc/proxy/peeker.go @@ -32,7 +32,7 @@ func newPeeker(stream grpc.ServerStream) *peeker { } // ErrInvalidPeekCount indicates the director function requested an invalid -// peek quanity +// peek quantity var ErrInvalidPeekCount = errors.New("peek count must be greater than zero") func (p peeker) Peek() ([]byte, error) { diff --git a/internal/grpc/sidechannel/sidechannel_test.go b/internal/grpc/sidechannel/sidechannel_test.go index 14a49afa6..ea096f9da 100644 --- a/internal/grpc/sidechannel/sidechannel_test.go +++ b/internal/grpc/sidechannel/sidechannel_test.go @@ -185,7 +185,7 @@ func call(ctx context.Context, conn *grpc.ClientConn, registry *Registry, handle ctxOut, waiter := RegisterSidechannel(ctx, registry, handler) defer func() { - // We aleady check the error further down. + // We already check the error further down. _ = waiter.Close() }() diff --git a/internal/helper/env/env.go b/internal/helper/env/env.go index 92173d335..f8efa6bab 100644 --- a/internal/helper/env/env.go +++ b/internal/helper/env/env.go @@ -67,7 +67,7 @@ func GetString(name string, fallback string) string { } // ExtractValue returns the value of the environment variable with the given key. The given key -// should not have a trailing "=". If the same key occurrs multiple times in the environment, then +// should not have a trailing "=". If the same key occurs multiple times in the environment, then // any later occurrences will override previous ones. func ExtractValue(environment []string, key string) string { var value string diff --git a/internal/helper/text/random.go b/internal/helper/text/random.go index 5b9f9a714..3f5641660 100644 --- a/internal/helper/text/random.go +++ b/internal/helper/text/random.go @@ -6,7 +6,7 @@ import ( "io" ) -// RandomHex returns an n-byte hexademical random string. +// RandomHex returns an n-byte hexadecimal random string. func RandomHex(n int) (string, error) { buf := make([]byte, n) if _, err := io.ReadFull(rand.Reader, buf); err != nil { diff --git a/internal/limiter/resizable_semaphore_test.go b/internal/limiter/resizable_semaphore_test.go index 6c0e47df5..86921de6a 100644 --- a/internal/limiter/resizable_semaphore_test.go +++ b/internal/limiter/resizable_semaphore_test.go @@ -107,7 +107,7 @@ func testResizableSemaphoreCanceledWhenNotFull(t *testing.T, ctx context.Context func testResizableSemaphoreCanceledWhenFull(t *testing.T, ctx context.Context, stopContext context.CancelFunc, expectedErr error) { semaphore := NewResizableSemaphore(5) - // Try to acquire a token of the empty sempahore + // Try to acquire a token of the empty semaphore require.Nil(t, semaphore.TryAcquire()) semaphore.Release() @@ -129,7 +129,7 @@ func testResizableSemaphoreCanceledWhenFull(t *testing.T, ctx context.Context, s } acquireWg1.Wait() - // Another 5 waits for sempahore + // Another 5 waits for semaphore var acquireWg2 sync.WaitGroup for i := 0; i < 5; i++ { acquireWg2.Add(1) diff --git a/internal/log/configure.go b/internal/log/configure.go index da3eda3aa..231bb7541 100644 --- a/internal/log/configure.go +++ b/internal/log/configure.go @@ -42,7 +42,7 @@ func Configure(out io.Writer, format string, level string, hooks ...logrus.Hook) } if !SkipReplacingGlobalLoggers { - // Replace the logrus standar logger. While we shouldn't ever be using it in our own codebase, there + // Replace the logrus standard logger. While we shouldn't ever be using it in our own codebase, there // will very likely be cases where dependencies use it. // //nolint:forbidigo diff --git a/internal/praefect/assignment.go b/internal/praefect/assignment.go index 1aa6447ad..c2c9b19c0 100644 --- a/internal/praefect/assignment.go +++ b/internal/praefect/assignment.go @@ -22,7 +22,7 @@ func NewDisabledAssignmentStore(storages map[string][]string) AssignmentStore { return disabledAssignments(storages) } -// GetHostAssigments simply returns all of the storages configured for the virtual storage. +// GetHostAssignments simply returns all of the storages configured for the virtual storage. func (storages disabledAssignments) GetHostAssignments(ctx context.Context, virtualStorage string, repositoryID int64) ([]string, error) { return storages[virtualStorage], nil } diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go index 7ada12e4a..03f9e0df2 100644 --- a/internal/praefect/coordinator.go +++ b/internal/praefect/coordinator.go @@ -618,7 +618,7 @@ func streamParametersContext(ctx context.Context) context.Context { // world view of which features are enabled and which ones aren't and ideally do the same // thing. // - // This problem isn't solveable on Gitaly side, but Praefect is in a perfect position to do + // This problem isn't solvable on Gitaly side, but Praefect is in a perfect position to do // so. While it may have the same problem in a load-balanced multi-Praefect setup, this is // much less of a problem: the most important thing is that the view on feature flags is // consistent for a single RPC call, and that will always be the case regardless of which @@ -1141,7 +1141,7 @@ func (c *Coordinator) newRequestFinalizer( } // The cancellation signal is suppressed earlier in the function, so we'd return no error if the - // orignal context exceeded its deadline while running the request finalizer. If there were + // original context exceeded its deadline while running the request finalizer. If there were // no other errors, return the possible error from the context so we don't return OK code for // failed requests. return originalCtx.Err() diff --git a/internal/praefect/nodes/per_repository.go b/internal/praefect/nodes/per_repository.go index 0b1682f73..a07946303 100644 --- a/internal/praefect/nodes/per_repository.go +++ b/internal/praefect/nodes/per_repository.go @@ -50,7 +50,7 @@ func (pr *PerRepositoryElector) GetPrimary(ctx context.Context, virtualStorage s // 1. `election`, as this indicates this transaction re-elected the primary and the CTE now contains the most // recent change // 2. `reread`, as this indicates a concurrent transaction had potentially changed the primary. - // 3. `snapshot`, if the current primary was valid in the transcation's database snapshot. + // 3. `snapshot`, if the current primary was valid in the transaction's database snapshot. var current, previous sql.NullString if err := pr.db.QueryRowContext(ctx, ` WITH reread AS ( diff --git a/internal/praefect/reconciler/reconciler_test.go b/internal/praefect/reconciler/reconciler_test.go index 230447d88..10b06b709 100644 --- a/internal/praefect/reconciler/reconciler_test.go +++ b/internal/praefect/reconciler/reconciler_test.go @@ -1055,16 +1055,16 @@ func TestReconciler(t *testing.T) { t.Helper() runCtx, cancelRun := context.WithCancel(ctx) - var stopped, resetted bool + var stopped, reset bool ticker := helper.NewManualTicker() ticker.StopFunc = func() { stopped = true } ticker.ResetFunc = func() { - if resetted { + if reset { cancelRun() return } - resetted = true + reset = true ticker.Tick() } @@ -1079,7 +1079,7 @@ func TestReconciler(t *testing.T) { require.Equal(t, context.Canceled, reconciler.Run(runCtx, ticker)) require.True(t, stopped) - require.True(t, resetted) + require.True(t, reset) } for vs, repos := range tc.deletedRepositories { diff --git a/internal/praefect/replicator_test.go b/internal/praefect/replicator_test.go index 68ba3f314..c81341012 100644 --- a/internal/praefect/replicator_test.go +++ b/internal/praefect/replicator_test.go @@ -847,7 +847,7 @@ func TestProcessBacklog_ReplicatesToReadOnlyPrimary(t *testing.T) { ctx, cancel := context.WithCancel(testhelper.Context(t)) defer cancel() - const virtualStorage = "virtal-storage" + const virtualStorage = "virtual-storage" const primaryStorage = "storage-1" const secondaryStorage = "storage-2" const repositoryID = 1 diff --git a/internal/praefect/repocleaner/repository_test.go b/internal/praefect/repocleaner/repository_test.go index 94501ea6c..3d45a27c3 100644 --- a/internal/praefect/repocleaner/repository_test.go +++ b/internal/praefect/repocleaner/repository_test.go @@ -163,13 +163,13 @@ func TestRunner_Run(t *testing.T) { var iteration int32 runner := NewRunner(cfg, logger, praefect.StaticHealthChecker{virtualStorage: []string{storage1, storage2, storage3}}, nodeSet.Connections(), storageCleanup, storageCleanup, actionStub{ - PerformMethod: func(ctx context.Context, argVirtualStoage, argStorage string, notExisting []string) error { + PerformMethod: func(ctx context.Context, argVirtualStorage, argStorage string, notExisting []string) error { // There should be three iterations, as each storage has // one repository that is unused by praefect. atomic.AddInt32(&iteration, 1) i := atomic.LoadInt32(&iteration) - assert.Equal(t, virtualStorage, argVirtualStoage) + assert.Equal(t, virtualStorage, argVirtualStorage) assert.Equal(t, []string{"repo-4.git"}, notExisting) if i == 3 { diff --git a/internal/praefect/server.go b/internal/praefect/server.go index c52b160f5..af4c74f0f 100644 --- a/internal/praefect/server.go +++ b/internal/praefect/server.go @@ -105,7 +105,7 @@ func WithStreamInterceptor(interceptor grpc.StreamServerInterceptor) ServerOptio } } -// NewGRPCServer returns gRPC server wuth registered proxy-handler and actual services praefect serves on its own. +// NewGRPCServer returns gRPC server with registered proxy-handler and actual services praefect serves on its own. // It includes a set of unary and stream interceptors required to add logging, authentication, etc. func NewGRPCServer( deps *Dependencies, diff --git a/internal/safe/file_writer.go b/internal/safe/file_writer.go index 76ab0bcc2..bf18a440f 100644 --- a/internal/safe/file_writer.go +++ b/internal/safe/file_writer.go @@ -65,7 +65,7 @@ func (fw *FileWriter) Write(p []byte) (n int, err error) { // Commit will close the temporary file and rename it to the target file name // the first call to Commit() will close and delete the temporary file, so -// subsequently calls to Commit() are gauaranteed to return an error. +// subsequently calls to Commit() are guaranteed to return an error. func (fw *FileWriter) Commit() error { err := ErrAlreadyDone diff --git a/internal/streamcache/cache.go b/internal/streamcache/cache.go index ad365c2f6..094dfec93 100644 --- a/internal/streamcache/cache.go +++ b/internal/streamcache/cache.go @@ -298,7 +298,7 @@ func (c *cache) newEntry(key string, create func(io.Writer) error) (_ io.ReadClo // Every entry gets a unique underlying file. We do not want to reuse // existing cache files because we do not know whether they are the - // result of a succesfull call to create. + // result of a successful call to create. // // This may sound like we should be using an anonymous tempfile, but that // would be at odds with the requirement to be able to open and close diff --git a/internal/streamcache/min_occurences.go b/internal/streamcache/min_occurrences.go index d48e37e95..d48e37e95 100644 --- a/internal/streamcache/min_occurences.go +++ b/internal/streamcache/min_occurrences.go diff --git a/internal/testhelper/directory.go b/internal/testhelper/directory.go index 58d540d51..f66862c76 100644 --- a/internal/testhelper/directory.go +++ b/internal/testhelper/directory.go @@ -49,7 +49,7 @@ func RequireDirectoryState(tb testing.TB, rootDirectory, relativeDirectory strin trimmedPath := strings.TrimPrefix(path, rootDirectory) if trimmedPath == "" { // Store the walked directory itself as "/". Less confusing than having it be - // an emptry string. + // an empty string. trimmedPath = string(os.PathSeparator) } diff --git a/internal/transaction/txinfo/transaction.go b/internal/transaction/txinfo/transaction.go index 3f21bbd92..a198b2abe 100644 --- a/internal/transaction/txinfo/transaction.go +++ b/internal/transaction/txinfo/transaction.go @@ -60,9 +60,9 @@ func transactionFromSerialized(serialized string) (Transaction, error) { } // InjectTransaction injects reference transaction metadata into an incoming context -func InjectTransaction(ctx context.Context, tranasctionID uint64, node string, primary bool) (context.Context, error) { +func InjectTransaction(ctx context.Context, transactionID uint64, node string, primary bool) (context.Context, error) { transaction := Transaction{ - ID: tranasctionID, + ID: transactionID, Node: node, Primary: primary, } |