8000 sliceop: use errors.New for constant errors by dolmen · Pull Request #940 · go-hep/hep · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.
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
7 changes: 4 additions & 3 deletions sliceop/f64s/f64s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package f64s

import (
"errors"
"fmt"
"math/rand"
"reflect"
Expand Down Expand Up @@ -35,9 +36,9 @@ func TestMap(t *testing.T) {

func TestTake(t *testing.T) {
var (
errLength = fmt.Errorf("sliceop: length mismatch")
errSortedIndices = fmt.Errorf("sliceop: indices not sorted")
errDuplicateIndices = fmt.Errorf("sliceop: duplicate indices")
errLength = errors.New("sliceop: length mismatch")
errSortedIndices = errors.New("sliceop: indices not sorted")
errDuplicateIndices = errors.New("sliceop: duplicate indices")
)

for _, tc := range []struct {
Expand Down
10 changes: 4 additions & 6 deletions sliceop/sliceop.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
// slices package.
package sliceop // import "go-hep.org/x/hep/sliceop"

import (
"fmt"
)
import "errors"

var (
errLength = fmt.Errorf("sliceop: length mismatch")
errSortedIndices = fmt.Errorf("sliceop: indices not sorted")
errDuplicateIndices = fmt.Errorf("sliceop: duplicate indices")
errLength = errors.New("sliceop: length mismatch")
errSortedIndices = errors.New("sliceop: indices not sorted")
errDuplicateIndices = errors.New("sliceop: duplicate indices")
)

// Filter creates a slice with all the elements x_i of src for which f(x_i) is true.
Expand Down
0