Correct some typos

This commit is contained in:
Alexander Seiler 2023-04-21 03:51:31 +02:00
parent 09e86d0ebf
commit 218f29f296
No known key found for this signature in database
GPG key ID: 50E2FE77CB57B3B7
20 changed files with 37 additions and 37 deletions

View file

@ -47,9 +47,9 @@ type sanitizer struct {
addEscape bool
}
// Transform uses a sliding window alogorithm to detect C0 and C1
// Transform uses a sliding window algorithm to detect C0 and C1
// ASCII control sequences as they are read and replaces them
// with equivelent inert characters. Characters that are not part
// with equivalent inert characters. Characters that are not part
// of a control sequence are not modified.
func (t *sanitizer) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
lSrc := len(src)

View file

@ -303,7 +303,7 @@ func TestClientCurrentBranch(t *testing.T) {
wantBranch: "branch\u00A0with\u00A0non\u00A0breaking\u00A0space",
},
{
name: "detatched head",
name: "detached head",
cmdExitStatus: 1,
wantCmdArgs: `path/to/git symbolic-ref --quiet HEAD`,
wantErrorMsg: "failed to run git: not on any branch",
@ -339,7 +339,7 @@ func TestClientShowRefs(t *testing.T) {
wantErrorMsg string
}{
{
name: "show refs with one vaid ref and one invalid ref",
name: "show refs with one valid ref and one invalid ref",
cmdExitStatus: 128,
cmdStdout: "9ea76237a557015e73446d33268569a114c0649c refs/heads/valid",
cmdStderr: "fatal: 'refs/heads/invalid' - not a valid ref",

View file

@ -122,7 +122,7 @@ func (a *API) GetUser(ctx context.Context) (*User, error) {
var response User
if err := json.Unmarshal(b, &response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
return &response, nil
@ -160,7 +160,7 @@ func (a *API) GetRepository(ctx context.Context, nwo string) (*Repository, error
var response Repository
if err := json.Unmarshal(b, &response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
return &response, nil
@ -336,7 +336,7 @@ func (a *API) ListCodespaces(ctx context.Context, opts ListCodespacesOptions) (c
dec := json.NewDecoder(resp.Body)
if err := dec.Decode(&response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
nextURL := findNextPage(resp.Header.Get("Link"))
@ -398,7 +398,7 @@ func (a *API) GetOrgMemberCodespace(ctx context.Context, orgName string, userNam
dec := json.NewDecoder(resp.Body)
if err := dec.Decode(&response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
for _, cs := range response.Codespaces {
@ -455,7 +455,7 @@ func (a *API) GetCodespace(ctx context.Context, codespaceName string, includeCon
var response Codespace
if err := json.Unmarshal(b, &response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
return &response, nil
@ -563,7 +563,7 @@ func (a *API) GetCodespacesMachines(ctx context.Context, repoID int, branch, loc
Machines []*Machine `json:"machines"`
}
if err := json.Unmarshal(b, &response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
return response.Machines, nil
@ -636,7 +636,7 @@ func (a *API) GetCodespaceRepoSuggestions(ctx context.Context, partialSearch str
Items []*Repository `json:"items"`
}
if err := json.Unmarshal(b, &response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
repoNames := make([]string, len(response.Items))
@ -683,7 +683,7 @@ func (a *API) GetCodespaceBillableOwner(ctx context.Context, nwo string) (*User,
}
}
if err := json.Unmarshal(b, &response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
// While this response contains further helpful information ahead of codespace creation,
@ -815,7 +815,7 @@ func (a *API) startCreate(ctx context.Context, params *CreateCodespaceParams) (*
var response Codespace
if err := json.Unmarshal(b, &response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
return &response, errProvisioningInProgress // RPC finished before result of creation known
@ -831,7 +831,7 @@ func (a *API) startCreate(ctx context.Context, params *CreateCodespaceParams) (*
return nil, fmt.Errorf("error reading response body: %w", err)
}
if err := json.Unmarshal(b, &ue); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
if ue.AllowPermissionsURL != "" {
@ -853,7 +853,7 @@ func (a *API) startCreate(ctx context.Context, params *CreateCodespaceParams) (*
var response Codespace
if err := json.Unmarshal(b, &response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
return &response, nil
@ -934,7 +934,7 @@ func (a *API) ListDevContainers(ctx context.Context, repoID int, branch string,
dec := json.NewDecoder(resp.Body)
if err := dec.Decode(&response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
nextURL := findNextPage(resp.Header.Get("Link"))
@ -1007,7 +1007,7 @@ func (a *API) EditCodespace(ctx context.Context, codespaceName string, params *E
var response Codespace
if err := json.Unmarshal(b, &response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
return &response, nil
@ -1055,7 +1055,7 @@ func (a *API) GetCodespaceRepositoryContents(ctx context.Context, codespace *Cod
var response getCodespaceRepositoryContentsResponse
if err := json.Unmarshal(b, &response); err != nil {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
return nil, fmt.Errorf("error unmarshalling response: %w", err)
}
decoded, err := base64.StdEncoding.DecodeString(response.Content)

View file

@ -21,7 +21,7 @@ func generateCodespaceList(start int, end int) []*Codespace {
return codespacesList
}
func createFakeListEndpointServer(t *testing.T, initalTotal int, finalTotal int) *httptest.Server {
func createFakeListEndpointServer(t *testing.T, initialTotal int, finalTotal int) *httptest.Server {
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/user/codespaces" {
t.Fatal("Incorrect path")
@ -48,7 +48,7 @@ func createFakeListEndpointServer(t *testing.T, initalTotal int, finalTotal int)
switch page {
case 1:
response.Codespaces = generateCodespaceList(0, per_page)
response.TotalCount = initalTotal
response.TotalCount = initialTotal
w.Header().Set("Link", fmt.Sprintf(`<http://%[1]s/user/codespaces?page=3&per_page=%[2]d>; rel="last", <http://%[1]s/user/codespaces?page=2&per_page=%[2]d>; rel="next"`, r.Host, per_page))
case 2:
response.Codespaces = generateCodespaceList(per_page, per_page*2)

View file

@ -124,7 +124,7 @@ type AuthConfig struct {
// Token will retrieve the auth token for the given hostname,
// searching environment variables, plain text config, and
// lastly encypted storage.
// lastly encrypted storage.
func (c *AuthConfig) Token(hostname string) (string, string) {
if c.tokenOverride != nil {
return c.tokenOverride(hostname)

View file

@ -369,7 +369,7 @@ func Test_runBrowse(t *testing.T) {
opts: BrowseOptions{
SelectorArg: "chocolate-pecan-pie.txt",
},
baseRepo: ghrepo.New("andrewhsu", "recipies"),
baseRepo: ghrepo.New("andrewhsu", "recipes"),
defaultBranch: "",
wantsErr: true,
},

View file

@ -214,7 +214,7 @@ func getDevContainer(ctx context.Context, apiClient apiClient, codespace *api.Co
var container devContainer
if err := json.Unmarshal(convertedJSON, &container); err != nil {
ch <- devContainerResult{nil, fmt.Errorf("error unmarshaling: %w", err)}
ch <- devContainerResult{nil, fmt.Errorf("error unmarshalling: %w", err)}
return
}

View file

@ -225,7 +225,7 @@ func TestPendingOperationDisallowsListPorts(t *testing.T) {
}
}
func TestPendingOperationDisallowsUpdatePortVisability(t *testing.T) {
func TestPendingOperationDisallowsUpdatePortVisibility(t *testing.T) {
app := testingPortsApp()
selector := &CodespaceSelector{api: app.apiClient, codespaceName: "disabledCodespace"}

View file

@ -713,7 +713,7 @@ func TestManager_UpgradeExtension_BinaryExtension_Pinned(t *testing.T) {
assert.Equal(t, err, pinnedExtensionUpgradeError)
}
func TestManager_UpgradeExtenion_GitExtension_Pinned(t *testing.T) {
func TestManager_UpgradeExtension_GitExtension_Pinned(t *testing.T) {
tempDir := t.TempDir()
extDir := filepath.Join(tempDir, "extensions", "gh-remote")
assert.NoError(t, stubPinnedExtension(filepath.Join(extDir, "gh-remote"), "abcd1234"))

View file

@ -477,7 +477,7 @@ func (m *mergeContext) infof(format string, args ...interface{}) error {
return err
}
// Creates a new MergeConext from MergeOptions.
// Creates a new MergeContext from MergeOptions.
func NewMergeContext(opts *MergeOptions) (*mergeContext, error) {
findOptions := shared.FindOptions{
Selector: opts.SelectorArg,

View file

@ -35,7 +35,7 @@ func UpdateIssue(httpClient *http.Client, repo ghrepo.Interface, id string, isPR
}
}
// updateIssue mutation does not support ProjectsV2 so do them in a seperate request.
// updateIssue mutation does not support ProjectsV2 so do them in a separate request.
if options.Projects.Edited {
wg.Go(func() error {
apiClient := api.NewClientFromHTTP(httpClient)

View file

@ -114,7 +114,7 @@ func deleteRun(opts *DeleteOptions) error {
statusCode == http.StatusTemporaryRedirect ||
statusCode == http.StatusPermanentRedirect {
cs := opts.IO.ColorScheme()
fmt.Fprintf(opts.IO.ErrOut, "%s Failed to delete repository: %s has changed name or transfered ownership\n", cs.FailureIcon(), fullName)
fmt.Fprintf(opts.IO.ErrOut, "%s Failed to delete repository: %s has changed name or transferred ownership\n", cs.FailureIcon(), fullName)
return cmdutil.SilentError
}
}

View file

@ -157,11 +157,11 @@ func Test_deleteRun(t *testing.T) {
},
},
{
name: "repo transfered ownership",
name: "repo transferred ownership",
opts: &DeleteOptions{RepoArg: "OWNER/REPO", Confirmed: true},
wantErr: true,
errMsg: "SilentError",
wantStderr: "X Failed to delete repository: OWNER/REPO has changed name or transfered ownership\n",
wantStderr: "X Failed to delete repository: OWNER/REPO has changed name or transferred ownership\n",
httpStubs: func(reg *httpmock.Registry) {
reg.Register(
httpmock.REST("DELETE", "repos/OWNER/REPO"),

View file

@ -503,7 +503,7 @@ func logFilenameRegexp(job shared.Job, step shared.Step) *regexp.Regexp {
// ├── 1_stepname.txt
// └── 2_somestepname.txt
//
// It iterates through the list of jobs and trys to find the matching
// It iterates through the list of jobs and tries to find the matching
// log in the zip file. If the matching log is found it is attached
// to the job.
func attachRunLog(rlz *zip.ReadCloser, jobs []shared.Job) {

View file

@ -467,7 +467,7 @@ func (s *StatusGetter) LoadSearchResults() error {
case "PullRequest":
prs = append(prs, *node)
default:
return fmt.Errorf("unkown Assignments type: %q", node.Type)
return fmt.Errorf("unknown Assignments type: %q", node.Type)
}
}

View file

@ -24,7 +24,7 @@ func TestConnect(t *testing.T) {
joinWorkspace := func(conn *jsonrpc2.Conn, req *jsonrpc2.Request) (interface{}, error) {
var joinWorkspaceReq joinWorkspaceArgs
if err := json.Unmarshal(*req.Params, &joinWorkspaceReq); err != nil {
return nil, fmt.Errorf("error unmarshaling req: %w", err)
return nil, fmt.Errorf("error unmarshalling req: %w", err)
}
if joinWorkspaceReq.ID != opts.SessionID {
return nil, errors.New("connection session id does not match")

View file

@ -52,7 +52,7 @@ func (s *Session) WaitForPortNotification(ctx context.Context, port int, notifTy
notification := new(PortNotification)
if err := json.Unmarshal(*req.Params, &notification); err != nil {
select {
case errCh <- fmt.Errorf("error unmarshaling notification: %w", err):
case errCh <- fmt.Errorf("error unmarshalling notification: %w", err):
default:
}
return

View file

@ -51,7 +51,7 @@ func TestServerStartSharing(t *testing.T) {
startSharing := func(conn *jsonrpc2.Conn, req *jsonrpc2.Request) (interface{}, error) {
var args []interface{}
if err := json.Unmarshal(*req.Params, &args); err != nil {
return nil, fmt.Errorf("error unmarshaling request: %w", err)
return nil, fmt.Errorf("error unmarshalling request: %w", err)
}
if len(args) < 3 {
return nil, errors.New("not enough arguments to start sharing")

View file

@ -10,7 +10,7 @@ func WithoutIndentation() glamour.TermRendererOption {
}
// WithoutWrap is a rendering option that set the character limit for soft
// wraping the markdown rendering. There is a max limit of 120 characters.
// wrapping the markdown rendering. There is a max limit of 120 characters.
// If 0 is passed then wrapping is disabled.
func WithWrap(w int) glamour.TermRendererOption {
if w > 120 {

View file

@ -63,7 +63,7 @@ func (p printer) IsTTY() bool {
func (p *printer) AddField(s string, truncateFunc func(int, string) string, colorFunc func(string) string) {
if truncateFunc == nil {
// Disallow ever truncating the 1st colum or any URL value
// Disallow ever truncating the 1st column or any URL value
if p.colIndex == 0 || isURL(s) {
p.tp.AddField(s, tableprinter.WithTruncate(nil), tableprinter.WithColor(colorFunc))
} else {