Closed Thiht closed 2 years ago
The pdl.New function returns a private struct, so its type can't be used to perform dependency injection:
pdl.New
type peopleDataLabs struct { pdlClient *pdl.pld // pld not exported by package peopledatalabs_go } func NewClient(apiKey string) MyInterface { return &peopleDataLabs{ pdlClient: pdl.New(apiKey), } }
The fields of the pdl.pld struct are not usable either because they're declared in internal:
pdl.pld
internal
// could not import github.com/peopledatalabs/peopledatalabs-go/internal/api (invalid use of internal package github.com/peopledatalabs/peopledatalabs-go/internal/api) import pdlapi "github.com/peopledatalabs/peopledatalabs-go/internal/api" type peopleDataLabs struct { pdlPersonClient pdlapi.Person // pld not exported by package peopledatalabs_go } func NewClient(apiKey string) MyInterface { return &peopleDataLabs{ pdlClient: pdl.New(apiKey).Person, } }
Can you make the pdl.pld struct public, or declare the internal/api structs public? Thanks
internal/api
@Thiht Pushing a fix out for this today. Moving the internal folder public in https://github.com/peopledatalabs/peopledatalabs-go/pull/14
The
pdl.New
function returns a private struct, so its type can't be used to perform dependency injection:The fields of the
pdl.pld
struct are not usable either because they're declared ininternal
:Can you make the
pdl.pld
struct public, or declare theinternal/api
structs public? Thanks