#Instantiate exported Struct that has internal members

7 messages · Page 1 of 1 (latest)

vapid trench
#

Hi folks, I was wondering, how would one go about instantiating a struct that happens to have internal fields?

The struct in question is this: https://github.com/insomniacslk/dhcp/blob/master/dhcpv4/nclient4/client.go#L136

I would like to leverage the existing functions of the Client struct in my code, just initialise it in a customised way.
What is the easiest way to go about this? I'd rather avoid forking the module.

GitHub

DHCPv6 and DHCPv4 packet library, client and server written in Go - insomniacslk/dhcp

gleaming carbon
#

so you need to change inner private fields?

vapid trench
#

I'd like to instantiate the struct myself instead of using the provided constructors, so yeah

gleaming carbon
#

you need to modify the package

#

for the best of my knowledge

vapid trench
#

right... I was hoping to avoid that

gleaming carbon
#

but if your usecase is popular enough, may be the maintainers of the library would add a new constructor