Skip to content

Commit 0af7c81

Browse files
authored
Merge pull request #10 from tunabay/dev
Use Go 1.17
2 parents a7e8e17 + 4ddf38e commit 0af7c81

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed

.ci/golangci-lint.yml

+38-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
run:
22
timeout: 5m
3-
tests: false
3+
tests: true
44
fast: false
55
skip-dirs-use-default: true
66
print-issued-lines: true
@@ -12,7 +12,6 @@ linters:
1212
enable:
1313
- deadcode
1414
- errcheck
15-
- errname
1615
- gosimple
1716
- govet
1817
- ineffassign
@@ -21,9 +20,11 @@ linters:
2120
- typecheck
2221
- unused
2322
- varcheck
23+
2424
- asciicheck
2525
- bodyclose
2626
- dogsled
27+
- errname
2728
- errorlint
2829
- exportloopref
2930
- forbidigo
@@ -56,7 +57,40 @@ linters:
5657
- whitespace
5758
- wrapcheck
5859

60+
linters-settings:
61+
gofumpt:
62+
lang-version: "1.17"
63+
gosimple:
64+
go: "1.17"
65+
staticcheck:
66+
go: "1.17"
67+
stylecheck:
68+
go: "1.17"
69+
unused:
70+
go: "1.17"
71+
72+
misspell:
73+
locale: US
74+
75+
errcheck:
76+
exclude-functions:
77+
- io/ioutil.ReadFile
78+
- io.Copy(*bytes.Buffer)
79+
- io.Copy(os.Stdout)
80+
- (*github.com/tunabay/go-bitarray.Builder).WriteBit
81+
- (*github.com/tunabay/go-bitarray.Builder).WriteByte
82+
- (*github.com/tunabay/go-bitarray.Builder).WriteBitArray
83+
5984
issues:
60-
max-issues-per-linter: 1023
61-
max-same-issues: 255
85+
max-issues-per-linter: 0
86+
max-same-issues: 0
6287
fix: false
88+
89+
exclude-use-default: true
90+
exclude-rules:
91+
92+
# ignore in unit tests
93+
- linters: [ gosec, goerr113, ifshort ]
94+
path: "_test\\.go$"
95+
- linters: [ staticcheck ]
96+
text: "^SA9003: empty branch"

bitarray_sha512_example_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func ExampleBitArray_SHA384() {
3434
// c6b08368812f4f02aaf84c1b8fcd549f53099816b212fe68cb32f6d73563fae8cec52b96051ade12ba8f3c6a6e98a616
3535
}
3636

37-
func ExampleBitArray_SHA512_256() {
37+
func ExampleBitArray_SHA512_256() { //nolint: govet // false positive for _256 suffix
3838
ba1 := bitarray.MustParse("0000")
3939
ba2 := bitarray.MustParse("00000")
4040

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/tunabay/go-bitarray
22

3-
go 1.16
3+
go 1.17
44

55
require gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b

util.go

+1-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package bitarray
66

77
import (
88
"fmt"
9-
"reflect"
109
"unsafe"
1110
)
1211

@@ -344,18 +343,7 @@ func allocByteSlice(nBytes int) []byte {
344343
}
345344

346345
func asUint64Slice(b []byte) []uint64 {
347-
// s := (*[cap(b)>>3]uint64)(unsafe.Pointer(&b[0]))[:]
348-
349-
n := (len(b) + 7) >> 3
350-
s := make([]uint64, 0)
351-
h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
352-
h.Data, h.Len, h.Cap = uintptr(unsafe.Pointer(&b[0])), n, n
353-
354-
// Since go1.17
355-
// 2021-08-21: golangcilint v1.42.0 does not support go1.17?
356-
// s := unsafe.Slice((*uint64)(unsafe.Pointer(&b[0])), (len(b)+7)>>3)
357-
358-
return s
346+
return unsafe.Slice((*uint64)(unsafe.Pointer(&b[0])), (len(b)+7)>>3)
359347
}
360348

361349
func fill00(b []byte) {

0 commit comments

Comments
 (0)