Skip to content

Commit

Permalink
rename internal NewContainer to New
Browse files Browse the repository at this point in the history
  • Loading branch information
miladrahimi committed Feb 21, 2021
1 parent a615c02 commit 78f3c5e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions pkg/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/container/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 78f3c5e

Please sign in to comment.