@@ -41,7 +41,6 @@ func newCreateCmd(app *App) *cobra.Command {
4141// Create creates a new Codespace
4242func (a * App ) Create (ctx context.Context , opts createOptions ) error {
4343 locationCh := getLocation (ctx , a .apiClient )
44- userCh := getUser (ctx , a .apiClient )
4544
4645 repo , err := getRepoName (opts .repo )
4746 if err != nil {
@@ -64,11 +63,6 @@ func (a *App) Create(ctx context.Context, opts createOptions) error {
6463 return fmt .Errorf ("error getting codespace region location: %w" , locationResult .Err )
6564 }
6665
67- userResult := <- userCh
68- if userResult .Err != nil {
69- return fmt .Errorf ("error getting codespace user: %w" , userResult .Err )
70- }
71-
7266 machine , err := getMachineName (ctx , a .apiClient , repository .ID , opts .machine , branch , locationResult .Location )
7367 if err != nil {
7468 return fmt .Errorf ("error getting machine type: %w" , err )
@@ -90,7 +84,7 @@ func (a *App) Create(ctx context.Context, opts createOptions) error {
9084 }
9185
9286 if opts .showStatus {
93- if err := a .showStatus (ctx , userResult . User , codespace ); err != nil {
87+ if err := a .showStatus (ctx , codespace ); err != nil {
9488 return fmt .Errorf ("show status: %w" , err )
9589 }
9690 }
@@ -102,7 +96,7 @@ func (a *App) Create(ctx context.Context, opts createOptions) error {
10296// showStatus polls the codespace for a list of post create states and their status. It will keep polling
10397// until all states have finished. Once all states have finished, we poll once more to check if any new
10498// states have been introduced and stop polling otherwise.
105- func (a * App ) showStatus (ctx context.Context , user * api. User , codespace * api.Codespace ) error {
99+ func (a * App ) showStatus (ctx context.Context , codespace * api.Codespace ) error {
106100 var (
107101 lastState codespaces.PostCreateState
108102 breakNextState bool
@@ -163,21 +157,6 @@ func (a *App) showStatus(ctx context.Context, user *api.User, codespace *api.Cod
163157 return nil
164158}
165159
166- type getUserResult struct {
167- User * api.User
168- Err error
169- }
170-
171- // getUser fetches the user record associated with the GITHUB_TOKEN
172- func getUser (ctx context.Context , apiClient apiClient ) <- chan getUserResult {
173- ch := make (chan getUserResult , 1 )
174- go func () {
175- user , err := apiClient .GetUser (ctx )
176- ch <- getUserResult {user , err }
177- }()
178- return ch
179- }
180-
181160type locationResult struct {
182161 Location string
183162 Err error
0 commit comments