ed49204e85
Using generics for the providers API allows a type to be associated with a ProviderKey, resulting in a type-safe API without that doesn't require runtime type assertions by every caller. Unfortunately, Go does not allow generic types in methods, only in functions [1]. This prevents a type-safe API on ModuleContext, and requires moving the API to be functions that take a ModuleContext as a parameter. [1] https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#no-parameterized-methods) Bug: 316410648 Test: provider_test.go Change-Id: Ide91de9f2a2a7d075b05e287c7cc86b395db0edb
7 lines
138 B
Go
7 lines
138 B
Go
package blueprint
|
|
|
|
type SrcsFileProviderData struct {
|
|
SrcPaths []string
|
|
}
|
|
|
|
var SrcsFileProviderKey = NewProvider[SrcsFileProviderData]()
|