You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

94 lines
2.5 KiB

  1. // Copyright 2019 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Code generated by gapic-generator. DO NOT EDIT.
  15. // Package debugger is an auto-generated package for the
  16. // Stackdriver Debugger API.
  17. //
  18. // NOTE: This package is in alpha. It is not stable, and is likely to change.
  19. //
  20. // Examines the call stack and variables of a running application without
  21. // stopping or slowing it down.
  22. //
  23. // Use the client at cloud.google.com/go/cmd/go-cloud-debug-agent in preference to this.
  24. package debugger // import "cloud.google.com/go/debugger/apiv2"
  25. import (
  26. "context"
  27. "runtime"
  28. "strings"
  29. "unicode"
  30. "google.golang.org/grpc/metadata"
  31. )
  32. func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
  33. out, _ := metadata.FromOutgoingContext(ctx)
  34. out = out.Copy()
  35. for _, md := range mds {
  36. for k, v := range md {
  37. out[k] = append(out[k], v...)
  38. }
  39. }
  40. return metadata.NewOutgoingContext(ctx, out)
  41. }
  42. // DefaultAuthScopes reports the default set of authentication scopes to use with this package.
  43. func DefaultAuthScopes() []string {
  44. return []string{
  45. "https://www.googleapis.com/auth/cloud-platform",
  46. "https://www.googleapis.com/auth/cloud_debugger",
  47. }
  48. }
  49. // versionGo returns the Go runtime version. The returned string
  50. // has no whitespace, suitable for reporting in header.
  51. func versionGo() string {
  52. const develPrefix = "devel +"
  53. s := runtime.Version()
  54. if strings.HasPrefix(s, develPrefix) {
  55. s = s[len(develPrefix):]
  56. if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
  57. s = s[:p]
  58. }
  59. return s
  60. }
  61. notSemverRune := func(r rune) bool {
  62. return strings.IndexRune("0123456789.", r) < 0
  63. }
  64. if strings.HasPrefix(s, "go1") {
  65. s = s[2:]
  66. var prerelease string
  67. if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
  68. s, prerelease = s[:p], s[p:]
  69. }
  70. if strings.HasSuffix(s, ".") {
  71. s += "0"
  72. } else if strings.Count(s, ".") < 2 {
  73. s += ".0"
  74. }
  75. if prerelease != "" {
  76. s += "-" + prerelease
  77. }
  78. return s
  79. }
  80. return "UNKNOWN"
  81. }
  82. const versionClient = "20190306"