code: func (a *Authenticator) effectiveLoginMode() (lm LoginMode) {
  	// a.opts.Method is modified under a lock, need to grab the lock to avoid a
  	// race. Note that a.loginMode is immutable and can be read outside the
  	// lock. We skip the locking if we know for sure that the return value will be
  	// same as a.loginMode (which is the case for a.loginMode != OptionalLogin).
  	lm = a.loginMode
  	if lm == OptionalLogin {
  		a.lock.RLock()
  		if a.opts.Method == ServiceAccountMethod {
  			lm = SilentLogin
  		}
  		a.lock.RUnlock()
  	}
  	return
  }
docs: // effectiveLoginMode returns a login mode to use, considering what kind of a
  // token provider is being used.
  //
  // See comments for OptionalLogin for more info. The gist of it: we treat
  // OptionalLogin as SilentLogin when using a service account private key.