code: func resetInstance() error {
  	if !env.OnGCE() {
  		return errors.New("cannot reset instance if not on GCE")
  	}
  
  	ctx := context.Background()
  
  	inst, err := gceInstance()
  	if err != nil {
  		return err
  	}
  	cs, projectID, zone, name := inst.cis, inst.projectID, inst.zone, inst.name
  
  	call := cs.Reset(projectID, zone, name).Context(ctx)
  	op, err := call.Do()
  	if err != nil {
  		if googleapi.IsNotModified(err) {
  			return nil
  		}
  		return fmt.Errorf("error resetting instance: %v", err)
  	}
  	// TODO(mpl): refactor this whole pattern below into a func
  	opName := op.Name
  	for {
  		select {
  		case <-ctx.Done():
  			return ctx.Err()
  		case <-time.After(500 * time.Millisecond):
  		}
  		op, err := inst.cs.ZoneOperations.Get(projectID, zone, opName).Context(ctx).Do()
  		if err != nil {
  			return fmt.Errorf("failed to get op %s: %v", opName, err)
  		}
  		switch op.Status {
  		case "PENDING", "RUNNING":
  			continue
  		case "DONE":
  			if op.Error != nil {
  				for _, operr := range op.Error.Errors {
  					log.Printf("operation error: %+v", operr)
  				}
  				return fmt.Errorf("operation error: %v", op.Error.Errors[0])
  			}
  			log.Print("Successfully reset instance")
  			return nil
  		default:
  			return fmt.Errorf("unknown operation status %q: %+v", op.Status, op)
  		}
  	}
  }
docs: // resetInstance reboots the GCE VM that this process is running in.