Skip to content

Commit

Permalink
Merge pull request #1 from mtchavez/f-updates
Browse files Browse the repository at this point in the history
Package updates
  • Loading branch information
mtchavez committed Aug 27, 2017
2 parents 5a816af + 1bcc3c8 commit 0b5029b
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 27 deletions.
16 changes: 10 additions & 6 deletions .travis.yml
@@ -1,8 +1,12 @@
language: go
go:
- 1.1
- 1.7
- 1.8
- 1.9
- tip
install:
- go get github.com/onsi/ginkgo
- go get github.com/onsi/gomega
before_script: go test -i ./...
script: go test ./...
sudo: false
before_install:
- go get github.com/mattn/goveralls
script:
- export PATH=$PATH:$HOME/gopath/bin
- make ci
45 changes: 45 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions Gopkg.toml
@@ -0,0 +1,30 @@

# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"


[[constraint]]
name = "github.com/onsi/ginkgo"
version = "1.4.0"

[[constraint]]
name = "github.com/onsi/gomega"
version = "1.2.0"
21 changes: 21 additions & 0 deletions LICENSE.md
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 mtchavez jenkins

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
30 changes: 23 additions & 7 deletions Makefile
@@ -1,11 +1,27 @@
build:
go build jenkins.go
ROOT := $(CURDIR)
GOPKGS = \
golang.org/x/tools/cmd/cover \
github.com/golang/lint/golint \
github.com/golang/dep/cmd/dep

run:
go run jenkins.go
default: test

deps:
@go get -u -v $(GOPKGS)
@dep ensure

lint:
@echo "[Lint] running golint"
@golint

vet:
@echo "[Vet] running go vet"
@go vet

ci: deps vet lint test

test:
go test -cover
@echo "[Test] running tests"
@if [ "$(CI)" ]; then goveralls -service=travis-ci; else go test -v -cover; fi

default:
go run jenkins.go
.PHONY: default golint test vet deps
22 changes: 11 additions & 11 deletions README.md
@@ -1,17 +1,20 @@
Jenkins
=================
# Jenkins Hash

Golang Jenkins hash
[![Latest Version](http://img.shields.io/github/release/mtchavez/jenkins.svg?style=flat-square)](https://github.com/mtchavez/jenkins/releases)
[![Build Status](https://travis-ci.org/mtchavez/jenkins.svg?branch=master)](https://travis-ci.org/mtchavez/jenkins)
[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/mtchavez/jenkins)
[![Coverage Status](https://coveralls.io/repos/github/mtchavez/jenkins/badge.svg)](https://coveralls.io/github/mtchavez/jenkins)
[![Go Report Card](https://goreportcard.com/badge/github.com/mtchavez/jenkins)](https://goreportcard.com/report/github.com/mtchavez/jenkins)

[![Build Status](https://travis-ci.org/mtchavez/go-jenkins-hashes.png?branch=master)](https://travis-ci.org/mtchavez/go-jenkins-hashes)
Golang Jenkins hash

## Install

`go get -u github.com/mtchavez/jenkins`

## Usage

Jenkins follows the [Hash32](http://golang.org/pkg/hash/#Hash32) interface from the Go standard library
Jenkins conforms to the [Hash32](http://golang.org/pkg/hash/#Hash32) interface from the Go standard library

```go
// Create a new hash
Expand All @@ -30,16 +33,13 @@ sumbytes := jenkhash.Sum(key)

## Testing

Uses [Ginkgo](http://onsi.github.io/ginkgo/) for testing.
Uses [Ginkgo][ginkgo] and [Gomega][gomega] for testing.

Run via `make test` which will run `go test -cover`

## Documentation

Docs on [godoc](http://godoc.org/github.com/mtchavez/jenkins)

## License

Written by Chavez

Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
[ginkgo]: https://github.com/onsi/ginkgo
[gomega]: https://github.com/onsi/gomega
12 changes: 9 additions & 3 deletions jenkins.go
Expand Up @@ -4,8 +4,14 @@ import "hash"

type jenkhash uint32

const (
blockSize = 1
hashSize = 4
)

// New returns a new jenkins hash conforming to hash.Hash32 interface
func New() hash.Hash32 {
var j jenkhash = 0
var j jenkhash
return &j
}

Expand All @@ -31,11 +37,11 @@ func (j *jenkhash) Reset() {
}

func (j *jenkhash) Size() int {
return 4
return hashSize
}

func (j *jenkhash) BlockSize() int {
return 1
return blockSize
}

func (j *jenkhash) Sum32() uint32 {
Expand Down

0 comments on commit 0b5029b

Please sign in to comment.