Skip to content

Commit 69d82f1

Browse files
committed
Remove internal/slack dependency on internal/store
Because the Slack package imported the entire store package for the sake of a single defined type that wasn't even used anywhere else, the Lambda handler was getting a bunch of Firestore junk linked in that I had clearly not intended (as evidenced by me importing only the DynamoDB store into the main package). This shaves about 4 MB off of the darwin/arm64 copy of the binary, which admittedly isn't a great metric to base this on but is the easiest one for me to look at. There's still work to be done here, since I'm still seeing the gRPC libraries linked in even though Firestore is gone. Is Amazon secretly using gRPC too? Or have I missed some other dependency?
1 parent 60a80d2 commit 69d82f1

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

internal/slack/slack.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"strings"
1212

1313
"github.com/ahamlinman/randomizer/internal/randomizer"
14-
"github.com/ahamlinman/randomizer/internal/store"
1514
)
1615

1716
// App provides HTTP handling logic that allows the randomizer to be integrated
@@ -27,7 +26,7 @@ type App struct {
2726
TokenProvider TokenProvider
2827
// StoreFactory provides a Store for the Slack channel in which the request
2928
// was made.
30-
StoreFactory store.Factory
29+
StoreFactory func(partition string) randomizer.Store
3130
// Logger, if non-nil, will be used to report information about errors that
3231
// occur while handling each request.
3332
Logger *slog.Logger

internal/store/store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
//
1818
// A Factory may panic if it requires a non-empty partition and no partition is
1919
// given.
20-
type Factory func(partition string) randomizer.Store
20+
type Factory = func(partition string) randomizer.Store
2121

2222
// FactoryFromEnv constructs and returns a Factory based on available
2323
// environment variables. If a known DynamoDB environment variable is set, it

0 commit comments

Comments
 (0)