Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.25']
go-version: ['1.26']

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version: '1.25'
go-version: '1.26'

- name: golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9
Expand Down
19 changes: 10 additions & 9 deletions extract/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package extract
import (
"os"
"regexp"
"slices"
"strings"
"unicode/utf8"

Expand Down Expand Up @@ -142,13 +143,13 @@ func FilterIgnoreBlocks(text string) string {
b.WriteString(text[:startIdx])

rest := text[startIdx+len(startMarker):]
endIdx := strings.Index(rest, endMarker)
if endIdx == -1 {
_, after, found := strings.Cut(rest, endMarker)
if !found {
// Unclosed block: discard the rest.
break
}

text = rest[endIdx+len(endMarker):]
text = after
}

return b.String()
Expand All @@ -172,18 +173,18 @@ func ExtractFromFile(path string) (core.ReuseInfo, error) {
return info, nil
}

const binaryCheckLimit = 8192

// isBinary returns true if data looks like a binary file. It checks for null
// bytes and invalid UTF-8 in the first 8KB.
func isBinary(data []byte) bool {
check := data
if len(check) > 8192 {
check = check[:8192]
if len(check) > binaryCheckLimit {
check = check[:binaryCheckLimit]
}

for _, b := range check {
if b == 0 {
return true
}
if slices.Contains(check, 0) {
return true
}

return !utf8.Valid(check)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/git-pkgs/reuse

go 1.25.6
go 1.26.1

require github.com/BurntSushi/toml v1.6.0