Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Commit 066db92

Browse files
author
tiechui1994
committed
update util package
1 parent ed5c6e5 commit 066db92

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

util/file.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"path"
77
"encoding/hex"
88
"bytes"
9+
"fmt"
910
)
1011

1112
// FileExists reports whether the named file or directory exists.

util/idcard.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ func init() {
3434
fd, _ := os.Open("./area.json")
3535
decoder := json.NewDecoder(fd)
3636
decoder.Decode(&area)
37-
38-
fmt.Println(area)
3937
}
4038

41-
func identity(card string) (ok bool, addr, birth, sex string) {
39+
func Identity(card string) (ok bool, addr, birth, sex string) {
4240
if regex.MatchString(card) {
4341
var y, m, d, s = "", "", "", ""
4442
sex = "男"

util/rand.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"time"
55
"encoding/hex"
66

7+
crand "crypto/rand"
78
mrand "math/rand"
89
)
910

util/utils_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ import (
88
func TestGetGID(t *testing.T) {
99
fmt.Println(GetGID())
1010
}
11+
12+
func TestIdentity(t *testing.T) {
13+
ok, addr, birth, sex := Identity("612527198911120652")
14+
t.Log("isok", ok)
15+
t.Log("addr", addr)
16+
t.Log("birth", birth)
17+
t.Log("sex", sex)
18+
}

0 commit comments

Comments
 (0)