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

Programs using this package won't build because of an error in geoip-demo.go #34

Open
ghost opened this issue Jun 6, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Jun 6, 2020

If a Go program uses this package and will be build using go install ./... it can't build because
of an type error in geoip-demo.go:

# github.com/abh/geoip/ex
src/github.com/abh/geoip/ex/geoip-demo.go:41:9: cannot use *gi (type geoip.GeoIP) as type *geoip.GeoIP in argument to test4
src/github.com/abh/geoip/ex/geoip-demo.go:42:9: cannot use *gi (type geoip.GeoIP) as type *geoip.GeoIP in argument to test4

This is caused by a wrong type in geoip-demo.go. geoip.Open returns a pointer to GeoIP structure and the function test4 in the geoip-demo.go file expects a pointer but the main function passes the structure instead of the pointer.

This patch will fix this issue:

--- ex/geoip-demo.go.original	2020-06-06 11:24:57.841432573 +0200
+++ ex/geoip-demo.go	2020-06-06 11:25:04.749461347 +0200
@@ -38,8 +38,8 @@
 	}
 
 	if gi != nil {
-		test4(*gi, "207.171.7.51")
-		test4(*gi, "127.0.0.1")
+		test4(gi, "207.171.7.51")
+		test4(gi, "127.0.0.1")
 	}
 	if gi6 != nil {
 		ip := "2607:f238:2::5"
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

No branches or pull requests

0 participants