Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Propagate error from rand.Read, which can fail in some rare cases. #61

Merged
merged 2 commits into from
Aug 17, 2024
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
29 changes: 10 additions & 19 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
---

name: build-check
on: [push, pull_request]
jobs:
build-check:
name: Run build-check on Go ${{ matrix.go }}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
go:
- '1.22'
- '1.21'
- '1.20'
- '1.19'
- '1.18'
- '1.17'
- '1.16'
- '1.15'
- '1.14'
- '1.13'
- '1.12'
- '1.11'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- run: make build_check
save-test-coverage:
name: Save test coverage
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.15
- name: Get test coverage
run: make tests
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
5 changes: 4 additions & 1 deletion bip39.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ func NewEntropy(bitSize int) ([]byte, error) {
}

entropy := make([]byte, bitSize/8)
_, _ = rand.Read(entropy) // err is always nil
_, err := rand.Read(entropy)
if err != nil {
return nil, err
}

return entropy, nil
}
Expand Down
Loading