本文整理匯總了Golang中github.com/fcavani/rand.FileName函數的典型用法代碼示例。如果您正苦於以下問題:Golang FileName函數的具體用法?Golang FileName怎麽用?Golang FileName使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了FileName函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: BenchmarkLogFileBuffer
func BenchmarkLogFileBuffer(b *testing.B) {
name, err := rand.FileName("BenchmarkLogFile", ".log", 10)
if err != nil {
b.Error(e.Trace(e.Forward(err)))
}
name = os.TempDir() + name
file, err := os.Create(name)
if err != nil {
b.Error(e.Trace(e.Forward(err)))
}
defer os.Remove(name)
defer file.Close()
back := NewOutBuffer(
NewWriter(file).F(DefFormatter),
b.N/2,
)
defer back.(*OutBuffer).Close()
logger := New(back, false).Domain("test")
b.ResetTimer()
for i := 0; i < b.N; i++ {
logger.Print(msg)
b.SetBytes(l)
}
}
示例2: BenchmarkBoltDbBuffer
func BenchmarkBoltDbBuffer(b *testing.B) {
name, err := rand.FileName("boltdb", ".db", 10)
if err != nil {
b.Error(e.Trace(e.Forward(err)))
}
name = os.TempDir() + "/" + name
gob := &Gob{
TypeName: types.Name(&log{}),
}
bolt, err := NewBoltDb("test", name, 0600, nil, gob, gob)
if err != nil {
b.Error(e.Trace(e.Forward(err)))
}
logger := New(
NewOutBuffer(
NewGeneric(bolt).F(DefFormatter),
b.N/2,
),
false,
).Domain("test")
b.ResetTimer()
for i := 0; i < b.N; i++ {
logger.Print(msg)
b.SetBytes(l)
}
}
示例3: BenchmarkLogOuterFile
func BenchmarkLogOuterFile(b *testing.B) {
name, err := rand.FileName("BenchmarkLogFile", ".log", 10)
if err != nil {
b.Error(e.Trace(e.Forward(err)))
}
name = os.TempDir() + "/" + name
file, err := os.Create(name)
if err != nil {
b.Error(e.Trace(e.Forward(err)))
}
defer os.Remove(name)
defer file.Close()
backend := NewWriter(file).F(DefFormatter)
olog, ok := backend.(OuterLogger)
if !ok {
return
}
w := olog.OuterLog(DebugPrio, "tag")
defer olog.Close()
b.ResetTimer()
for i := 0; i < b.N; i++ {
n, err := w.Write([]byte(msg + "\n"))
if err != nil {
b.Error(e.Trace(e.Forward(err)))
}
if int64(n) != l+1 {
b.Error("write failed", n, l)
}
b.SetBytes(l)
}
}
示例4: TestBoltDb
func TestBoltDb(t *testing.T) {
name, err := rand.FileName("boltdb", ".db", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
name = os.TempDir() + "/" + name
gob := &Gob{
TypeName: types.Name(&TestStruct{I: 0}),
}
addstore(t, NewBoltDb, "test", name, os.FileMode(0600), &bolt.Options{}, gob, gob)
}
示例5: TestNewCacheDisk
func TestNewCacheDisk(t *testing.T) {
var err error
fn, err := rand.FileName("cron_", "db", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
file := os.TempDir() + fn
cd, err := NewCacheDisk(file, 0600, nil, 5)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
cache = NewCache(&photos{}, cd)
}
示例6: TestUnix
func TestUnix(t *testing.T) {
name, err := rand.FileName("test", "socket", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
//name = os.TempDir() + name
defer os.Remove(name)
sig := make(chan struct{})
go func() {
t.Log("Listen")
addr, err := net.ResolveUnixAddr("unix", name)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
ln, err := net.ListenUnix("unix", addr)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
sig <- struct{}{}
t.Log("Accepting connections on", ln.Addr())
conn, err := ln.Accept()
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
t.Log("Connection accepted.", conn.RemoteAddr())
time.Sleep(100 * time.Millisecond)
err = conn.Close()
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
}()
unixUrl := "socket://" + name
t.Log(unixUrl)
url := testParse(t, unixUrl)
<-sig
err = PingUnix(url)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
}
示例7: BenchmarkLogfmt
func BenchmarkLogfmt(b *testing.B) {
name, err := rand.FileName("BenchmarkLogFile", ".log", 10)
if err != nil {
b.Error(e.Trace(e.Forward(err)))
}
name = os.TempDir() + name
file, err := os.Create(name)
if err != nil {
b.Error(e.Trace(e.Forward(err)))
}
defer os.Remove(name)
defer file.Close()
logger := New(
NewLogfmt(file),
false,
).Domain("test")
b.ResetTimer()
for i := 0; i < b.N; i++ {
logger.Print(msg)
}
}
示例8: TestCursorSkipNobucket
func TestCursorSkipNobucket(t *testing.T) {
filename, err := rand.FileName("blog-", "db", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
dir, err := ioutil.TempDir("", "blog-")
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
db, err := bolt.Open(filepath.Join(dir, filename), 0600, nil)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.View(func(tx *bolt.Tx) error {
c := &Cursor{
Tx: tx,
Bucket: []byte("test_bucket"),
NumKeys: 3,
}
err := c.Init()
if err != nil {
return e.Forward(err)
}
c.Skip(3)
if err := c.Err(); err != nil {
return e.Forward(err)
}
return nil
})
if err != nil && !e.Equal(err, ErrInvBucket) {
t.Fatal(e.Trace(e.Forward(err)))
}
}
示例9: TestCursorSeek
func TestCursorSeek(t *testing.T) {
data := []testData{
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key1")}, []byte("11")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key2")}, []byte("12")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key3")}, []byte("13")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key1")}, []byte("21")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key2")}, []byte("22")},
{[]byte("test_bucket"), [][]byte{[]byte("key3"), []byte("key1")}, []byte("31")},
}
filename, err := rand.FileName("blog-", "db", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
dir, err := ioutil.TempDir("", "blog-")
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
db, err := bolt.Open(filepath.Join(dir, filename), 0600, nil)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.Update(func(tx *bolt.Tx) error {
for i, d := range data {
err := Put(tx, d.Bucket, d.Keys, d.Data)
if err != nil {
return e.Push(err, e.New("Fail to put %v", i))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.View(func(tx *bolt.Tx) error {
c := &Cursor{
Tx: tx,
Bucket: []byte("test_bucket"),
NumKeys: 2,
}
err := c.Init()
if err != nil {
return e.Forward(err)
}
for i, d := range data {
k, v := c.Seek(d.Keys...)
if k == nil {
return e.New("key not found")
}
for j, key := range k {
if !bytes.Equal(key, data[i].Keys[j]) {
return e.New("key is not equal %v %v %v", i, string(key), string(data[i].Keys[j]))
}
}
if !bytes.Equal(v, data[i].Data) {
return e.New("not equal %v", string(v))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
data2 := []testData{
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key1")}, []byte("11")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key4")}, []byte("21")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key3")}, []byte("31")},
{[]byte("test_bucket"), [][]byte{[]byte("key4"), []byte("key1")}, nil},
}
err = db.View(func(tx *bolt.Tx) error {
c := &Cursor{
Tx: tx,
Bucket: []byte("test_bucket"),
NumKeys: 2,
}
err := c.Init()
if err != nil {
return e.Forward(err)
}
for i, d := range data2 {
k, v := c.Seek(d.Keys...)
if k == nil && d.Data == nil {
continue
} else if k == nil && d.Data != nil {
return e.New("key not found %v", i)
}
if !bytes.Equal(v, data2[i].Data) {
return e.New("not equal %v %v %v", i, string(v), string(data2[i].Data))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
//.........這裏部分代碼省略.........
示例10: TestIndex
func TestIndex(t *testing.T) {
data := []testData{
{[]byte("test_bucket1"), [][]byte{[]byte("key1")}, []byte("lorem")},
{[]byte("test_bucket2"), [][]byte{[]byte("key1"), []byte("key2")}, []byte("datadatadatadatadata")},
{[]byte("test_bucket2"), [][]byte{[]byte("key1"), []byte("key3")}, []byte("3")},
{[]byte("test_bucket3"), [][]byte{[]byte("key1"), []byte("key2"), []byte("key3")}, []byte("catoto")},
}
filename, err := rand.FileName("blog-", "db", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
dir, err := ioutil.TempDir("", "blog-")
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
db, err := bolt.Open(filepath.Join(dir, filename), 0600, nil)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.Update(func(tx *bolt.Tx) error {
for i, d := range data {
err := Put(tx, d.Bucket, d.Keys, d.Data)
if err != nil {
return e.Push(err, e.New("Fail to put %v", i))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.View(func(tx *bolt.Tx) error {
for i, d := range data {
data, err := Get(tx, d.Bucket, d.Keys)
if err != nil {
return e.Push(err, e.New("Fail to get %v", i))
}
if !bytes.Equal(data, d.Data) {
return e.New("not equal %v", i)
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.Update(func(tx *bolt.Tx) error {
err = Del(tx, data[0].Bucket, data[0].Keys)
if err != nil {
return e.Push(err, e.New("Fail to del %v", 0))
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.View(func(tx *bolt.Tx) error {
for i, d := range data {
data, err := Get(tx, d.Bucket, d.Keys)
if i == 0 {
if err != nil && !e.Equal(err, ErrKeyNotFound) {
return e.Push(err, "fail with the wrong error")
} else if err == nil {
return e.New("not fail")
}
continue
}
if err != nil {
return e.Push(err, e.New("Fail to get %v", i))
}
if !bytes.Equal(data, d.Data) {
return e.New("not equal %v", i)
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.Update(func(tx *bolt.Tx) error {
for i, d := range data[1:] {
err := Del(tx, d.Bucket, d.Keys)
if err != nil {
return e.Push(err, e.New("Fail to del %v", i))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
//.........這裏部分代碼省略.........
示例11: TestDel
func TestDel(t *testing.T) {
buckets := []string{"test_del"}
data := []testData{
{[]byte("test_del"), [][]byte{[]byte("key-a1"), []byte("key-b1"), []byte("key-c1")}, []byte("epson")},
{[]byte("test_del"), [][]byte{[]byte("key-a2"), []byte("key-b2"), []byte("key-c2")}, []byte("catoto")},
{[]byte("test_del"), [][]byte{[]byte("key-a3"), []byte("key-b3"), []byte("key-c3")}, []byte("catoto")},
}
filename, err := rand.FileName("blog-", "db", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
dir, err := ioutil.TempDir("", "blog-")
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
db, err := bolt.Open(filepath.Join(dir, filename), 0600, nil)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.Update(func(tx *bolt.Tx) error {
for i, d := range data {
err := Put(tx, d.Bucket, d.Keys, d.Data)
if err != nil {
return e.Push(err, e.New("Fail to put %v", i))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = PrintDb(db, buckets)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.Update(func(tx *bolt.Tx) error {
for i, d := range data {
err := Del(tx, d.Bucket, d.Keys)
if err != nil {
PrintDbTx(tx, buckets)
return e.Push(err, e.New("Fail to del %v", i))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = PrintDb(db, buckets)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = DbEmpty(db, buckets)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
}
示例12: TestCursorRevSkipKeys
func TestCursorRevSkipKeys(t *testing.T) {
data := []testData{
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key1")}, []byte("11")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key2")}, []byte("12")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key3")}, []byte("13")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key1")}, []byte("21")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key2")}, []byte("22")},
{[]byte("test_bucket"), [][]byte{[]byte("key3"), []byte("key1")}, []byte("31")},
}
filename, err := rand.FileName("blog-", "db", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
dir, err := ioutil.TempDir("", "blog-")
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
db, err := bolt.Open(filepath.Join(dir, filename), 0600, nil)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.Update(func(tx *bolt.Tx) error {
for i, d := range data {
err := Put(tx, d.Bucket, d.Keys, d.Data)
if err != nil {
return e.Push(err, e.New("Fail to put %v", i))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.View(func(tx *bolt.Tx) error {
c := &Cursor{
Tx: tx,
Bucket: []byte("test_bucket"),
NumKeys: 2,
Reverse: true,
}
err := c.Init([]byte("key2"))
if err != nil {
return e.Forward(err)
}
//Next
i := 4
for k, v := c.First(); k != nil; k, v = c.Next() {
if !bytes.Equal(v, data[i].Data) {
return e.New("not equal %v", string(v))
}
for j, key := range k {
if !bytes.Equal(key, data[i].Keys[j]) {
return e.New("key is not equal %v %v", string(key), string(data[i].Keys[j]))
}
}
i--
}
t.Log(i)
if i > 2 {
t.Fatal("iterator didn't stop", i)
}
//Prev
i = 3
for k, v := c.Last(); k != nil; k, v = c.Prev() {
if !bytes.Equal(v, data[i].Data) {
return e.New("not equal %v", string(v))
}
for j, key := range k {
if !bytes.Equal(key, data[i].Keys[j]) {
return e.New("key is not equal %v %v", string(key), string(data[i].Keys[j]))
}
}
i++
}
t.Log(i)
if i < 5 {
t.Fatal("iterator didn't stop", i)
}
//Skip
var m uint64
var j int = 4
for ; j < 2; j-- {
keys, val := c.Skip(m)
if err := c.Err(); err != nil {
return e.Forward(err)
}
if keys == nil {
return e.New("skip returned nil")
}
if !bytes.Equal(val, data[j].Data) {
return e.New("not equal %v %v %v", m, string(val), string(data[j].Data))
}
//.........這裏部分代碼省略.........
示例13: TestCursorRevSkip
func TestCursorRevSkip(t *testing.T) {
data := []testData{
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key1")}, []byte("11")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key2")}, []byte("12")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key3")}, []byte("13")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key1")}, []byte("21")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key2")}, []byte("22")},
{[]byte("test_bucket"), [][]byte{[]byte("key3"), []byte("key1")}, []byte("31")},
}
filename, err := rand.FileName("blog-", "db", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
dir, err := ioutil.TempDir("", "blog-")
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
db, err := bolt.Open(filepath.Join(dir, filename), 0600, nil)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.Update(func(tx *bolt.Tx) error {
for i, d := range data {
err := Put(tx, d.Bucket, d.Keys, d.Data)
if err != nil {
return e.Push(err, e.New("Fail to put %v", i))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.View(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte("test_bucket"))
buf := b.Get([]byte("key1"))
if buf == nil {
return e.New("key not found")
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.View(func(tx *bolt.Tx) error {
c := &Cursor{
Tx: tx,
Bucket: []byte("test_bucket"),
NumKeys: 2,
Reverse: true,
}
c.Init()
var i uint64
for ; i < uint64(len(data))-1; i++ {
err := skiprev(i, c, data)
if err != nil {
return e.Forward(err)
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
}
示例14: TestCursorRevPrev
func TestCursorRevPrev(t *testing.T) {
data := []testData{
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key1")}, []byte("11")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key2")}, []byte("12")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key3")}, []byte("13")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key1")}, []byte("21")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key2")}, []byte("22")},
{[]byte("test_bucket"), [][]byte{[]byte("key3"), []byte("key1")}, []byte("31")},
}
filename, err := rand.FileName("blog-", "db", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
dir, err := ioutil.TempDir("", "blog-")
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
db, err := bolt.Open(filepath.Join(dir, filename), 0600, nil)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.Update(func(tx *bolt.Tx) error {
for i, d := range data {
err := Put(tx, d.Bucket, d.Keys, d.Data)
if err != nil {
return e.Push(err, e.New("Fail to put %v", i))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.View(func(tx *bolt.Tx) error {
c := &Cursor{
Tx: tx,
Bucket: []byte("test_bucket"),
NumKeys: 2,
Reverse: true,
}
c.Init()
i := 0
for k, v := c.Last(); k != nil; k, v = c.Prev() {
if !bytes.Equal(v, data[i].Data) {
return e.New("not equal %v", string(v))
}
for j, key := range k {
if !bytes.Equal(key, data[i].Keys[j]) {
return e.New("key is not equal %v %v", string(key), string(data[i].Keys[j]))
}
}
i++
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
}
示例15: TestCursorFirstLast
func TestCursorFirstLast(t *testing.T) {
data := []testData{
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key1")}, []byte("11")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key2")}, []byte("12")},
{[]byte("test_bucket"), [][]byte{[]byte("key1"), []byte("key3")}, []byte("13")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key1")}, []byte("21")},
{[]byte("test_bucket"), [][]byte{[]byte("key2"), []byte("key2")}, []byte("22")},
{[]byte("test_bucket"), [][]byte{[]byte("key3"), []byte("key1")}, []byte("31")},
}
filename, err := rand.FileName("blog-", "db", 10)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
dir, err := ioutil.TempDir("", "blog-")
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
db, err := bolt.Open(filepath.Join(dir, filename), 0600, nil)
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.Update(func(tx *bolt.Tx) error {
for i, d := range data {
err := Put(tx, d.Bucket, d.Keys, d.Data)
if err != nil {
return e.Push(err, e.New("Fail to put %v", i))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
err = db.View(func(tx *bolt.Tx) error {
c := &Cursor{
Tx: tx,
Bucket: []byte("test_bucket"),
NumKeys: 2,
}
err := c.Init()
if err != nil {
return e.Forward(err)
}
keys, val := c.First()
if keys == nil {
return e.New("First returned nil")
}
if !bytes.Equal(val, data[0].Data) {
return e.New("not equal %v %v", string(val), string(data[0].Data))
}
for i, key := range keys {
if !bytes.Equal(key, data[0].Keys[i]) {
return e.New("key is not equal %v %v", string(key), string(data[0].Keys[i]))
}
}
keys, val = c.Last()
if keys == nil {
return e.New("First returned nil")
}
l := len(data) - 1
if !bytes.Equal(val, data[l].Data) {
return e.New("not equal %v", string(val))
}
for i, key := range keys {
if !bytes.Equal(key, data[l].Keys[i]) {
return e.New("key is not equal %v %v", string(key), string(data[l].Keys[i]))
}
}
return nil
})
if err != nil {
t.Fatal(e.Trace(e.Forward(err)))
}
}