From 78f3c5e9852068547060f2603064fc60b5ba1b57 Mon Sep 17 00:00:00 2001 From: Milad Rahimi Date: Sun, 21 Feb 2021 23:09:14 +0330 Subject: [PATCH] rename internal NewContainer to New --- container.go | 4 ++-- pkg/container/container.go | 4 ++-- pkg/container/container_test.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/container.go b/container.go index 32e5ecd..e9056ee 100644 --- a/container.go +++ b/container.go @@ -6,13 +6,13 @@ import ( internal "github.com/golobby/container/v2/pkg/container" ) -// NewContainer creates a new standalone instance of Container +// New creates a new standalone instance of Container func New() internal.Container { return make(internal.Container) } // container is the global repository of bindings -var container = internal.NewContainer() +var container = internal.New() // Singleton will bind an abstraction to a concrete for further singleton resolves. // It takes a resolver function which returns the concrete and its return type matches the abstraction (interface). diff --git a/pkg/container/container.go b/pkg/container/container.go index 670288a..52863c1 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -25,8 +25,8 @@ func (b binding) resolve(c Container) (interface{}, error) { // Container is the repository of bindings type Container map[reflect.Type]binding -// NewContainer creates a new instance of Container -func NewContainer() Container { +// New creates a new instance of Container +func New() Container { return make(Container) } diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go index d26a740..82ab3a4 100644 --- a/pkg/container/container_test.go +++ b/pkg/container/container_test.go @@ -35,7 +35,7 @@ func (m MySQL) Connect() bool { return true } -var instance = container.NewContainer() +var instance = container.New() func TestContainer_Singleton(t *testing.T) { err := instance.Singleton(func() Shape {