Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# :package-name
# contracts

[![Go Version](https://badgen.net/github/release/go-packagist/:package-name/stable)](https://github.com/go-packagist/:package-name/releases)
[![GoDoc](https://pkg.go.dev/badge/github.com/go-packagist/:package-name)](https://pkg.go.dev/github.com/go-packagist/:package-name)
[![codecov](https://codecov.io/gh/go-packagist/:package-name/branch/master/graph/badge.svg?token=5TWGQ9DIRU)](https://codecov.io/gh/go-packagist/:package-name)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-packagist/:package-name)](https://goreportcard.com/report/github.com/go-packagist/:package-name)
[![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)
[![Go Version](https://badgen.net/github/release/go-packagist/contracts/stable)](https://github.com/go-packagist/contracts/releases)
[![GoDoc](https://pkg.go.dev/badge/github.com/go-packagist/contracts)](https://pkg.go.dev/github.com/go-packagist/contracts)
[![codecov](https://codecov.io/gh/go-packagist/contracts/branch/master/graph/badge.svg?token=5TWGQ9DIRU)](https://codecov.io/gh/go-packagist/contracts)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-packagist/contracts)](https://goreportcard.com/report/github.com/go-packagist/contracts)
[![tests](https://github.com/go-packagist/contracts/actions/workflows/go.yml/badge.svg)](https://github.com/go-packagist/contracts/actions/workflows/go.yml)
[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
go get github.com/go-packagist/:package-name
go get github.com/go-packagist/contracts
```

## Usage
## List

```go
// TODO: Write usage instructions
```
- [`Hasher`](hashing): Hashing interface
- [`Provider`](provider): Provider interface

## License

Expand Down
11 changes: 11 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module github.com/go-packagist/contracts

go 1.20

require github.com/stretchr/testify v1.8.2

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
17 changes: 17 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
7 changes: 7 additions & 0 deletions hashing/hasher.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package hashing

type Hasher interface {
Make(value string) (string, error)
MustMake(value string) string
Check(value, hashedValue string) bool
}
18 changes: 18 additions & 0 deletions provider/provider.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package provider

type Provider interface {
Register()
Boot()
}

// UnimplementedProvider is a default implementation of the Provider interface.
type UnimplementedProvider struct {
}

// Register is a default implementation of the Provider interface.
func (u *UnimplementedProvider) Register() {
}

// Boot is a default implementation of the Provider interface.
func (u *UnimplementedProvider) Boot() {
}
22 changes: 22 additions & 0 deletions provider/provider_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package provider

import (
"github.com/stretchr/testify/assert"
"testing"
)

type testProvider struct {
*UnimplementedProvider
}

func TestPrivider(t *testing.T) {
test := &testProvider{}
_, ok := interface{}(test).(Provider)

assert.True(t, ok)

assert.NotPanics(t, func() {
test.Register()
test.Boot()
})
}