From fd4b63073f7f533c5160b76972eb3a4a50273eee Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 4 Oct 2013 10:09:15 -0500 Subject: [PATCH] Go fmt new utils. --- util/addblock/addblock.go | 14 +++++++------- util/dropafter/dropafter.go | 27 +++++++++++++-------------- util/showblock/showblock.go | 29 ++++++++++++++--------------- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/util/addblock/addblock.go b/util/addblock/addblock.go index 8c63ab89..ca12626a 100644 --- a/util/addblock/addblock.go +++ b/util/addblock/addblock.go @@ -1,6 +1,6 @@ -/* - * Copyright (c) 2013 Conformal Systems LLC. - */ +// Copyright (c) 2013 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. package main @@ -9,9 +9,9 @@ import ( "flag" "fmt" "github.com/conformal/btcdb" - "github.com/conformal/btcutil" - _ "github.com/conformal/btcdb/sqlite3" _ "github.com/conformal/btcdb/ldb" + _ "github.com/conformal/btcdb/sqlite3" + "github.com/conformal/btcutil" "github.com/conformal/btcwire" "github.com/conformal/seelog" "io" @@ -37,8 +37,8 @@ type bufQueue struct { type blkQueue struct { complete chan bool - height int64 - blk *btcutil.Block + height int64 + blk *btcutil.Block } func main() { diff --git a/util/dropafter/dropafter.go b/util/dropafter/dropafter.go index 1d29f995..e9e9442f 100644 --- a/util/dropafter/dropafter.go +++ b/util/dropafter/dropafter.go @@ -57,7 +57,7 @@ func main() { datadir = filepath.Join(datadir, "mainnet") blockDbNamePrefix := "blocks" - dbName := blockDbNamePrefix + "_" + dbType + dbName := blockDbNamePrefix + "_" + dbType if dbType == "sqlite" { dbName = dbName + ".db" } @@ -110,7 +110,6 @@ func getSha(db btcdb.Db, str string) (btcwire.ShaHash, error) { return *sha, nil } - var ntxcnt int64 var txspendcnt int64 var txgivecnt int64 @@ -180,18 +179,18 @@ func parsesha(argstr string) (argtype int, height int64, psha *btcwire.ShaHash, // btcdHomeDir returns an OS appropriate home directory for btcd. func btcdHomeDir() string { - // Search for Windows APPDATA first. This won't exist on POSIX OSes. - appData := os.Getenv("APPDATA") - if appData != "" { - return filepath.Join(appData, "btcd") - } + // Search for Windows APPDATA first. This won't exist on POSIX OSes. + appData := os.Getenv("APPDATA") + if appData != "" { + return filepath.Join(appData, "btcd") + } - // Fall back to standard HOME directory that works for most POSIX OSes. - home := os.Getenv("HOME") - if home != "" { - return filepath.Join(home, ".btcd") - } + // Fall back to standard HOME directory that works for most POSIX OSes. + home := os.Getenv("HOME") + if home != "" { + return filepath.Join(home, ".btcd") + } - // In the worst case, use the current directory. - return "." + // In the worst case, use the current directory. + return "." } diff --git a/util/showblock/showblock.go b/util/showblock/showblock.go index 82e2dc86..419294df 100644 --- a/util/showblock/showblock.go +++ b/util/showblock/showblock.go @@ -10,8 +10,8 @@ import ( "flag" "fmt" "github.com/conformal/btcdb" - _ "github.com/conformal/btcdb/sqlite3" _ "github.com/conformal/btcdb/ldb" + _ "github.com/conformal/btcdb/sqlite3" "github.com/conformal/btcwire" "github.com/conformal/seelog" "github.com/davecgh/go-spew/spew" @@ -70,13 +70,12 @@ func main() { datadir = filepath.Join(datadir, "mainnet") blockDbNamePrefix := "blocks" - dbName := blockDbNamePrefix + "_" + dbType + dbName := blockDbNamePrefix + "_" + dbType if dbType == "sqlite" { dbName = dbName + ".db" } dbPath := filepath.Join(datadir, dbName) - log.Infof("loading db %v", dbType) db, err := btcdb.OpenDB(dbType, dbPath) if err != nil { @@ -266,18 +265,18 @@ func parsesha(argstr string) (argtype int, height int64, psha *btcwire.ShaHash, // btcdHomeDir returns an OS appropriate home directory for btcd. func btcdHomeDir() string { - // Search for Windows APPDATA first. This won't exist on POSIX OSes. - appData := os.Getenv("APPDATA") - if appData != "" { - return filepath.Join(appData, "btcd") - } + // Search for Windows APPDATA first. This won't exist on POSIX OSes. + appData := os.Getenv("APPDATA") + if appData != "" { + return filepath.Join(appData, "btcd") + } - // Fall back to standard HOME directory that works for most POSIX OSes. - home := os.Getenv("HOME") - if home != "" { - return filepath.Join(home, ".btcd") - } + // Fall back to standard HOME directory that works for most POSIX OSes. + home := os.Getenv("HOME") + if home != "" { + return filepath.Join(home, ".btcd") + } - // In the worst case, use the current directory. - return "." + // In the worst case, use the current directory. + return "." }