123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package util
- import (
- "crypto/rsa"
- "fmt"
- "testing"
- "time"
- )
- type Struct1 struct {
- Name string
- secret string `dump:"ignore"`
- Codes []string
- Config map[string]*Address
- Age uint
- Timestamp time.Time
- key *rsa.PublicKey
- }
- type Address struct {
- Street string
- City string
- }
- func (address Address) String() string {
- return Dump(address)
- }
- // TestDump test
- func TestDump(t *testing.T) {
- t.Logf("dump string(TEST) %s\n", Dump("TEST"))
- t.Logf("dump int(12) %s\n", Dump(12))
- config := make(map[string]*Address)
- config["kampung"] = &Address{"Jalan", "Solo"}
- config["rumah"] = &Address{"Kampret1", "Jakarta"}
- config["kantor"] = &Address{"Kampret2", "Jakarta"}
- t.Logf("dump Struct1{}\n%s\n", Dump(Struct1{"seno", "secret",
- []string{"sono", "keling"},
- config,
- 17,
- time.Now(),
- &KeyRSA().PublicKey,
- }))
- t.Logf("fmt.Sprintf %s", fmt.Sprintf("HERE\n%v", &Address{"seno", "solo"}))
- }
|