Closed dorzheh closed 10 years ago
Using itoa
makes nervous because of possibility of the C values changing, but VIR_DOMAIN_METADATA_DESCRIPTION VirDomainMetadataType = C.vir...
might do it.
Good
Sent from my iPhone
On Apr 7, 2014, at 1:50 AM, Alex Zorin notifications@github.com wrote:
Using itoa makes nervous because of possibility of the C values changing, but VIR_DOMAIN_METADATA_DESCRIPTION VirDomainMetadataType = C.vir... might do it.
— Reply to this email directly or view it on GitHub.
As seems no "stringer" is needed here ,sounds like the previous proposition is very eligible.
type VirDomainState int const ( VIR_DOMAIN_RUNNING VirDomainState = C.VIR_DOMAIN_RUNNING VIR_DOMAIN_SHUTOFF VirDomainState = C.VIR_DOMAIN_SHUTOFF )
type VirDomainMetadataType int const ( VIR_DOMAIN_METADATA_DESCRIPTION VirDomainMetadataType = C.VIR_DOMAIN_METADATA_DESCRIPTION VIR_DOMAIN_METADATA_TITLE VirDomainMetadataType = C.VIR_DOMAIN_METADATA_TITLE VIR_DOMAIN_METADATA_ELEMENT VirDomainMetadataType = C.VIR_DOMAIN_METADATA_ELEMENT ) 1) the usual way to simulate enum types in go 2) a client will be able to use a const of appropriate type as a function argument 3) looks organized as well
And i guess they better will be separated from the implementation (moving to a file called "constants.go", for instance)
Adding two files (network.go and network_test.go) for virNetwork treatment