Skip to content

Commit a10d689

Browse files
committed
Fix typos and refactor function naming
Correct typos across multiple files and standardize function names for consistency. These changes improve maintainability and readability of the codebase.
1 parent 318c5a6 commit a10d689

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

.github/workflows/typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ EDE = "EDE"
2323
# HELO is an SMTP command
2424
HELO = "HELO"
2525
LKE = "LKE"
26+
byt = "byt"
2627

2728
[files]
2829
extend-exclude = [

coderd/database/dbmem/dbmem.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ func minTime(t, u time.Time) time.Time {
941941
return u
942942
}
943943

944-
func provisonerJobStatus(j database.ProvisionerJob) database.ProvisionerJobStatus {
944+
func provisionerJobStatus(j database.ProvisionerJob) database.ProvisionerJobStatus {
945945
if isNotNull(j.CompletedAt) {
946946
if j.Error.String != "" {
947947
return database.ProvisionerJobStatusFailed
@@ -1202,7 +1202,7 @@ func (q *FakeQuerier) AcquireProvisionerJob(_ context.Context, arg database.Acqu
12021202
provisionerJob.StartedAt = arg.StartedAt
12031203
provisionerJob.UpdatedAt = arg.StartedAt.Time
12041204
provisionerJob.WorkerID = arg.WorkerID
1205-
provisionerJob.JobStatus = provisonerJobStatus(provisionerJob)
1205+
provisionerJob.JobStatus = provisionerJobStatus(provisionerJob)
12061206
q.provisionerJobs[index] = provisionerJob
12071207
// clone the Tags before returning, since maps are reference types and
12081208
// we don't want the caller to be able to mutate the map we have inside
@@ -7456,7 +7456,7 @@ func (q *FakeQuerier) InsertProvisionerJob(_ context.Context, arg database.Inser
74567456
Tags: maps.Clone(arg.Tags),
74577457
TraceMetadata: arg.TraceMetadata,
74587458
}
7459-
job.JobStatus = provisonerJobStatus(job)
7459+
job.JobStatus = provisionerJobStatus(job)
74607460
q.provisionerJobs = append(q.provisionerJobs, job)
74617461
return job, nil
74627462
}
@@ -8842,7 +8842,7 @@ func (q *FakeQuerier) UpdateProvisionerJobByID(_ context.Context, arg database.U
88428842
continue
88438843
}
88448844
job.UpdatedAt = arg.UpdatedAt
8845-
job.JobStatus = provisonerJobStatus(job)
8845+
job.JobStatus = provisionerJobStatus(job)
88468846
q.provisionerJobs[index] = job
88478847
return nil
88488848
}
@@ -8863,7 +8863,7 @@ func (q *FakeQuerier) UpdateProvisionerJobWithCancelByID(_ context.Context, arg
88638863
}
88648864
job.CanceledAt = arg.CanceledAt
88658865
job.CompletedAt = arg.CompletedAt
8866-
job.JobStatus = provisonerJobStatus(job)
8866+
job.JobStatus = provisionerJobStatus(job)
88678867
q.provisionerJobs[index] = job
88688868
return nil
88698869
}
@@ -8886,7 +8886,7 @@ func (q *FakeQuerier) UpdateProvisionerJobWithCompleteByID(_ context.Context, ar
88868886
job.CompletedAt = arg.CompletedAt
88878887
job.Error = arg.Error
88888888
job.ErrorCode = arg.ErrorCode
8889-
job.JobStatus = provisonerJobStatus(job)
8889+
job.JobStatus = provisionerJobStatus(job)
88908890
q.provisionerJobs[index] = job
88918891
return nil
88928892
}

coderd/httpmw/workspaceproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func ExtractWorkspaceProxy(opts ExtractWorkspaceProxyConfig) func(http.Handler)
148148

149149
type workspaceProxyParamContextKey struct{}
150150

151-
// WorkspaceProxyParam returns the worksace proxy from the ExtractWorkspaceProxyParam handler.
151+
// WorkspaceProxyParam returns the workspace proxy from the ExtractWorkspaceProxyParam handler.
152152
func WorkspaceProxyParam(r *http.Request) database.WorkspaceProxy {
153153
user, ok := r.Context().Value(workspaceProxyParamContextKey{}).(database.WorkspaceProxy)
154154
if !ok {

coderd/unhanger/detector.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ func (acquireLockError) Error() string {
5757
return "lock is held by another client"
5858
}
5959

60-
// jobInelligibleError is returned when a job is not eligible to be terminated
60+
// jobIneligibleError is returned when a job is not eligible to be terminated
6161
// anymore.
62-
type jobInelligibleError struct {
62+
type jobIneligibleError struct {
6363
Err error
6464
}
6565

6666
// Error implements error.
67-
func (e jobInelligibleError) Error() string {
67+
func (e jobIneligibleError) Error() string {
6868
return fmt.Sprintf("job is no longer eligible to be terminated: %s", e.Err)
6969
}
7070

@@ -198,7 +198,7 @@ func (d *Detector) run(t time.Time) Stats {
198198

199199
err := unhangJob(ctx, log, d.db, d.pubsub, job.ID)
200200
if err != nil {
201-
if !(xerrors.As(err, &acquireLockError{}) || xerrors.As(err, &jobInelligibleError{})) {
201+
if !(xerrors.As(err, &acquireLockError{}) || xerrors.As(err, &jobIneligibleError{})) {
202202
log.Error(ctx, "error forcefully terminating hung provisioner job", slog.Error(err))
203203
}
204204
continue
@@ -233,17 +233,17 @@ func unhangJob(ctx context.Context, log slog.Logger, db database.Store, pub pubs
233233
if !job.StartedAt.Valid {
234234
// This shouldn't be possible to hit because the query only selects
235235
// started and not completed jobs, and a job can't be "un-started".
236-
return jobInelligibleError{
236+
return jobIneligibleError{
237237
Err: xerrors.New("job is not started"),
238238
}
239239
}
240240
if job.CompletedAt.Valid {
241-
return jobInelligibleError{
241+
return jobIneligibleError{
242242
Err: xerrors.Errorf("job is completed (status %s)", job.JobStatus),
243243
}
244244
}
245245
if job.UpdatedAt.After(time.Now().Add(-HungJobDuration)) {
246-
return jobInelligibleError{
246+
return jobIneligibleError{
247247
Err: xerrors.New("job has been updated recently"),
248248
}
249249
}

0 commit comments

Comments
 (0)