• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2017 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
5package gensupport
6
7import (
8	"fmt"
9	"runtime"
10	"strings"
11)
12
13// GoogleClientHeader returns the value to use for the x-goog-api-client
14// header, which is used internally by Google.
15func GoogleClientHeader(generatorVersion, clientElement string) string {
16	elts := []string{"gl-go/" + strings.Replace(runtime.Version(), " ", "_", -1)}
17	if clientElement != "" {
18		elts = append(elts, clientElement)
19	}
20	elts = append(elts, fmt.Sprintf("gdcl/%s", generatorVersion))
21	return strings.Join(elts, " ")
22}
23