From 4aa8a41fa097e433ef048a3bb183296ea149d8d2 Mon Sep 17 00:00:00 2001 From: Cody Soyland Date: Thu, 5 Jul 2018 21:48:52 -0500 Subject: [PATCH] Unexport NewNotFoundError --- api.go | 12 ++++++------ holder.go | 2 +- index.go | 2 +- pilosa.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api.go b/api.go index 86a739d5f..f646112b9 100644 --- a/api.go +++ b/api.go @@ -205,7 +205,7 @@ func (api *API) Index(ctx context.Context, indexName string) (*Index, error) { index := api.holder.Index(indexName) if index == nil { - return nil, NewNotFoundError(ErrIndexNotFound) + return nil, newNotFoundError(ErrIndexNotFound) } return index, nil } @@ -255,7 +255,7 @@ func (api *API) CreateField(ctx context.Context, indexName string, fieldName str // Find index. index := api.holder.Index(indexName) if index == nil { - return nil, NewNotFoundError(ErrIndexNotFound) + return nil, newNotFoundError(ErrIndexNotFound) } // Create field. @@ -287,7 +287,7 @@ func (api *API) Field(ctx context.Context, indexName, fieldName string) (*Field, field := api.holder.Field(indexName, fieldName) if field == nil { - return nil, NewNotFoundError(ErrFieldNotFound) + return nil, newNotFoundError(ErrFieldNotFound) } return field, nil } @@ -303,7 +303,7 @@ func (api *API) DeleteField(ctx context.Context, indexName string, fieldName str // Find index. index := api.holder.Index(indexName) if index == nil { - return NewNotFoundError(ErrIndexNotFound) + return newNotFoundError(ErrIndexNotFound) } // Delete field from the index. @@ -543,7 +543,7 @@ func (api *API) IndexAttrDiff(ctx context.Context, indexName string, blocks []At // Retrieve index from holder. index := api.holder.Index(indexName) if index == nil { - return nil, NewNotFoundError(ErrIndexNotFound) + return nil, newNotFoundError(ErrIndexNotFound) } // Retrieve local blocks. @@ -685,7 +685,7 @@ func (api *API) indexField(indexName string, fieldName string, shard uint64) (*I index := api.holder.Index(indexName) if index == nil { api.server.logger.Printf("fragment error: index=%s, field=%s, shard=%d, err=%s", indexName, fieldName, shard, ErrIndexNotFound.Error()) - return nil, nil, NewNotFoundError(ErrIndexNotFound) + return nil, nil, newNotFoundError(ErrIndexNotFound) } // Retrieve field. diff --git a/holder.go b/holder.go index 430253ba9..a8caf8664 100644 --- a/holder.go +++ b/holder.go @@ -374,7 +374,7 @@ func (h *Holder) DeleteIndex(name string) error { // Confirm index exists. index := h.index(name) if index == nil { - return NewNotFoundError(ErrIndexNotFound) + return newNotFoundError(ErrIndexNotFound) } // Close index. diff --git a/index.go b/index.go index 2d66a42c1..1cda5e7c9 100644 --- a/index.go +++ b/index.go @@ -378,7 +378,7 @@ func (i *Index) DeleteField(name string) error { // Confirm field exists. f := i.field(name) if f == nil { - return NewNotFoundError(ErrFieldNotFound) + return newNotFoundError(ErrFieldNotFound) } // Close field. diff --git a/pilosa.go b/pilosa.go index 8474fae89..45d77a9f3 100644 --- a/pilosa.go +++ b/pilosa.go @@ -104,8 +104,8 @@ type NotFoundError struct { error } -// NewNotFoundError returns err wrapped in a NotFoundError. -func NewNotFoundError(err error) NotFoundError { +// newNotFoundError returns err wrapped in a NotFoundError. +func newNotFoundError(err error) NotFoundError { return NotFoundError{err} }