Repository: atlassian/gostatsd
Pull request #348 (2020-10-07 19:00:57)

Move pool module to internal #347
I move pool module to internal.
I build, run application, and run tests and it looks fine, but I'm quite new in Go world ;) If you spot sth notify me, so I will fix it ASAP :) 


Patch:
diff --git a/pkg/statsd/lexer.go b/pkg/statsd/lexer.go
index 270b6ee..f6b4ca6 100644
--- a/pkg/statsd/lexer.go
+++ b/pkg/statsd/lexer.go
@@ -7,7 +7,7 @@ import (
 	"strconv"
 
 	"github.com/atlassian/gostatsd"
-	"github.com/atlassian/gostatsd/pkg/pool"
+	"github.com/atlassian/gostatsd/internal/pool"
 )
 
 type lexer struct {
diff --git a/pkg/statsd/parser.go b/pkg/statsd/parser.go
index 4b2ddf5..206eeed 100644
--- a/pkg/statsd/parser.go
+++ b/pkg/statsd/parser.go
@@ -12,7 +12,7 @@ import (
 	"golang.org/x/time/rate"
 
 	"github.com/atlassian/gostatsd"
-	"github.com/atlassian/gostatsd/pkg/pool"
+	"github.com/atlassian/gostatsd/internal/pool"
 	"github.com/atlassian/gostatsd/pkg/stats"
 )
 
diff --git a/pkg/statsd/receiver.go b/pkg/statsd/receiver.go
index ac206da..700d07b 100644
--- a/pkg/statsd/receiver.go
+++ b/pkg/statsd/receiver.go
@@ -10,8 +10,8 @@ import (
 	"github.com/sirupsen/logrus"
 
 	"github.com/atlassian/gostatsd"
+	"github.com/atlassian/gostatsd/internal/pool"
 	"github.com/atlassian/gostatsd/pkg/fakesocket"
-	"github.com/atlassian/gostatsd/pkg/pool"
 	"github.com/atlassian/gostatsd/pkg/stats"
 )
 


Test patch:
diff --git a/pkg/pool/datagram_buffer_pool.go b/internal/pool/datagram_buffer_pool.go
similarity index 100%
rename from pkg/pool/datagram_buffer_pool.go
rename to internal/pool/datagram_buffer_pool.go
diff --git a/pkg/pool/metric_pool.go b/internal/pool/metric_pool.go
similarity index 100%
rename from pkg/pool/metric_pool.go
rename to internal/pool/metric_pool.go
diff --git a/pkg/statsd/handler_backend_test.go b/pkg/statsd/handler_backend_test.go
index 1d806c1..023bb0f 100644
--- a/pkg/statsd/handler_backend_test.go
+++ b/pkg/statsd/handler_backend_test.go
@@ -163,11 +163,11 @@ func TestBackendHandlerDispatchMetricMapTerminates(t *testing.T) {
 	cancelFunc()
 	mm := gostatsd.NewMetricMap()
 	mm.Receive(&gostatsd.Metric{
-		Name:        "metric",
-		Value:       1,
-		Rate:        1,
-		Timestamp:   1,
-		Type:        gostatsd.COUNTER,
+		Name:      "metric",
+		Value:     1,
+		Rate:      1,
+		Timestamp: 1,
+		Type:      gostatsd.COUNTER,
 	})
 	// perWorkerBufferSize is 0 (blocking channel), and we never call BackendHandler.Run, so we can be sure to
 	// hit the "context has cancelled" code path.
diff --git a/pkg/statsd/handler_tags_test.go b/pkg/statsd/handler_tags_test.go
index 9ca10d4..ee7e32d 100644
--- a/pkg/statsd/handler_tags_test.go
+++ b/pkg/statsd/handler_tags_test.go
@@ -112,7 +112,7 @@ func TestTagStripMergesSets(t *testing.T) {
 
 	expected := gostatsd.NewMetricMap()
 	expected.Sets["metric"] = map[string]gostatsd.Set{
-		"key:value": {Timestamp: 20, Values: map[string]struct{}{"abc": {}, "def": {}}, Tags: gostatsd.Tags{"key:value"}},
+		"key:value":             {Timestamp: 20, Values: map[string]struct{}{"abc": {}, "def": {}}, Tags: gostatsd.Tags{"key:value"}},
 		"key3:value3,key:value": {Timestamp: 30, Values: map[string]struct{}{"ghi": {}}, Tags: gostatsd.Tags{"key3:value3", "key:value"}},
 	}
 
diff --git a/pkg/statsd/lexer_test.go b/pkg/statsd/lexer_test.go
index 7552f4b..7fde201 100644
--- a/pkg/statsd/lexer_test.go
+++ b/pkg/statsd/lexer_test.go
@@ -7,7 +7,7 @@ import (
 	"github.com/stretchr/testify/require"
 
 	"github.com/atlassian/gostatsd"
-	"github.com/atlassian/gostatsd/pkg/pool"
+	"github.com/atlassian/gostatsd/internal/pool"
 )
 
 func TestMetricsLexer(t *testing.T) {