@blog • @learnku • @segmentfault • @nonprofit website • @daily favorites • @sponsors
guanguans / id-validator Goto Github PK
View Code? Open in Web Editor NEWChina ID number validator. - **身份证号验证器。
License: MIT License
China ID number validator. - **身份证号验证器。
License: MIT License
func Test02(t *testing.T) {
t.Log(idvalidator.IsLooseValid("010-12345678转152"))
}
stack
--- FAIL: Test02 (0.00s)
panic: runtime error: index out of range [1] with length 0 [recovered]
panic: runtime error: index out of range [1] with length 0
goroutine 8 [running]:
github.com/guanguans/id-validator.generateLongCode({0xd6f66c, 0x12})
/home/xxx/go/pkg/mod/github.com/guanguans/[email protected]/checker.go:58 +0x385
github.com/guanguans/id-validator.generateCode({0xd6f66c?, 0xfb502c?})
/home/xxx/go/pkg/mod/github.com/guanguans/[email protected]/checker.go:24 +0x31
github.com/guanguans/id-validator.IsValid({0xd6f66c?, 0x520a74?}, 0x0?)
/home/xxx/go/pkg/mod/github.com/guanguans/[email protected]/id_validator.go:32 +0x26
github.com/guanguans/id-validator.IsLooseValid(...)
/home/xx/go/pkg/mod/github.com/guanguans/[email protected]/id_validator.go:53
mac intel/m1 均有此问题。
举个例子:320819197004124810 invalid ID card number
调试模式异常:
/Users/mac/go/pkg/mod/github.com/guanguans/[email protected]/data/constellation.go:64:6: internal compiler error: NewBulk too big: nbit=63108 count=883526 nword=1973 size=1743196798
Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new
go version: 1.17
E:\go\pkg\mod\github.com\guanguans\[email protected]\data\constellation.go:64:6: internal compiler error: NewBulk too big: nbit=63108 count=883526 nword=1973 size=1743196798
如题,带X的不能验证通过,如:11010119900307803X
#12 51.29 go build github.com/guanguans/id-validator/data: /usr/local/go/pkg/tool/linux_amd64/compile: signal: killed
// 地址信息
addressInfo := getAddressInfo(code["addressCode"], code["birthdayCode"], strict)
var addressTree []string
for _, val := range addressInfo {
addressTree = append(addressTree, val)
}
江苏地区尾号为19也需要特殊处理
addressCodeTimelineJiangSu中没有321119集合
为空的情况下只处理了01、02、11、20情况
dlv模式下会导致compile进程内存飙升
// 验证身份证号合法性严格模式与非严格具体什么区别?
ffmt.P(idvalidator.IsValid("440308199901101512", false)) // 非严格模式验证大陆居民身份证18位
ffmt.P(idvalidator.IsValid("440308199901101512", true)) // 严格模式验证大陆居民身份证18位
关于校验地址码有效期功能:
例如假身份证号370620199505100123,但是1995年威海地区压根没有370620的地址区划代码。(前六位地址码错误,370620地址码在1987年就废弃了)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.