File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ func RollWord(d int) (int, error) {
172172func (g * Generator ) RollDie () (int , error ) {
173173 r , err := rand .Int (g .randReader , sides )
174174 if err != nil {
175- return 0 , err
175+ return 0 , fmt . Errorf ( "failed to generate a random number: %w" , err )
176176 }
177177 return int (r .Int64 ()) + 1 , nil
178178}
Original file line number Diff line number Diff line change @@ -11,11 +11,13 @@ const (
1111 N = 10000
1212)
1313
14- func testUnique (t testing.TB , list []string ) {
14+ func testUnique (tb testing.TB , list []string ) {
15+ tb .Helper ()
16+
1517 seen := make (map [string ]struct {}, len (list ))
1618 for _ , v := range list {
1719 if _ , ok := seen [v ]; ok {
18- t .Errorf ("found duplicate: %q" , list )
20+ tb .Errorf ("found duplicate: %q" , list )
1921 }
2022 seen [v ] = struct {}{}
2123 }
@@ -82,8 +84,6 @@ func TestGenerateWordList(t *testing.T) {
8284 }
8385
8486 for _ , tc := range cases {
85- tc := tc
86-
8787 t .Run (tc .name , func (t * testing.T ) {
8888 t .Parallel ()
8989
Original file line number Diff line number Diff line change @@ -12,15 +12,17 @@ type WordList interface {
1212 WordAt (int ) string
1313}
1414
15- // WordListNumWordser is an auxillary interface that returns the number of words
16- // in the list. This is a separate interface for backwards compatability .
15+ // WordListNumWordser is an auxiliary interface that returns the number of words
16+ // in the list. This is a separate interface for backwards compatibility .
1717type WordListNumWordser interface {
1818 // NumWords returns the total number of words in the list.
1919 NumWords () int
2020}
2121
22- var _ WordList = (* wordListInternal )(nil )
23- var _ WordListNumWordser = (* wordListInternal )(nil )
22+ var (
23+ _ WordList = (* wordListInternal )(nil )
24+ _ WordListNumWordser = (* wordListInternal )(nil )
25+ )
2426
2527type wordListInternal struct {
2628 digits int
You can’t perform that action at this time.
0 commit comments