appengine_gen2_flex.go 840 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2018 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. //go:build !appengine
  5. // +build !appengine
  6. // This file applies to App Engine second generation runtimes (>= Go 1.11) and App Engine flexible.
  7. package google
  8. import (
  9. "context"
  10. "log"
  11. "sync"
  12. "golang.org/x/oauth2"
  13. )
  14. var logOnce sync.Once // only spam about deprecation once
  15. // See comment on AppEngineTokenSource in appengine.go.
  16. func appEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {
  17. logOnce.Do(func() {
  18. log.Print("google: AppEngineTokenSource is deprecated on App Engine standard second generation runtimes (>= Go 1.11) and App Engine flexible. Please use DefaultTokenSource or ComputeTokenSource.")
  19. })
  20. return ComputeTokenSource("")
  21. }