Browse Source

Not exporting main struct

Piotr Czajkowski 1 year ago
parent
commit
f7235a9675
2 changed files with 7 additions and 8 deletions
  1. 6 7
      chunkOfSize.go
  2. 1 1
      chunkOfSize_test.go

+ 6 - 7
chunkOfSize.go

@@ -6,8 +6,7 @@ import (
 	"unicode/utf8"
 )
 
-// ChunkOfSize
-type ChunkOfSize struct {
+type chunkOfSize struct {
 	current int
 	limit   int
 	chunks  []string
@@ -15,8 +14,8 @@ type ChunkOfSize struct {
 }
 
 // NewChunkOfSize returns new instance of ChunkOfSize initialized with given text and size
-func NewChunkOfSize(text string, size int) *ChunkOfSize {
-	return &ChunkOfSize{
+func NewChunkOfSize(text string, size int) *chunkOfSize {
+	return &chunkOfSize{
 		current: 0,
 		limit:   size,
 		chunks:  strings.Split(text, " "),
@@ -24,7 +23,7 @@ func NewChunkOfSize(text string, size int) *ChunkOfSize {
 }
 
 // Next returns next chunk of text or empty string if nothing left to process
-func (c *ChunkOfSize) Next() string {
+func (c *chunkOfSize) Next() string {
 	var b strings.Builder
 	for i := range c.chunks {
 		l := utf8.RuneCountInString(c.chunks[i])
@@ -62,11 +61,11 @@ func (c *ChunkOfSize) Next() string {
 }
 
 // Success returns true if there are no errors
-func (c *ChunkOfSize) Success() bool {
+func (c *chunkOfSize) Success() bool {
 	return len(c.errors) == 0
 }
 
 // GetErrors returns erorrs
-func (c *ChunkOfSize) GetErrors() []string {
+func (c *chunkOfSize) GetErrors() []string {
 	return c.errors
 }

+ 1 - 1
chunkOfSize_test.go

@@ -7,7 +7,7 @@ import (
   "fmt"
 )
 
-func checkChunks(text string, size int) (*ChunkOfSize, int, error) {
+func checkChunks(text string, size int) (*chunkOfSize, int, error) {
   chunk := NewChunkOfSize(testText, size)
 	count := 0