all: address issues identified by golangci-lint
MODIFY
graph/internal/set/set_test.go
graph/internal/set/set_test.go
@@ -13,11 +13,6 @@ type node int64
func (n node) ID() int64 { return int64(n) }
-// count reports the number of elements stored in the node set.
-func (s Nodes) count() int {
- return len(s)
-}
-
// TestSame tests the assumption that pointer equality via unsafe conversion
// of a map[int]struct{} to uintptr is a valid test for perfect identity between
// set values. If any of the tests in TestSame fail, the package is broken and same

MODIFY
graph/layout/layout_test.go
graph/layout/layout_test.go
@@ -7,7 +7,6 @@ package layout
import (
"bytes"
"encoding/base64"
- "fmt"
"image"
"image/png"
"io/ioutil"
@@ -18,10 +17,8 @@ import (
"testing"
"gonum.org/v1/gonum/graph"
- "gonum.org/v1/gonum/graph/encoding"
"gonum.org/v1/gonum/graph/internal/ordered"
"gonum.org/v1/gonum/graph/iterator"
- "gonum.org/v1/gonum/spatial/r2"
"gonum.org/v1/plot/cmpimg"
)
@@ -44,17 +41,6 @@ func (g orderedGraph) From(id int64) graph.Nodes {
return iterator.NewOrderedNodes(n)
}
-// positionNode is a graph.Node with an XY position.
-type positionNode struct {
- id int64
- pos r2.Vec
-}
-
-func (n positionNode) ID() int64 { return n.id }
-func (n positionNode) Attributes() []encoding.Attribute {
- return []encoding.Attribute{{Key: "pos", Value: fmt.Sprintf(`"%f,%f"`, n.pos.X, n.pos.Y)}}
-}
-
func goldenPath(path string) string {
ext := filepath.Ext(path)
noext := strings.TrimSuffix(path, ext)

MODIFY
lapack/gonum/dpbtrs.go
lapack/gonum/dpbtrs.go
@@ -64,5 +64,4 @@ func (Implementation) Dpbtrs(uplo blas.Uplo, n, kd, nrhs int, ab []float64, ldab
bi.Dtbsv(blas.Lower, blas.Trans, blas.NonUnit, n, kd, ab, ldab, b[j:], ldb)
}
}
- return
}

MODIFY
mat/io_test.go
mat/io_test.go
@@ -134,8 +134,8 @@ func TestDenseMarshalTo(t *testing.T) {
if !bytes.Equal(buf.Bytes(), test.raw) {
t.Errorf("error encoding test-%d: bytes mismatch.\n got=%q\nwant=%q\n",
i,
- string(buf.Bytes()),
- string(test.raw),
+ buf.Bytes(),
+ test.raw,
)
continue
}
@@ -415,8 +415,8 @@ func TestVecDenseMarshalTo(t *testing.T) {
if !bytes.Equal(buf.Bytes(), test.raw) {
t.Errorf("error encoding test-%d: bytes mismatch.\n got=%q\nwant=%q\n",
i,
- string(buf.Bytes()),
- string(test.raw),
+ buf.Bytes(),
+ test.raw,
)
continue
}

MODIFY
optimize/bfgs.go
optimize/bfgs.go
@@ -64,7 +64,6 @@ func (b *BFGS) Init(dim, tasks int) int {
func (b *BFGS) Run(operation chan<- Task, result <-chan Task, tasks []Task) {
b.status, b.err = localOptimizer{}.run(b, b.GradStopThreshold, operation, result, tasks)
close(operation)
- return
}
func (b *BFGS) initLocal(loc *Location) (Operation, error) {

MODIFY
optimize/cg.go
optimize/cg.go
@@ -127,7 +127,6 @@ func (cg *CG) Init(dim, tasks int) int {
func (cg *CG) Run(operation chan<- Task, result <-chan Task, tasks []Task) {
cg.status, cg.err = localOptimizer{}.run(cg, cg.GradStopThreshold, operation, result, tasks)
close(operation)
- return
}
func (cg *CG) initLocal(loc *Location) (Operation, error) {

MODIFY
stat/distuv/inversegamma.go
stat/distuv/inversegamma.go
@@ -97,7 +97,7 @@ func (g InverseGamma) Quantile(p float64) float64 {
// Rand panics if either alpha or beta is <= 0.
func (g InverseGamma) Rand() float64 {
// TODO(btracey): See if there is a more direct way to sample.
- return 1 / Gamma{Alpha: g.Alpha, Beta: g.Beta, Src: g.Src}.Rand()
+ return 1 / Gamma(g).Rand()
}
// Survival returns the survival function (complementary CDF) at x.

all: address issues identified by golangci-lint