Skip to content

Commit

Permalink
Merge pull request #903 from FactomProject/FD-1222_atomic_prefix
Browse files Browse the repository at this point in the history
Fd 1222 atomic prefix
  • Loading branch information
Matt York authored Oct 21, 2019
2 parents bfe12fb + 3eafd46 commit de5c619
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
3 changes: 2 additions & 1 deletion log/logger_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package log_test

import (
"github.com/FactomProject/factomd/log"
"testing"

"github.com/FactomProject/factomd/log"
)

func TestLogPrintf(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion netTest/AnElection_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package nettest

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestAnElection(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion netTest/DebugApi_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package nettest

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestDebugAPI(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions netTest/testHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/FactomProject/factomd/p2p"
"github.com/FactomProject/factomd/state"
"github.com/FactomProject/factomd/testHelper"
"io/ioutil"
"net/http"
"testing"

"github.com/FactomProject/factomd/p2p"
"github.com/FactomProject/factomd/state"
"github.com/FactomProject/factomd/testHelper"
)

type remoteNode struct {
Expand Down
3 changes: 2 additions & 1 deletion simTest/InitDevNet_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package simtest

import (
. "github.com/FactomProject/factomd/testHelper"
"testing"

. "github.com/FactomProject/factomd/testHelper"
)

// create Stub DBs & configs for DevNet Testing
Expand Down
3 changes: 2 additions & 1 deletion simTest/factomd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/FactomProject/factomd/log"
"io/ioutil"
"net/http"
"os"
Expand All @@ -15,6 +14,8 @@ import (
"testing"
"time"

"github.com/FactomProject/factomd/log"

"github.com/FactomProject/factomd/common/constants"
"github.com/FactomProject/factomd/common/directoryBlock"
"github.com/FactomProject/factomd/common/messages"
Expand Down
14 changes: 4 additions & 10 deletions util/atomic/atomic.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,12 @@ func Goid() string {
return idField
}

// don't try to remove prefix if caller func is shorter
func truncate(fn string) string {
if len(fn) > prefix {
return fn[prefix:]
} else {
return fn
}
}

func WhereAmIString(depth int) string {
_, fn, line, _ := runtime.Caller(depth + 1)
return fmt.Sprintf("%v-%s:%d", Goid(), truncate(fn), line)
if len(fn) > prefix {
fn = fn[prefix:] // Chop off the /home/user/go/src...factomd/ part of the path.
}
return fmt.Sprintf("%v-%s:%d", Goid(), fn, line)
}

func WhereAmIMsg(msg string) {
Expand Down

0 comments on commit de5c619

Please sign in to comment.