Skip to content

Commit bf7c7d7

Browse files
authored
Move all of /pkg under /internal (#105)
Nothing in /pkg at present needs to be importable in other projects. Move everything into internal. This is a big PR, but all changes are to do with moving files. There are no changes to the logic.
1 parent a04ea47 commit bf7c7d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+103
-103
lines changed

cmd/thv-registry-api/app/commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/spf13/viper"
1010
"github.com/stacklok/toolhive/pkg/logger"
1111

12-
"github.com/stacklok/toolhive-registry-server/pkg/versions"
12+
"github.com/stacklok/toolhive-registry-server/internal/versions"
1313
)
1414

1515
var rootCmd = &cobra.Command{

cmd/thv-registry-api/app/serve.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414
"sigs.k8s.io/controller-runtime/pkg/log"
1515
"sigs.k8s.io/controller-runtime/pkg/log/zap"
1616

17-
registryapp "github.com/stacklok/toolhive-registry-server/pkg/app"
18-
"github.com/stacklok/toolhive-registry-server/pkg/config"
17+
registryapp "github.com/stacklok/toolhive-registry-server/internal/app"
18+
"github.com/stacklok/toolhive-registry-server/internal/config"
1919
)
2020

2121
var serveCmd = &cobra.Command{

pkg/app/app.go renamed to internal/app/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
"github.com/stacklok/toolhive/pkg/logger"
1212

13-
"github.com/stacklok/toolhive-registry-server/pkg/config"
13+
"github.com/stacklok/toolhive-registry-server/internal/config"
1414
)
1515

1616
// RegistryApp encapsulates all components needed to run the registry API server

pkg/app/builder.go renamed to internal/app/builder.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import (
1313
"github.com/stacklok/toolhive/pkg/logger"
1414

1515
"github.com/stacklok/toolhive-registry-server/internal/api"
16+
"github.com/stacklok/toolhive-registry-server/internal/config"
1617
"github.com/stacklok/toolhive-registry-server/internal/service"
17-
"github.com/stacklok/toolhive-registry-server/pkg/config"
18-
"github.com/stacklok/toolhive-registry-server/pkg/sources"
19-
"github.com/stacklok/toolhive-registry-server/pkg/status"
20-
pkgsync "github.com/stacklok/toolhive-registry-server/pkg/sync"
21-
"github.com/stacklok/toolhive-registry-server/pkg/sync/coordinator"
18+
sources2 "github.com/stacklok/toolhive-registry-server/internal/sources"
19+
"github.com/stacklok/toolhive-registry-server/internal/status"
20+
pkgsync "github.com/stacklok/toolhive-registry-server/internal/sync"
21+
"github.com/stacklok/toolhive-registry-server/internal/sync/coordinator"
2222
)
2323

2424
const (
@@ -41,8 +41,8 @@ type registryAppConfig struct {
4141
config *config.Config
4242

4343
// Optional component overrides (primarily for testing)
44-
sourceHandlerFactory sources.SourceHandlerFactory
45-
storageManager sources.StorageManager
44+
sourceHandlerFactory sources2.SourceHandlerFactory
45+
storageManager sources2.StorageManager
4646
statusPersistence status.StatusPersistence
4747
syncManager pkgsync.Manager
4848
registryProvider service.RegistryDataProvider
@@ -184,15 +184,15 @@ func WithDataDirectory(dir string) RegistryAppOptions {
184184
}
185185

186186
// WithSourceHandlerFactory allows injecting a custom source handler factory (for testing)
187-
func WithSourceHandlerFactory(factory sources.SourceHandlerFactory) RegistryAppOptions {
187+
func WithSourceHandlerFactory(factory sources2.SourceHandlerFactory) RegistryAppOptions {
188188
return func(cfg *registryAppConfig) error {
189189
cfg.sourceHandlerFactory = factory
190190
return nil
191191
}
192192
}
193193

194194
// WithStorageManager allows injecting a custom storage manager (for testing)
195-
func WithStorageManager(sm sources.StorageManager) RegistryAppOptions {
195+
func WithStorageManager(sm sources2.StorageManager) RegistryAppOptions {
196196
return func(cfg *registryAppConfig) error {
197197
cfg.storageManager = sm
198198
return nil
@@ -239,7 +239,7 @@ func buildSyncComponents(
239239

240240
// Build source handler factory
241241
if b.sourceHandlerFactory == nil {
242-
b.sourceHandlerFactory = sources.NewSourceHandlerFactory()
242+
b.sourceHandlerFactory = sources2.NewSourceHandlerFactory()
243243
}
244244

245245
// Build storage manager
@@ -248,7 +248,7 @@ func buildSyncComponents(
248248
if err := os.MkdirAll(b.dataDir, 0750); err != nil {
249249
return nil, fmt.Errorf("failed to create data directory %s: %w", b.dataDir, err)
250250
}
251-
b.storageManager = sources.NewFileStorageManager(b.dataDir)
251+
b.storageManager = sources2.NewFileStorageManager(b.dataDir)
252252
}
253253

254254
// Build status persistence

pkg/app/builder_test.go renamed to internal/app/builder_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import (
1111
"github.com/stretchr/testify/require"
1212
"go.uber.org/mock/gomock"
1313

14+
"github.com/stacklok/toolhive-registry-server/internal/config"
1415
"github.com/stacklok/toolhive-registry-server/internal/service"
1516
"github.com/stacklok/toolhive-registry-server/internal/service/mocks"
16-
"github.com/stacklok/toolhive-registry-server/pkg/config"
17-
"github.com/stacklok/toolhive-registry-server/pkg/sources"
18-
"github.com/stacklok/toolhive-registry-server/pkg/status"
19-
pkgsync "github.com/stacklok/toolhive-registry-server/pkg/sync"
20-
"github.com/stacklok/toolhive-registry-server/pkg/sync/coordinator"
17+
"github.com/stacklok/toolhive-registry-server/internal/sources"
18+
"github.com/stacklok/toolhive-registry-server/internal/status"
19+
pkgsync "github.com/stacklok/toolhive-registry-server/internal/sync"
20+
"github.com/stacklok/toolhive-registry-server/internal/sync/coordinator"
2121
)
2222

2323
func TestNewRegistryAppBuilder(t *testing.T) {

pkg/app/components.go renamed to internal/app/components.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package app
22

33
import (
44
"github.com/stacklok/toolhive-registry-server/internal/service"
5-
"github.com/stacklok/toolhive-registry-server/pkg/sync/coordinator"
5+
"github.com/stacklok/toolhive-registry-server/internal/sync/coordinator"
66
)
77

88
// AppComponents groups all application components
File renamed without changes.
File renamed without changes.
File renamed without changes.

pkg/filtering/filter_service.go renamed to internal/filtering/filter_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/stacklok/toolhive/pkg/registry"
99
"sigs.k8s.io/controller-runtime/pkg/log"
1010

11-
"github.com/stacklok/toolhive-registry-server/pkg/config"
11+
"github.com/stacklok/toolhive-registry-server/internal/config"
1212
)
1313

1414
// FilterService coordinates name and tag filtering to apply registry filters

0 commit comments

Comments
 (0)