Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
5206a111
提交
5206a111
authored
10月 30, 2017
作者:
Lars Gierth
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
godeps: remove unused github.com/mtchavez/jenkins
License: MIT Signed-off-by:
Lars Gierth
<
larsg@systemli.org
>
上级
5146b34a
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
0 行增加
和
253 行删除
+0
-253
Godeps.json
Godeps/Godeps.json
+0
-4
.gitignore
Godeps/_workspace/src/github.com/mtchavez/jenkins/.gitignore
+0
-23
.travis.yml
...ps/_workspace/src/github.com/mtchavez/jenkins/.travis.yml
+0
-8
Makefile
Godeps/_workspace/src/github.com/mtchavez/jenkins/Makefile
+0
-11
README.md
Godeps/_workspace/src/github.com/mtchavez/jenkins/README.md
+0
-45
jenkins.go
Godeps/_workspace/src/github.com/mtchavez/jenkins/jenkins.go
+0
-48
jenkins_suite_test.go
...ace/src/github.com/mtchavez/jenkins/jenkins_suite_test.go
+0
-13
jenkins_test.go
...workspace/src/github.com/mtchavez/jenkins/jenkins_test.go
+0
-101
没有找到文件。
Godeps/Godeps.json
浏览文件 @
5206a111
...
...
@@ -50,10 +50,6 @@
"Rev"
:
"1f6da4a72e57d4e7edd4a7295a585e0a3999a2d4"
},
{
"ImportPath"
:
"github.com/mtchavez/jenkins"
,
"Rev"
:
"5a816af6ef21ef401bff5e4b7dd255d63400f497"
},
{
"ImportPath"
:
"github.com/syndtr/gosnappy/snappy"
,
"Rev"
:
"156a073208e131d7d2e212cb749feae7c339e846"
},
...
...
Godeps/_workspace/src/github.com/mtchavez/jenkins/.gitignore
deleted
100644 → 0
浏览文件 @
5146b34a
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
Godeps/_workspace/src/github.com/mtchavez/jenkins/.travis.yml
deleted
100644 → 0
浏览文件 @
5146b34a
go
:
-
1.1
-
tip
install
:
-
go get github.com/onsi/ginkgo
-
go get github.com/onsi/gomega
before_script
:
go test -i ./...
script
:
go test ./...
Godeps/_workspace/src/github.com/mtchavez/jenkins/Makefile
deleted
100644 → 0
浏览文件 @
5146b34a
build
:
go build jenkins.go
run
:
go run jenkins.go
test
:
go
test
-cover
default
:
go run jenkins.go
Godeps/_workspace/src/github.com/mtchavez/jenkins/README.md
deleted
100644 → 0
浏览文件 @
5146b34a
Jenkins
=================
Golang Jenkins hash
[

](https://travis-ci.org/mtchavez/go-jenkins-hashes)
## 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
```
go
// Create a new hash
jenkhash
:=
New
()
// Write a string of bytes to hash
key
:=
[]
byte
(
"my-random-key"
)
length
,
err
:=
jenkhash
(
key
)
// Get uint32 sum of hash
sum
:=
jenkhash
.
Sum32
()
// Sum hash with byte string
sumbytes
:=
jenkhash
.
Sum
(
key
)
```
## Testing
Uses
[
Ginkgo
](
http://onsi.github.io/ginkgo/
)
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
Godeps/_workspace/src/github.com/mtchavez/jenkins/jenkins.go
deleted
100644 → 0
浏览文件 @
5146b34a
package
jenkins
import
"hash"
type
jenkhash
uint32
func
New
()
hash
.
Hash32
{
var
j
jenkhash
=
0
return
&
j
}
func
(
j
*
jenkhash
)
Write
(
key
[]
byte
)
(
int
,
error
)
{
hash
:=
*
j
for
_
,
b
:=
range
key
{
hash
+=
jenkhash
(
b
)
hash
+=
(
hash
<<
10
)
hash
^=
(
hash
>>
6
)
}
hash
+=
(
hash
<<
3
)
hash
^=
(
hash
>>
11
)
hash
+=
(
hash
<<
15
)
*
j
=
hash
return
len
(
key
),
nil
}
func
(
j
*
jenkhash
)
Reset
()
{
*
j
=
0
}
func
(
j
*
jenkhash
)
Size
()
int
{
return
4
}
func
(
j
*
jenkhash
)
BlockSize
()
int
{
return
1
}
func
(
j
*
jenkhash
)
Sum32
()
uint32
{
return
uint32
(
*
j
)
}
func
(
j
*
jenkhash
)
Sum
(
in
[]
byte
)
[]
byte
{
v
:=
j
.
Sum32
()
return
append
(
in
,
byte
(
v
>>
24
),
byte
(
v
>>
16
),
byte
(
v
>>
8
),
byte
(
v
))
}
Godeps/_workspace/src/github.com/mtchavez/jenkins/jenkins_suite_test.go
deleted
100644 → 0
浏览文件 @
5146b34a
package
jenkins
import
(
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"testing"
)
func
TestJenkins
(
t
*
testing
.
T
)
{
RegisterFailHandler
(
Fail
)
RunSpecs
(
t
,
"Jenkins Suite"
)
}
Godeps/_workspace/src/github.com/mtchavez/jenkins/jenkins_test.go
deleted
100644 → 0
浏览文件 @
5146b34a
package
jenkins
import
(
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"hash"
)
var
_
=
Describe
(
"Jenkins"
,
func
()
{
var
jhash
hash
.
Hash32
var
key
[]
byte
BeforeEach
(
func
()
{
jhash
=
New
()
key
=
[]
byte
(
"Apple"
)
})
Describe
(
"New"
,
func
()
{
It
(
"returns jenkhash"
,
func
()
{
var
h
*
jenkhash
Expect
(
jhash
)
.
To
(
BeAssignableToTypeOf
(
h
))
})
It
(
"initializes offset to 0"
,
func
()
{
Expect
(
jhash
.
Sum32
())
.
To
(
Equal
(
uint32
(
0
)))
})
})
Describe
(
"Write"
,
func
()
{
It
(
"returns key length"
,
func
()
{
length
,
_
:=
jhash
.
Write
(
key
)
Expect
(
length
)
.
To
(
Equal
(
5
))
})
It
(
"has no error"
,
func
()
{
_
,
err
:=
jhash
.
Write
(
key
)
Expect
(
err
)
.
To
(
BeNil
())
})
})
Describe
(
"Reset"
,
func
()
{
It
(
"sets back to 0"
,
func
()
{
Expect
(
jhash
.
Sum32
())
.
To
(
Equal
(
uint32
(
0
)))
jhash
.
Write
(
key
)
Expect
(
jhash
.
Sum32
())
.
NotTo
(
Equal
(
uint32
(
0
)))
jhash
.
Reset
()
Expect
(
jhash
.
Sum32
())
.
To
(
Equal
(
uint32
(
0
)))
})
})
Describe
(
"Size"
,
func
()
{
It
(
"is 4"
,
func
()
{
Expect
(
jhash
.
Size
())
.
To
(
Equal
(
4
))
})
})
Describe
(
"BlockSize"
,
func
()
{
It
(
"is 1"
,
func
()
{
Expect
(
jhash
.
BlockSize
())
.
To
(
Equal
(
1
))
})
})
Describe
(
"Sum32"
,
func
()
{
It
(
"defaults to 0"
,
func
()
{
Expect
(
jhash
.
Sum32
())
.
To
(
Equal
(
uint32
(
0
)))
})
It
(
"sums hash"
,
func
()
{
jhash
.
Write
(
key
)
Expect
(
jhash
.
Sum32
())
.
To
(
Equal
(
uint32
(
884782484
)))
})
})
Describe
(
"Sum"
,
func
()
{
It
(
"default 0 hash byte returned"
,
func
()
{
expected
:=
[]
byte
{
0x41
,
0x70
,
0x70
,
0x6c
,
0x65
,
0x0
,
0x0
,
0x0
,
0x0
}
Expect
(
jhash
.
Sum
(
key
))
.
To
(
Equal
(
expected
))
})
It
(
"returns sum byte array"
,
func
()
{
jhash
.
Write
(
key
)
expected
:=
[]
byte
{
0x41
,
0x70
,
0x70
,
0x6c
,
0x65
,
0x34
,
0xbc
,
0xb5
,
0x94
}
Expect
(
jhash
.
Sum
(
key
))
.
To
(
Equal
(
expected
))
})
})
})
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论