Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to get database infos #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

dszczyt
Copy link

@dszczyt dszczyt commented Jul 19, 2017

No description provided.

Copy link
Owner

@abh abh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test or two, also?

geoip.go Outdated

cdbinfo := C.GeoIP_database_info(gi.db)
if cdbinfo != nil {
databaseInfos = C.GoString(cdbinfo)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this also need

defer C.free(unsafe.Pointer(cdbinfo))

?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an unexpected destroy in my copy/paste... Fixing...

geoip.go Outdated
@@ -338,3 +338,19 @@ func (gi *GeoIP) GetCountry_v6(ip string) (cc string, netmask int) {
}
return
}

func (gi *GeoIP) GetDatabaseInfo() (databaseInfos string) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to complain about the named return variable, but it looks like I was doing that elsewhere here too. :-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied/pasted one of your methods, but I prefer the unnamed return version

@dszczyt
Copy link
Author

dszczyt commented Jul 20, 2017

OK for the tests, but the test-db files don't provided these database informations. So checking with empty string would not be an appropriate test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants