lint: fix issues in examples (#49)

This commit is contained in:
Michael McLoughlin
2019-01-13 10:12:52 -08:00
parent 943d5f0ced
commit 4aa8656eb0
11 changed files with 22 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
package args
// Struct is a struct containing various datatypes, to help demonstrate struct field access.
type Struct struct {
Byte byte
Int8 int8
@@ -15,6 +16,7 @@ type Struct struct {
Complex128 complex128
}
// Sub is a sub-struct of Struct, to demonstrate nested datastructure accesses.
type Sub struct {
A uint64
B [3]byte

View File

@@ -11,7 +11,9 @@ import (
func TestHash64(t *testing.T) {
expect := func(data []byte) uint64 {
h := fnv.New64a()
h.Write(data)
if _, err := h.Write(data); err != nil {
t.Fatal(err)
}
return h.Sum64()
}
if err := quick.CheckEqual(Hash64, expect, nil); err != nil {

View File

@@ -1,5 +1,6 @@
package returns
// Struct is used to deomonstrate writing struct return values.
type Struct struct {
Word uint16
Point [2]float64

View File

@@ -4,11 +4,13 @@ import (
"encoding/binary"
)
const (
Size = 20
BlockSize = 64
)
// Size of a SHA-1 checksum in bytes.
const Size = 20
// BlockSize is the block size of SHA-1 in bytes.
const BlockSize = 64
// Sum returns the SHA-1 checksum of data.
func Sum(data []byte) [Size]byte {
n := len(data)
h := [5]uint32{0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0}
@@ -21,7 +23,7 @@ func Sum(data []byte) [Size]byte {
// Final block.
tmp := make([]byte, BlockSize)
copy(tmp[:], data)
copy(tmp, data)
tmp[len(data)] = 0x80
if len(data) >= 56 {

View File

@@ -1,4 +1,4 @@
// Downloaded from https://raw.githubusercontent.com/demerphq/BeagleHash/5f8620b953230e5b16171b745155fc3b0ef8f75e/LICENSE
// Code generated by downloading from https://raw.githubusercontent.com/demerphq/BeagleHash/5f8620b953230e5b16171b745155fc3b0ef8f75e/LICENSE. DO NOT EDIT.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

View File

@@ -4,7 +4,7 @@ dl() {
url=$1
filename=$(basename $1)
{
echo "// Downloaded from ${url}"
echo "// Code generated by downloading from ${url}. DO NOT EDIT."
echo
curl -L ${url}
} > ${filename}

View File

@@ -1,4 +1,4 @@
// Downloaded from https://github.com/dgryski/go-stadtx/raw/3c3d9b328c24a9b5ecd370654cd6e9d60a85752d/stadtx.go
// Code generated by downloading from https://github.com/dgryski/go-stadtx/raw/3c3d9b328c24a9b5ecd370654cd6e9d60a85752d/stadtx.go. DO NOT EDIT.
// Package stadtx implements Stadtx Hash
/*

View File

@@ -1,4 +1,4 @@
// Downloaded from https://github.com/dgryski/go-stadtx/raw/3c3d9b328c24a9b5ecd370654cd6e9d60a85752d/stadtx_test.go
// Code generated by downloading from https://github.com/dgryski/go-stadtx/raw/3c3d9b328c24a9b5ecd370654cd6e9d60a85752d/stadtx_test.go. DO NOT EDIT.
package stadtx