Go fmt new utils.

This commit is contained in:
Dave Collins 2013-10-04 10:09:15 -05:00
parent 96b92552b9
commit fd4b63073f
3 changed files with 34 additions and 36 deletions

View file

@ -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() {

View file

@ -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 "."
}

View file

@ -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 "."
}