remove pointers for immutability
This commit is contained in:
16
main.go
16
main.go
@@ -1,24 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"github.com/ryanehamil/lookupip/src/ipapi"
|
||||
"github.com/ryanehamil/lookupip/src/utils"
|
||||
)
|
||||
|
||||
var detail bool
|
||||
var ip string
|
||||
var properties string
|
||||
|
||||
func main() {
|
||||
// Parse command line flags
|
||||
utils.ParseFlags(&ip, &properties, &detail)
|
||||
ip := flag.String("ip", "", "IP address to lookup")
|
||||
properties := flag.String("p", "", "Properties to retrieve")
|
||||
detail := flag.Bool("d", false, "Show Detail")
|
||||
flag.Parse()
|
||||
|
||||
// Use the IP-API to lookup the IP address
|
||||
data, err := ipapi.Lookup(&ip, &properties)
|
||||
data, err := ipapi.Lookup(*ip)
|
||||
utils.HandleError(err)
|
||||
|
||||
// Format the data to a string
|
||||
result := ipapi.GetProperties(data, properties, detail)
|
||||
result := ipapi.GetProperties(data, *properties, *detail)
|
||||
|
||||
// Print result with PrintOut
|
||||
utils.PrintOut(result)
|
||||
|
||||
Reference in New Issue
Block a user