func loginWithContext(ctx context.Context, st *state, info *Info) error {
	result := make(chan error, 1)
	go func() {
		result <- st.Login(info.Tag, info.Password, info.Nonce, info.Macaroons)
	}()
	select {
	case err := <-result:
		return errors.Trace(err)
	case <-ctx.Done():
		return errors.Annotatef(ctx.Err(), "cannot log in")
	}
}
// loginWithContext wraps st.Login with code that terminates
// if the context is cancelled.
// TODO(rogpeppe) pass Context into Login (and all API calls) so
// that this becomes unnecessary.
loginWithContext wraps st.Login with code that terminates
if the context is cancelled.
TODO(rogpeppe) pass Context into Login (and all API calls) so
that this becomes unnecessary.
// loginWithContext wraps st . Login with code that terminates // if the context is cancelled . // TODO ( rogpeppe ) pass Context into Login ( and all API calls ) so // that this becomes unnecessary .
func loginWithContext(ctx context.Context, st *state, info *Info) error {
	result := make(chan error, 1)
	go func() {
		result <- st.Login(info.Tag, info.Password, info.Nonce, info.Macaroons)
	}()
	select {
	case err := <-result:
		return errors.Trace(err)
	case <-ctx.Done():
		return errors.Annotatef(ctx.Err(), "cannot log in")
	}
}
func loginWithContext ( ctx context . Context , st * state , info * Info ) error { result := make ( chan error , 1 ) go func ( ) { result <- st . Login ( info . Tag , info . Password , info . Nonce , info . Macaroons ) } ( ) select { case err := <- result : return errors . Trace ( err ) case <- ctx . Done ( ) : return errors . Annotatef ( ctx . Err ( ) , " " ) } }
loginWithContext wraps st.Login with code that terminates
if the context is cancelled.
loginWithContext wraps st . Login with code that terminates if the context is cancelled .