summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2018-03-11 18:35:49 +0800
committercos <cos>2018-03-11 18:35:49 +0800
commit97507a4bf930e13f607d9b920a5af5ab84ba5fa0 (patch)
treedefcbb6aa112d30948f5f7d85cf0ec1919af2108
parent23c40db4cb7e1b02863977a8fb696ef089ab2e37 (diff)
downloadhisgle-97507a4bf930e13f607d9b920a5af5ab84ba5fa0.zip
White space + break long lines.
-rw-r--r--hisgle.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/hisgle.go b/hisgle.go
index f1cb6cf..de01ce9 100644
--- a/hisgle.go
+++ b/hisgle.go
@@ -20,8 +20,8 @@ func ethers(db *sql.DB, vlan int) {
ipv4 string
)
-//CREATE TABLE devices (name, mac, interface);
-//CREATE TABLE addresses (mac, vlan, ipv4);
+ // CREATE TABLE devices (name, mac, interface);
+ // CREATE TABLE addresses (mac, vlan, ipv4);
rows, err := db.Query("SELECT mac, ipv4 FROM addresses WHERE vlan=?", vlan)
if err != nil {
@@ -43,10 +43,11 @@ func hosts(db *sql.DB, vlan int) {
alias string
)
-//CREATE TABLE devices (name, mac, interface);
-//CREATE TABLE addresses (mac, vlan, ipv4);
+ // CREATE TABLE devices (name, mac, interface);
+ // CREATE TABLE addresses (mac, vlan, ipv4);
- rows, err := db.Query("SELECT a.ipv4, d.name FROM addresses AS a JOIN devices AS d ON a.mac=d.mac WHERE vlan=?", vlan)
+ rows, err := db.Query("SELECT a.ipv4, d.name FROM addresses AS a JOIN " +
+ "devices AS d ON a.mac=d.mac WHERE vlan=?", vlan)
if err != nil {
log.Fatal(err)
}
@@ -57,7 +58,7 @@ func hosts(db *sql.DB, vlan int) {
}
fmt.Print(ipv4, "\t", name)
-// CREATE TABLE aliases (alias, target);
+ // CREATE TABLE aliases (alias, target);
rows, err := db.Query("SELECT alias FROM aliases WHERE target=?", name)
if err != nil {
log.Fatal(err)
@@ -79,7 +80,8 @@ func main() {
ipv4 string
)
- optDatabase := getopt.StringLong("database", 'd', "", "Path to SQLite3 database file with device addresses")
+ optDatabase := getopt.StringLong("database", 'd', "",
+ "Path to SQLite3 database file with device addresses")
optHelp := getopt.BoolLong("help", 0, "Help")
getopt.SetParameters("{ethers|hosts} list_of_networks")
getopt.Parse()
@@ -97,7 +99,8 @@ func main() {
for _, arg := range args[1:] {
vlan, _ := strconv.Atoi(arg)
- rows, err := db.Query("SELECT description, ipv4 FROM networks WHERE vlan=?", vlan)
+ rows, err := db.Query(
+ "SELECT description, ipv4 FROM networks WHERE vlan=?", vlan)
if err != nil {
log.Fatal(err)
}