Skip to content

Commit c04763b

Browse files
committed
Fix lint and test
1 parent 084440c commit c04763b

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

auth/token_generator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ type iamSigner struct {
172172

173173
func newIAMSigner(ctx context.Context, config *internal.AuthConfig) (*iamSigner, error) {
174174
hc, _, err := internal.NewHTTPClient(ctx, config.Opts...)
175-
hc.Opts = []internal.HTTPOption{
176-
internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(config.Version)),
177-
}
178175
if err != nil {
179176
return nil, err
180177
}
178+
hc.Opts = []internal.HTTPOption{
179+
internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(config.Version)),
180+
}
181181

182182
return &iamSigner{
183183
mutex: &sync.Mutex{},

iid/iid.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ func NewClient(ctx context.Context, c *internal.InstanceIDConfig) (*Client, erro
116116
}
117117

118118
hc, _, err := internal.NewHTTPClient(ctx, c.Opts...)
119-
hc.Opts = []internal.HTTPOption{
120-
internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(c.Version)),
121-
}
122119
if err != nil {
123120
return nil, err
124121
}
122+
hc.Opts = []internal.HTTPOption{
123+
internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(c.Version)),
124+
}
125125

126126
hc.CreateErrFn = createError
127127
return &Client{

internal/http_client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ func retryNetworkAndHTTPErrors(statusCodes ...int) RetryCondition {
444444
}
445445
}
446446

447+
// GetMetricsHeader constructs header value for metrics attribution
447448
func GetMetricsHeader(sdkVersion string) string {
448449
goVersion := strings.TrimPrefix(runtime.Version(), "go")
449450
return fmt.Sprintf("gl-go/%s fire-admin/%s", goVersion, sdkVersion)

0 commit comments

Comments
 (0)