This repository was archived by the owner on Dec 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +85
-11
lines changed Expand file tree Collapse file tree 6 files changed +85
-11
lines changed Original file line number Diff line number Diff line change 1- # : package-name
1+ # contracts
22
3- [ ![ Go Version] ( https://badgen.net/github/release/go-packagist/:package-name /stable )] ( https://github.com/go-packagist/:package-name /releases )
4- [ ![ GoDoc] ( https://pkg.go.dev/badge/github.com/go-packagist/:package-name )] ( https://pkg.go.dev/github.com/go-packagist/:package-name )
5- [ ![ codecov] ( https://codecov.io/gh/go-packagist/:package-name /branch/master/graph/badge.svg?token=5TWGQ9DIRU )] ( https://codecov.io/gh/go-packagist/:package-name )
6- [ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/go-packagist/:package-name )] ( https://goreportcard.com/report/github.com/go-packagist/:package-name )
7- [ ![ tests] ( https://github.com/go-packagist/:package-name /actions/workflows/go.yml/badge.svg )] ( https://github.com/go-packagist/:package-name /actions/workflows/go.yml )
3+ [ ![ Go Version] ( https://badgen.net/github/release/go-packagist/contracts /stable )] ( https://github.com/go-packagist/contracts /releases )
4+ [ ![ GoDoc] ( https://pkg.go.dev/badge/github.com/go-packagist/contracts )] ( https://pkg.go.dev/github.com/go-packagist/contracts )
5+ [ ![ codecov] ( https://codecov.io/gh/go-packagist/contracts /branch/master/graph/badge.svg?token=5TWGQ9DIRU )] ( https://codecov.io/gh/go-packagist/contracts )
6+ [ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/go-packagist/contracts )] ( https://goreportcard.com/report/github.com/go-packagist/contracts )
7+ [ ![ tests] ( https://github.com/go-packagist/contracts /actions/workflows/go.yml/badge.svg )] ( https://github.com/go-packagist/contracts /actions/workflows/go.yml )
88[ ![ MIT license] ( https://img.shields.io/badge/license-MIT-brightgreen.svg )] ( https://opensource.org/licenses/MIT )
99
1010## Installation
1111
1212``` bash
13- go get github.com/go-packagist/:package-name
13+ go get github.com/go-packagist/contracts
1414```
1515
16- ## Usage
16+ ## List
1717
18- ``` go
19- // TODO: Write usage instructions
20- ```
18+ - [ ` Hasher ` ] ( hashing ) : Hashing interface
19+ - [ ` Provider ` ] ( provider ) : Provider interface
2120
2221## License
2322
Original file line number Diff line number Diff line change 1+ module github.com/go-packagist/contracts
2+
3+ go 1.20
4+
5+ require github.com/stretchr/testify v1.8.2
6+
7+ require (
8+ github.com/davecgh/go-spew v1.1.1 // indirect
9+ github.com/pmezard/go-difflib v1.0.0 // indirect
10+ gopkg.in/yaml.v3 v3.0.1 // indirect
11+ )
Original file line number Diff line number Diff line change 1+ github.com/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
2+ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c =
3+ github.com/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
4+ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
5+ github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
6+ github.com/stretchr/objx v0.1.0 /go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME =
7+ github.com/stretchr/objx v0.4.0 /go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw =
8+ github.com/stretchr/objx v0.5.0 /go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo =
9+ github.com/stretchr/testify v1.7.1 /go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg =
10+ github.com/stretchr/testify v1.8.0 /go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU =
11+ github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8 =
12+ github.com/stretchr/testify v1.8.2 /go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4 =
13+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM =
14+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 /go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0 =
15+ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c /go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM =
16+ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA =
17+ gopkg.in/yaml.v3 v3.0.1 /go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM =
Original file line number Diff line number Diff line change 1+ package hashing
2+
3+ type Hasher interface {
4+ Make (value string ) (string , error )
5+ MustMake (value string ) string
6+ Check (value , hashedValue string ) bool
7+ }
Original file line number Diff line number Diff line change 1+ package provider
2+
3+ type Provider interface {
4+ Register ()
5+ Boot ()
6+ }
7+
8+ // UnimplementedProvider is a default implementation of the Provider interface.
9+ type UnimplementedProvider struct {
10+ }
11+
12+ // Register is a default implementation of the Provider interface.
13+ func (u * UnimplementedProvider ) Register () {
14+ }
15+
16+ // Boot is a default implementation of the Provider interface.
17+ func (u * UnimplementedProvider ) Boot () {
18+ }
Original file line number Diff line number Diff line change 1+ package provider
2+
3+ import (
4+ "github.com/stretchr/testify/assert"
5+ "testing"
6+ )
7+
8+ type testProvider struct {
9+ * UnimplementedProvider
10+ }
11+
12+ func TestPrivider (t * testing.T ) {
13+ test := & testProvider {}
14+ _ , ok := interface {}(test ).(Provider )
15+
16+ assert .True (t , ok )
17+
18+ assert .NotPanics (t , func () {
19+ test .Register ()
20+ test .Boot ()
21+ })
22+ }
You can’t perform that action at this time.
0 commit comments