cleanup: remove unused placeholder fields and helper constructors
Remove unused struct fields from Context, Core, Registry, and Stream that were causing staticcheck U1000 warnings: - Context: capi, core fields - Core: capi, context fields (and newCore helper) - Registry: capi, core fields (and newRegistry helper) - Stream: capi, core fields Also removes unused portout imports from these files. Behavior preserved: all tests pass, public API unchanged, skeleton methods remain for Task 4 implementation.
- commit
- 799bcb0a739e8175e979ca5eb85dc923a923cf8f
- author
- brice · · 2026-04-09 06:08 UTC
- parent
- ccafe44
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +1 -33
M internal/core/context.go +1 -5
| @@ -3,16 +3,12 @@ package core | |||
| 3 | 3 | import ( | |
| 4 | 4 | "errors" | |
| 5 | 5 | "unsafe" | |
| 6 | - | ||
| 7 | - | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |
| 8 | 6 | ) | |
| 9 | 7 | ||
| 10 | 8 | var ErrContextCreate = errors.New("failed to create context") | |
| 11 | 9 | ||
| 12 | 10 | type Context struct { | |
| 13 | - | ptr unsafe.Pointer | |
| 14 | - | capi portout.CAPI | |
| 15 | - | core *Core | |
| 11 | + | ptr unsafe.Pointer | |
| 16 | 12 | } | |
| 17 | 13 | ||
| 18 | 14 | func (r *Runtime) NewContext() (*Context, error) { | |
| @@ -3,16 +3,12 @@ package core | |||||
| 3 | import ( | 3 | import ( | ||
| 4 | "errors" | 4 | "errors" | ||
| 5 | "unsafe" | 5 | "unsafe" | ||
| 6 | - | ||||
| 7 | - | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |||
| 8 | ) | 6 | ) | ||
| 9 | 7 | ||||
| 10 | var ErrContextCreate = errors.New("failed to create context") | 8 | var ErrContextCreate = errors.New("failed to create context") | ||
| 11 | 9 | ||||
| 12 | type Context struct { | 10 | type Context struct { | ||
| 13 | - | ptr unsafe.Pointer | 11 | + | ptr unsafe.Pointer |
| 14 | - | capi portout.CAPI | |||
| 15 | - | core *Core | |||
| 16 | } | 12 | } | ||
| 17 | 13 | ||||
| 18 | func (r *Runtime) NewContext() (*Context, error) { | 14 | func (r *Runtime) NewContext() (*Context, error) { | ||
M internal/core/core.go +0 -12
| @@ -3,8 +3,6 @@ package core | |||
| 3 | 3 | import ( | |
| 4 | 4 | "errors" | |
| 5 | 5 | "unsafe" | |
| 6 | - | ||
| 7 | - | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |
| 8 | 6 | ) | |
| 9 | 7 | ||
| 10 | 8 | var ErrCoreConnect = errors.New("failed to connect core") | |
| @@ -12,19 +10,9 @@ var ErrRegistryUnavailable = errors.New("registry unavailable") | |||
| 12 | 10 | ||
| 13 | 11 | type Core struct { | |
| 14 | 12 | ptr unsafe.Pointer | |
| 15 | - | capi portout.CAPI | |
| 16 | - | context *Context | |
| 17 | 13 | registry *Registry | |
| 18 | 14 | } | |
| 19 | 15 | ||
| 20 | - | func (c *Context) newCore(ptr unsafe.Pointer) *Core { | |
| 21 | - | return &Core{ | |
| 22 | - | ptr: ptr, | |
| 23 | - | capi: c.capi, | |
| 24 | - | context: c, | |
| 25 | - | } | |
| 26 | - | } | |
| 27 | - | ||
| 28 | 16 | func (c *Core) Disconnect() { | |
| 29 | 17 | // Placeholder for core disconnection | |
| 30 | 18 | } | |
| @@ -3,8 +3,6 @@ package core | |||||
| 3 | import ( | 3 | import ( | ||
| 4 | "errors" | 4 | "errors" | ||
| 5 | "unsafe" | 5 | "unsafe" | ||
| 6 | - | ||||
| 7 | - | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |||
| 8 | ) | 6 | ) | ||
| 9 | 7 | ||||
| 10 | var ErrCoreConnect = errors.New("failed to connect core") | 8 | var ErrCoreConnect = errors.New("failed to connect core") | ||
| @@ -12,19 +10,9 @@ var ErrRegistryUnavailable = errors.New("registry unavailable") | |||||
| 12 | 10 | ||||
| 13 | type Core struct { | 11 | type Core struct { | ||
| 14 | ptr unsafe.Pointer | 12 | ptr unsafe.Pointer | ||
| 15 | - | capi portout.CAPI | |||
| 16 | - | context *Context | |||
| 17 | registry *Registry | 13 | registry *Registry | ||
| 18 | } | 14 | } | ||
| 19 | 15 | ||||
| 20 | - | func (c *Context) newCore(ptr unsafe.Pointer) *Core { | |||
| 21 | - | return &Core{ | |||
| 22 | - | ptr: ptr, | |||
| 23 | - | capi: c.capi, | |||
| 24 | - | context: c, | |||
| 25 | - | } | |||
| 26 | - | } | |||
| 27 | - | ||||
| 28 | func (c *Core) Disconnect() { | 16 | func (c *Core) Disconnect() { | ||
| 29 | // Placeholder for core disconnection | 17 | // Placeholder for core disconnection | ||
| 30 | } | 18 | } | ||
M internal/core/registry.go +0 -12
| @@ -3,27 +3,15 @@ package core | |||
| 3 | 3 | import ( | |
| 4 | 4 | "errors" | |
| 5 | 5 | "unsafe" | |
| 6 | - | ||
| 7 | - | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |
| 8 | 6 | ) | |
| 9 | 7 | ||
| 10 | 8 | var ErrRegistryCreate = errors.New("failed to create registry") | |
| 11 | 9 | ||
| 12 | 10 | type Registry struct { | |
| 13 | 11 | ptr unsafe.Pointer | |
| 14 | - | capi portout.CAPI | |
| 15 | - | core *Core | |
| 16 | 12 | hooks []unsafe.Pointer | |
| 17 | 13 | } | |
| 18 | 14 | ||
| 19 | - | func (c *Core) newRegistry(ptr unsafe.Pointer) *Registry { | |
| 20 | - | return &Registry{ | |
| 21 | - | ptr: ptr, | |
| 22 | - | capi: c.capi, | |
| 23 | - | core: c, | |
| 24 | - | } | |
| 25 | - | } | |
| 26 | - | ||
| 27 | 15 | func (r *Registry) Destroy() { | |
| 28 | 16 | // Clean up any registered hooks | |
| 29 | 17 | for _, hook := range r.hooks { | |
| @@ -3,27 +3,15 @@ package core | |||||
| 3 | import ( | 3 | import ( | ||
| 4 | "errors" | 4 | "errors" | ||
| 5 | "unsafe" | 5 | "unsafe" | ||
| 6 | - | ||||
| 7 | - | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |||
| 8 | ) | 6 | ) | ||
| 9 | 7 | ||||
| 10 | var ErrRegistryCreate = errors.New("failed to create registry") | 8 | var ErrRegistryCreate = errors.New("failed to create registry") | ||
| 11 | 9 | ||||
| 12 | type Registry struct { | 10 | type Registry struct { | ||
| 13 | ptr unsafe.Pointer | 11 | ptr unsafe.Pointer | ||
| 14 | - | capi portout.CAPI | |||
| 15 | - | core *Core | |||
| 16 | hooks []unsafe.Pointer | 12 | hooks []unsafe.Pointer | ||
| 17 | } | 13 | } | ||
| 18 | 14 | ||||
| 19 | - | func (c *Core) newRegistry(ptr unsafe.Pointer) *Registry { | |||
| 20 | - | return &Registry{ | |||
| 21 | - | ptr: ptr, | |||
| 22 | - | capi: c.capi, | |||
| 23 | - | core: c, | |||
| 24 | - | } | |||
| 25 | - | } | |||
| 26 | - | ||||
| 27 | func (r *Registry) Destroy() { | 15 | func (r *Registry) Destroy() { | ||
| 28 | // Clean up any registered hooks | 16 | // Clean up any registered hooks | ||
| 29 | for _, hook := range r.hooks { | 17 | for _, hook := range r.hooks { | ||
M internal/core/stream.go +0 -4
| @@ -3,16 +3,12 @@ package core | |||
| 3 | 3 | import ( | |
| 4 | 4 | "errors" | |
| 5 | 5 | "unsafe" | |
| 6 | - | ||
| 7 | - | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |
| 8 | 6 | ) | |
| 9 | 7 | ||
| 10 | 8 | var ErrStreamCreate = errors.New("failed to create stream") | |
| 11 | 9 | ||
| 12 | 10 | type Stream struct { | |
| 13 | 11 | ptr unsafe.Pointer | |
| 14 | - | capi portout.CAPI | |
| 15 | - | core *Core | |
| 16 | 12 | destroy func() | |
| 17 | 13 | } | |
| 18 | 14 | ||
| @@ -3,16 +3,12 @@ package core | |||||
| 3 | import ( | 3 | import ( | ||
| 4 | "errors" | 4 | "errors" | ||
| 5 | "unsafe" | 5 | "unsafe" | ||
| 6 | - | ||||
| 7 | - | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |||
| 8 | ) | 6 | ) | ||
| 9 | 7 | ||||
| 10 | var ErrStreamCreate = errors.New("failed to create stream") | 8 | var ErrStreamCreate = errors.New("failed to create stream") | ||
| 11 | 9 | ||||
| 12 | type Stream struct { | 10 | type Stream struct { | ||
| 13 | ptr unsafe.Pointer | 11 | ptr unsafe.Pointer | ||
| 14 | - | capi portout.CAPI | |||
| 15 | - | core *Core | |||
| 16 | destroy func() | 12 | destroy func() | ||
| 17 | } | 13 | } | ||
| 18 | 14 | ||||