• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

matzefriedrich / parsley / 25522066949

07 May 2026 09:05PM UTC coverage: 79.735% (-1.1%) from 80.83%
25522066949

Pull #82

github

matzefriedrich
Updates the changelog
Pull Request #82: Support context.Context and error in activator signatures

78 of 88 new or added lines in 6 files covered. (88.64%)

56 existing lines in 5 files now uncovered.

2046 of 2566 relevant lines covered (79.73%)

31.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.77
/pkg/bootstrap/application.go
1
package bootstrap
2

3
import (
4
        "context"
5
        "errors"
6

7
        "github.com/matzefriedrich/parsley/internal/core"
8
        "github.com/matzefriedrich/parsley/pkg/registration"
9
        "github.com/matzefriedrich/parsley/pkg/resolving"
10
        "github.com/matzefriedrich/parsley/pkg/types"
11
)
12

13
type infrastructure struct {
14
        registry types.ServiceRegistry
15
        resolver types.Resolver
16
        app      Application
17
}
18

19
const (
20
        ErrorCannotRegisterAppFactory = "cannot register application factory"
21
)
22

23
// ErrCannotRegisterAppFactory is returned when the application factory cannot be registered, indicating an issue with the bootstrap process.
24
var (
25
        ErrCannotRegisterAppFactory = errors.New(ErrorCannotRegisterAppFactory)
26
)
27

28
// RunParsleyApplication initializes and runs the Parsley application lifecycle.
29
// It registers the application factory, configures additional modules, resolves the main application instance, and invokes its Run method.
30
func RunParsleyApplication(cxt context.Context, appFactoryFunc any, configure ...types.ModuleFunc) error {
1✔
31

1✔
32
        registry := registration.NewServiceRegistry()
1✔
33
        registerErr := registry.Register(appFactoryFunc, types.LifetimeSingleton)
1✔
34
        if registerErr != nil {
1✔
35
                bootstrapErr := &types.ParsleyError{Msg: ErrorCannotRegisterAppFactory}
×
36
                types.WithCause(registerErr)(bootstrapErr)
×
37
                return bootstrapErr
×
38
        }
×
39
        for _, m := range configure {
2✔
40
                _ = m(registry)
1✔
41
        }
1✔
UNCOV
42

×
43
        resolver := resolving.NewResolver(registry)
1✔
44
        ctx := resolving.NewScopedContext(cxt)
1✔
45
        app, _ := resolving.ResolveRequiredService[Application](ctx, resolver)
1✔
46

1✔
47
        parsley := infrastructure{
1✔
48
                registry: registry,
1✔
49
                resolver: resolver,
1✔
50
                app:      app,
1✔
51
        }
1✔
52

1✔
53
        appContext := context.WithValue(ctx, core.ContextKey("__parsley-infrastructure"), parsley)
1✔
54

1✔
55
        return app.Run(appContext)
1✔
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc