Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 1.02 KB

File metadata and controls

54 lines (38 loc) · 1.02 KB

pisvalidator

Brazilian pis validator (PIS) - validation package in Golang.

It is an essential package to validate PIS number in your application.

Information about PIS

Installation

Use the go tool for do that:

$ go get github.com/Cegielkowski/pisvalidator

Usage

You need to import the package github.com/Cegielkowski/pisvalidator like that:

import (
    pisvalidator "github.com/Cegielkowski/pisvalidator"
)

Example

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
}

License

License