From 0fd76e66fc0552a513767f732174f71185139460 Mon Sep 17 00:00:00 2001 From: Emilio Garcia Date: Wed, 29 Jun 2022 16:00:21 -0400 Subject: [PATCH] clean up some style issues and exported functions that should be private --- .../integrationsupport/integrationsupport.go | 1 + v3/internal/jsonx/encode.go | 1 + v3/newrelic/internal_app_test.go | 20 +++++++++---------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/v3/internal/integrationsupport/integrationsupport.go b/v3/internal/integrationsupport/integrationsupport.go index 54c7e8151..e954d44d1 100644 --- a/v3/internal/integrationsupport/integrationsupport.go +++ b/v3/internal/integrationsupport/integrationsupport.go @@ -93,6 +93,7 @@ var DTEnabledCfgFn = func(cfg *newrelic.Config) { cfg.DistributedTracer.Enabled = true } +// AppLogEnabledCfgFn enables application logging features var AppLogEnabledCfgFn = func(cfg *newrelic.Config) { cfg.Enabled = false cfg.ApplicationLogging.Enabled = true diff --git a/v3/internal/jsonx/encode.go b/v3/internal/jsonx/encode.go index b72558801..5fa9235dd 100644 --- a/v3/internal/jsonx/encode.go +++ b/v3/internal/jsonx/encode.go @@ -118,6 +118,7 @@ func AppendFloat(buf *bytes.Buffer, x float64) error { return nil } +// AppendFloat32 appends a numeric literal representingthe value to buf. func AppendFloat32(buf *bytes.Buffer, x float32) error { var scratch [64]byte x64 := float64(x) diff --git a/v3/newrelic/internal_app_test.go b/v3/newrelic/internal_app_test.go index 366a7756b..da1a0275c 100644 --- a/v3/newrelic/internal_app_test.go +++ b/v3/newrelic/internal_app_test.go @@ -78,14 +78,14 @@ const ( SampleAppName = "my app" ) -// ExpectApp combines Application and Expect, for use in validating data in test apps -type ExpectApp struct { +// expectApp combines Application and Expect, for use in validating data in test apps +type expectApplication struct { internal.Expect *Application } -// NewTestApp creates an ExpectApp with the given ConnectReply function and Config function -func NewTestApp(replyfn func(*internal.ConnectReply), cfgFn ...ConfigOption) ExpectApp { +// newTestApp creates an ExpectApp with the given ConnectReply function and Config function +func newTestApp(replyfn func(*internal.ConnectReply), cfgFn ...ConfigOption) expectApplication { cfgFn = append(cfgFn, func(cfg *Config) { // Prevent spawning app goroutines in tests. @@ -104,17 +104,17 @@ func NewTestApp(replyfn func(*internal.ConnectReply), cfgFn ...ConfigOption) Exp internal.HarvestTesting(app.Private, replyfn) - return ExpectApp{ + return expectApplication{ Expect: app.Private.(internal.Expect), Application: app, } } -var SampleEverythingReplyFn = func(reply *internal.ConnectReply) { +var sampleEverythingReplyFn = func(reply *internal.ConnectReply) { reply.SetSampleEverything() } -var ConfigTestAppLogFn = func(cfg *Config) { +var configTestAppLogFn = func(cfg *Config) { cfg.Enabled = false cfg.ApplicationLogging.Enabled = true cfg.ApplicationLogging.Forwarding.Enabled = true @@ -122,9 +122,9 @@ var ConfigTestAppLogFn = func(cfg *Config) { } func TestRecordLog(t *testing.T) { - testApp := NewTestApp( - SampleEverythingReplyFn, - ConfigTestAppLogFn, + testApp := newTestApp( + sampleEverythingReplyFn, + configTestAppLogFn, ) time := int64(timeToUnixMilliseconds(time.Now()))