Brazilian pis validator (PIS) - validation package in Golang.
It is an essential package to validate PIS number in your application.
Use the go tool
for do that:
$ go get github.com/Cegielkowski/pisvalidator
You need to import the package github.com/Cegielkowski/pisvalidator
like that:
import (
pisvalidator "github.com/Cegielkowski/pisvalidator"
)
package main
import (
"fmt"
pisvalidator "github.com/Cegielkowski/pisvalidator"
)
func main() {
// This will validate the PIS and clean the formatting.
pis, err := pisvalidator.ValidatePis("477.11617.27-5")
// Verifies if it is a valid PIS
if err != nil {
panic(fmt.Errorf("It isn't valid: %v", err))
}
// Formatted output
fmt.Println(pis)
// Output: 47711617275
}