1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-08-10 22:31:32 +02:00

fix: linter bugs

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2024-02-07 10:07:37 +01:00
parent 9b3d9c6930
commit 909f7c3bce
42 changed files with 184 additions and 103 deletions

View File

@@ -127,7 +127,7 @@ func MakeInjector(providers []Provider) InjectableFactory {
var resolved sync.Map
// provide a mapping for all providers
factoryById := assembleProviders(providers)
factoryByID := assembleProviders(providers)
// the actual factory, we need lazy initialization
var injFct InjectableFactory
@@ -149,7 +149,7 @@ func MakeInjector(providers []Provider) InjectableFactory {
T.Map2(F.Flow3(
Dependency.Id,
R.Lookup[ProviderFactory, string],
I.Ap[O.Option[ProviderFactory]](factoryById),
I.Ap[O.Option[ProviderFactory]](factoryByID),
), handleMissingProvider),
T.Tupled2(O.MonadGetOrElse[ProviderFactory]),
IG.Ap[ProviderFactory](injFct),

View File

@@ -65,15 +65,15 @@ type MultiInjectionToken[T any] interface {
}
// makeID creates a generator of unique string IDs
func makeId() IO.IO[string] {
func makeID() IO.IO[string] {
var count atomic.Int64
return IO.MakeIO(func() string {
return strconv.FormatInt(count.Add(1), 16)
})
}
// genId is the common generator of unique string IDs
var genId = makeId()
// genID is the common generator of unique string IDs
var genID = makeID()
type tokenBase struct {
name string
@@ -156,7 +156,7 @@ func (m *multiInjectionToken[T]) Item() InjectionToken[T] {
// makeToken create a unique [InjectionToken] for a specific type
func makeInjectionToken[T any](name string, providerFactory O.Option[DIE.ProviderFactory]) InjectionToken[T] {
id := genId()
id := genID()
toIdentity := toType[T]()
return &injectionToken[T]{
token[T]{makeTokenBase(name, id, DIE.Identity, providerFactory), toIdentity},
@@ -178,7 +178,7 @@ func MakeTokenWithDefault[T any](name string, providerFactory DIE.ProviderFactor
// MakeMultiToken creates a [MultiInjectionToken]
func MakeMultiToken[T any](name string) MultiInjectionToken[T] {
id := genId()
id := genID()
toItem := toType[T]()
toContainer := toArrayType(toItem)
containerName := fmt.Sprintf("Container[%s]", name)