Skip to content

cegielkowski/pisvalidator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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