This repository has been archived by the owner on Jan 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Prepare v2 #26
Merged
Prepare v2 #26
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ector into refactor-graph � Conflicts: � container_test.go
Codecov Report
@@ Coverage Diff @@
## master #26 +/- ##
==========================================
- Coverage 98.19% 93.67% -4.52%
==========================================
Files 13 26 +13
Lines 442 712 +270
==========================================
+ Hits 434 667 +233
- Misses 5 39 +34
- Partials 3 6 +3
Continue to review full report at Codecov.
|
@maxzhang1985 Hello! I'm preparing a With this option, the provider creates a new instance of type by each extraction. Test for checking it: package inject_test
import (
"fmt"
"net/http"
"testing"
"github.com/stretchr/testify/require"
"github.com/defval/inject"
)
// NewHTTPServer
func NewHTTPServer() *http.Server {
return &http.Server{}
}
func TestPrototype(t *testing.T) {
container := inject.New(
inject.Provide(NewHTTPServer, inject.Prototype()),
)
var server1 *http.Server
require.NoError(t, container.Extract(&server1))
var server2 *http.Server
require.NoError(t, container.Extract(&server2))
require.NotEqual(t, fmt.Sprintf("%p", server1), fmt.Sprintf("%p", server2))
} |
@defval Yes , this is what I needed! |
Closed
This was referenced Nov 26, 2019
Closed
Closed
Closed
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Massive refactoring and rethinking features.
Remove
Change
Add