4 ms·
> go-sct also provides the geoip package which is a packaged version of http://devdungeon.com/content/ip-geolocation-go http://devdungeon.com/content/ip-geoloca
by pstuart 11y ago
> go-sct also provides the geoip package which is a packaged version of http://devdungeon.com/content/ip-geolocation-go http://devdungeon.com/content/ip-geolocation-go
- masklinn 11y agoasveikau only counted the sct.go file, which is a pretty straight port from ted's sct.c. They counted neither the daemon (75 LOC) nor the vendored geolocation package (58 LOC). Their count is actually "underselling" the "improvement" as the go port moves command-line handling (half a dozen LOC) from sct to the daemon.
- d4l3k 11y agoAuthor of go-sct here. It's totally true that it increased the LOC and is heavily based on C. There's a number of limitations in cgo such as not being able to use macros which caused the LOC bump. The primary reason I did this was I wanted to learn more about cgo since I haven't used it in any useful way before. This also allows it to be easily installed instead of having to download a .c file and compiling it.
- asveikau 11y agoJust to be clear I am not opposed to what you did, by all means keep doing it. I just followed the link and didn't understand right away. It seemed kind of like a funny substitution. And probably a learning exercise that suddenly was on HN's front page.
- artifaxx 11y agoThanks for putting this out there though. It was valuable to read and learn from this since I will probably end up implementing similar things in the future. It definitely seems like a valuable thing to post experimentation like this.
- masklinn 11y agoDoesn't cgo allow for using sct.c (possibly slightly tweaked e.g. removed/renamed main and added header) more or less directly rather than have to reimplement it?