CPF / CNPJ validator and generator written in Go.
import "github.com/martinusso/go-docs/cpf"
Valid return a boolean
valid := cpf.Valid("08507460003")
AssertValid return a boolean and the error if any
valid, err := cpf.AssertValid("08507460003")
Generate return a random valid CPF
doc := cpf.Generate()
import "github.com/martinusso/go-docs/cnpj"
Valid return a boolean
valid := cnpj.Valid("34700442000162")
AssertValid return a boolean and the error if any
valid, err := cnpj.AssertValid("34700442000162")
Generate return a random valid CNPJ
doc := cnpj.Generate()
This software is open source, licensed under the The MIT License (MIT). See LICENSE for details.