Skip to content

Commit 7fe8357

Browse files
committed
Better short name
1 parent 1971292 commit 7fe8357

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

internal/codespaces/api/api.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,14 +524,14 @@ type getCodespaceRepositoryContentsResponse struct {
524524
Content string `json:"content"`
525525
}
526526

527-
func (a *API) GetCodespaceRepositoryContents(ctx context.Context, codespace *codespace.Codespace, path string) ([]byte, error) {
528-
req, err := http.NewRequest(http.MethodGet, a.githubAPI+"/repos/"+codespace.RepositoryNWO+"/contents/"+path, nil)
527+
func (a *API) GetCodespaceRepositoryContents(ctx context.Context, cs *codespace.Codespace, path string) ([]byte, error) {
528+
req, err := http.NewRequest(http.MethodGet, a.githubAPI+"/repos/"+cs.RepositoryNWO+"/contents/"+path, nil)
529529
if err != nil {
530530
return nil, fmt.Errorf("error creating request: %w", err)
531531
}
532532

533533
q := req.URL.Query()
534-
q.Add("ref", codespace.Branch)
534+
q.Add("ref", cs.Branch)
535535
req.URL.RawQuery = q.Encode()
536536

537537
a.setHeaders(req)

internal/codespaces/states.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ type PostCreateState struct {
3737
// PollPostCreateStates watches for state changes in a codespace,
3838
// and calls the supplied poller for each batch of state changes.
3939
// It runs until it encounters an error, including cancellation of the context.
40-
func PollPostCreateStates(ctx context.Context, log logger, apiClient apiClient, user *api.User, c *codespace.Codespace, poller func([]PostCreateState)) (err error) {
41-
token, err := apiClient.GetCodespaceToken(ctx, user.Login, c.Name)
40+
func PollPostCreateStates(ctx context.Context, log logger, apiClient apiClient, user *api.User, cs *codespace.Codespace, poller func([]PostCreateState)) (err error) {
41+
token, err := apiClient.GetCodespaceToken(ctx, user.Login, cs.Name)
4242
if err != nil {
4343
return fmt.Errorf("getting codespace token: %w", err)
4444
}
4545

46-
session, err := ConnectToLiveshare(ctx, log, apiClient, user.Login, token, c)
46+
session, err := ConnectToLiveshare(ctx, log, apiClient, user.Login, token, cs)
4747
if err != nil {
4848
return fmt.Errorf("connect to Live Share: %w", err)
4949
}

pkg/cmd/codespace/ports.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ type portAttribute struct {
119119
Label string `json:"label"`
120120
}
121121

122-
func getDevContainer(ctx context.Context, apiClient apiClient, codespace *codespace.Codespace) <-chan devContainerResult {
122+
func getDevContainer(ctx context.Context, apiClient apiClient, cs *codespace.Codespace) <-chan devContainerResult {
123123
ch := make(chan devContainerResult, 1)
124124
go func() {
125-
contents, err := apiClient.GetCodespaceRepositoryContents(ctx, codespace, ".devcontainer/devcontainer.json")
125+
contents, err := apiClient.GetCodespaceRepositoryContents(ctx, cs, ".devcontainer/devcontainer.json")
126126
if err != nil {
127127
ch <- devContainerResult{nil, fmt.Errorf("error getting content: %w", err)}
128128
return

0 commit comments

Comments
 (0)