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

all: cleanup spelling, ineffassign and vet errors #78

Merged
merged 3 commits into from
Jun 20, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion blas/gonum/cmplx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var (
_ blas.Complex128 = Implementation{}
)

// TOOD(btracey): Replace this as complex routines are added, and instead
// TODO(btracey): Replace this as complex routines are added, and instead
// automatically generate the complex64 routines from the complex128 ones.

var noComplex = "native: implementation does not implement this routine, see the cgo wrapper in gonum.org/v1/netlib/blas"
Expand Down
2 changes: 1 addition & 1 deletion blas/gonum/dgemm.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func dgemmParallel(aTrans, bTrans bool, m, n, k int, a []float64, lda int, b []f
go func() {
defer wg.Done()
// Make local copies of otherwise global variables to reduce shared memory.
// This has a noticable effect on benchmarks in some cases.
// This has a noticeable effect on benchmarks in some cases.
alpha := alpha
aTrans := aTrans
bTrans := bTrans
Expand Down
2 changes: 1 addition & 1 deletion blas/gonum/gonum.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func min(a, b int) int {
return a
}

// blocks returns the number of divisons of the dimension length with the given
// blocks returns the number of divisions of the dimension length with the given
// block size.
func blocks(dim, bsize int) int {
return (dim + bsize - 1) / bsize
Expand Down
4 changes: 2 additions & 2 deletions floats/floats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func TestCumProd(t *testing.T) {
emptyReceiver := make([]float64, 0)
truth = []float64{}
CumProd(emptyReceiver, emptyReceiver)
AreSlicesEqual(t, truth, emptyReceiver, "Wrong cumprod returned with emtpy receiver")
AreSlicesEqual(t, truth, emptyReceiver, "Wrong cumprod returned with empty receiver")

}

Expand All @@ -209,7 +209,7 @@ func TestCumSum(t *testing.T) {
emptyReceiver := make([]float64, 0)
truth = []float64{}
CumSum(emptyReceiver, emptyReceiver)
AreSlicesEqual(t, truth, emptyReceiver, "Wrong cumsum returned with emtpy receiver")
AreSlicesEqual(t, truth, emptyReceiver, "Wrong cumsum returned with empty receiver")

}

Expand Down
8 changes: 4 additions & 4 deletions graph/community/bisect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func TestProfileUndirected(t *testing.T) {
t.Errorf("%s: failed to recover low end score: got: %v want: %v", test.name, score, d.Score)
}
if i != 0 && d.Score >= p[i-1].Score {
t.Errorf("%s: not monotonically decreasing: ", test.name, p[i-1], d)
t.Errorf("%s: not monotonically decreasing: %v -> %v", test.name, p[i-1], d)
}
}
}
Expand Down Expand Up @@ -192,7 +192,7 @@ func TestProfileDirected(t *testing.T) {
t.Errorf("%s: failed to recover low end score: got: %v want: %v", test.name, score, d.Score)
}
if i != 0 && d.Score >= p[i-1].Score {
t.Errorf("%s: not monotonically decreasing: ", test.name, p[i-1], d)
t.Errorf("%s: not monotonically decreasing: %v -> %v", test.name, p[i-1], d)
}
}
}
Expand Down Expand Up @@ -227,7 +227,7 @@ func TestProfileUndirectedMultiplex(t *testing.T) {
t.Errorf("%s: failed to recover low end score: got: %v want: %v", test.name, score, d.Score)
}
if i != 0 && d.Score >= p[i-1].Score {
t.Errorf("%s: not monotonically decreasing: ", test.name, p[i-1], d)
t.Errorf("%s: not monotonically decreasing: %v -> %v", test.name, p[i-1], d)
}
}
}
Expand Down Expand Up @@ -262,7 +262,7 @@ func TestProfileDirectedMultiplex(t *testing.T) {
t.Errorf("%s: failed to recover low end score: got: %v want: %v", test.name, score, d.Score)
}
if i != 0 && d.Score >= p[i-1].Score {
t.Errorf("%s: not monotonically decreasing: ", test.name, p[i-1], d)
t.Errorf("%s: not monotonically decreasing: %v -> %v", test.name, p[i-1], d)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion graph/community/louvain_directed.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ func (l *directedLocalMover) deltaQ(n graph.Node) (deltaQ float64, dst int, src
m := l.m
gamma := l.resolution

// Find communites connected to n.
// Find communities connected to n.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha! It's not just me who can't spell.

connected := make(set.Ints)
// The following for loop is equivalent to:
//
Expand Down
2 changes: 1 addition & 1 deletion graph/community/louvain_undirected.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ func (l *undirectedLocalMover) deltaQ(n graph.Node) (deltaQ float64, dst int, sr
m2 := l.m2
gamma := l.resolution

// Find communites connected to n.
// Find communities connected to n.
connected := make(set.Ints)
// The following for loop is equivalent to:
//
Expand Down
2 changes: 1 addition & 1 deletion graph/graphs/gen/duplication.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func Duplication(dst UndirectedMutator, n int, delta, alpha, sigma float64, src
// Loop until we have connectivity
// into the rest of the graph.
for {
// Add edges to parent's neigbours.
// Add edges to parent's neighbours.
to := dst.From(u)
sort.Sort(ordered.ByID(to))
for _, v := range to {
Expand Down
2 changes: 1 addition & 1 deletion graph/graphs/gen/small_world_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestNavigableSmallWorldDirected(t *testing.T) {
n *= d
}
if err != nil {
t.Fatalf("unexpected error: dims=%v n=%d, p=%d, q=%d, r=%v, r=%v: %v", dims, n, p, q, r, err)
t.Fatalf("unexpected error: dims=%v n=%d, p=%d, q=%d, r=%v: %v", dims, n, p, q, r, err)
}
if g.addSelfLoop {
t.Errorf("unexpected self edge: dims=%v n=%d, p=%d, q=%d, r=%v", dims, n, p, q, r)
Expand Down
14 changes: 7 additions & 7 deletions graph/internal/set/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestAdd(t *testing.T) {

for e, n := range s {
if e != n.ID() {
t.Error("Element ID did not match key: %d != %d", e, n.ID())
t.Errorf("Element ID did not match key: %d != %d", e, n.ID())
}
}
}
Expand Down Expand Up @@ -229,7 +229,7 @@ func TestUnionSame(t *testing.T) {
for i, s := range []Nodes{a, b, c} {
for e, n := range s {
if e != n.ID() {
t.Error("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
t.Errorf("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
}
}
}
Expand Down Expand Up @@ -266,7 +266,7 @@ func TestUnionDiff(t *testing.T) {
for i, s := range []Nodes{a, b, c} {
for e, n := range s {
if e != n.ID() {
t.Error("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
t.Errorf("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
}
}
}
Expand Down Expand Up @@ -304,7 +304,7 @@ func TestUnionOverlapping(t *testing.T) {
for i, s := range []Nodes{a, b, c} {
for e, n := range s {
if e != n.ID() {
t.Error("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
t.Errorf("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
}
}
}
Expand Down Expand Up @@ -334,7 +334,7 @@ func TestIntersectSame(t *testing.T) {
for i, s := range []Nodes{a, b, c} {
for e, n := range s {
if e != n.ID() {
t.Error("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
t.Errorf("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
}
}
}
Expand Down Expand Up @@ -368,7 +368,7 @@ func TestIntersectDiff(t *testing.T) {
for i, s := range []Nodes{a, b, c} {
for e, n := range s {
if e != n.ID() {
t.Error("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
t.Errorf("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
}
}
}
Expand Down Expand Up @@ -406,7 +406,7 @@ func TestIntersectOverlapping(t *testing.T) {
for i, s := range []Nodes{a, b, c} {
for e, n := range s {
if e != n.ID() {
t.Error("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
t.Errorf("Element ID did not match key in s%d: %d != %d", i+1, e, n.ID())
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions graph/path/a_star_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var aStarTests = []struct {
g: func() graph.Graph {
tg := internal.NewGrid(10, 10, true)

// Create a partial "wall" accross the middle
// Create a partial "wall" across the middle
// row with a gap at the left-hand end.
tg.Set(4, 1, false)
tg.Set(4, 2, false)
Expand All @@ -94,7 +94,7 @@ var aStarTests = []struct {
g: func() graph.Graph {
tg := internal.NewGrid(10, 10, true)

// Create a partial "wall" accross the middle
// Create a partial "wall" across the middle
// row with a gap at the left-hand end.
tg.Set(4, 1, false)
tg.Set(4, 2, false)
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestAStar(t *testing.T) {
p, cost := pt.To(simple.Node(test.t))

if !topo.IsPathIn(test.g, p) {
t.Error("got path that is not path in input graph for %q", test.name)
t.Errorf("got path that is not path in input graph for %q", test.name)
}

bfp, ok := BellmanFordFrom(simple.Node(test.s), test.g)
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestExhaustiveAStar(t *testing.T) {
gotPath, gotWeight := pt.To(goal)
wantPath, wantWeight, _ := ps.Between(start, goal)
if gotWeight != wantWeight {
t.Errorf("unexpected path weight from %v to %v result: got:%s want:%s",
t.Errorf("unexpected path weight from %v to %v result: got:%f want:%f",
start, goal, gotWeight, wantWeight)
}
if !reflect.DeepEqual(gotPath, wantPath) {
Expand Down Expand Up @@ -272,7 +272,7 @@ func TestAStarNullHeuristic(t *testing.T) {
}

if pt.From().ID() != test.Query.From().ID() {
t.Fatalf("%q: unexpected from node ID: got:%d want:%d", pt.From().ID(), test.Query.From().ID())
t.Fatalf("%q: unexpected from node ID: got:%d want:%d", test.Name, pt.From().ID(), test.Query.From().ID())
}

p, weight := pt.To(test.Query.To())
Expand Down
2 changes: 1 addition & 1 deletion graph/path/bellman_ford_moore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestBellmanFordFrom(t *testing.T) {
}

if pt.From().ID() != test.Query.From().ID() {
t.Fatalf("%q: unexpected from node ID: got:%d want:%d", pt.From().ID(), test.Query.From().ID())
t.Fatalf("%q: unexpected from node ID: got:%d want:%d", test.Name, pt.From().ID(), test.Query.From().ID())
}

p, weight := pt.To(test.Query.To())
Expand Down
2 changes: 1 addition & 1 deletion graph/path/dijkstra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestDijkstraFrom(t *testing.T) {
}

if pt.From().ID() != test.Query.From().ID() {
t.Fatalf("%q: unexpected from node ID: got:%d want:%d", pt.From().ID(), test.Query.From().ID())
t.Fatalf("%q: unexpected from node ID: got:%d want:%d", test.Name, pt.From().ID(), test.Query.From().ID())
}

p, weight := pt.To(test.Query.To())
Expand Down
2 changes: 1 addition & 1 deletion graph/path/dynamic/dstarlite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestDStarLiteNullHeuristic(t *testing.T) {
p, weight := d.Path()

if !math.IsInf(weight, 1) && p[0].ID() != test.Query.From().ID() {
t.Fatalf("%q: unexpected from node ID: got:%d want:%d", p[0].ID(), test.Query.From().ID())
t.Fatalf("%q: unexpected from node ID: got:%d want:%d", test.Name, p[0].ID(), test.Query.From().ID())
}
if weight != test.Weight {
t.Errorf("%q: unexpected weight from Between: got:%f want:%f",
Expand Down
4 changes: 2 additions & 2 deletions graph/topo/bron_kerbosch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ func TestVertexOrdering(t *testing.T) {
}
sort.Ints(got)
if !reflect.DeepEqual(got, want) {
t.Errorf("unexpected %d-core for test %d:\ngot: %v\nwant:%v", got, test.wantCore)
t.Errorf("unexpected %d-core for test %d:\ngot: %v\nwant:%v", k, i, got, test.wantCore)
}

for j, n := range core[k] {
got[j] = n.ID()
}
sort.Ints(got)
if !reflect.DeepEqual(got, want) {
t.Errorf("unexpected %d-core for test %d:\ngot: %v\nwant:%v", got, test.wantCore)
t.Errorf("unexpected %d-core for test %d:\ngot: %v\nwant:%v", k, i, got, test.wantCore)
}
offset += len(want)
}
Expand Down
4 changes: 2 additions & 2 deletions graph/topo/topo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestPathExistsInUndirected(t *testing.T) {

got := PathExistsIn(g, simple.Node(test.from), simple.Node(test.to))
if got != test.want {
t.Errorf("unexpected result for path existance in test %d: got:%t want %t", i, got, test.want)
t.Errorf("unexpected result for path existence in test %d: got:%t want %t", i, got, test.want)
}
}
}
Expand Down Expand Up @@ -124,7 +124,7 @@ func TestPathExistsInDirected(t *testing.T) {

got := PathExistsIn(g, simple.Node(test.from), simple.Node(test.to))
if got != test.want {
t.Errorf("unexpected result for path existance in test %d: got:%t want %t", i, got, test.want)
t.Errorf("unexpected result for path existence in test %d: got:%t want %t", i, got, test.want)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions lapack/testlapack/dgebal.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ func testDgebal(t *testing.T, impl Dgebaler, job lapack.Job, a blas64.General) {

if n == 0 {
if ilo != 0 {
t.Errorf("%v: unexpected ilo when n=0. Want 0, got %v", prefix, n, ilo)
t.Errorf("%v: unexpected ilo when n=0. Want 0, got %v", prefix, ilo)
}
if ihi != -1 {
t.Errorf("%v: unexpected ihi when n=0. Want -1, got %v", prefix, n, ihi)
t.Errorf("%v: unexpected ihi when n=0. Want -1, got %v", prefix, ihi)
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion lapack/testlapack/dgeev.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ func testDgeev(t *testing.T, impl Dgeever, tc string, test dgeevTest, jobvl lapa
}

if first > 0 {
t.Log("%v: all eigenvalues haven't been computed, first=%v", prefix, first)
t.Logf("%v: all eigenvalues haven't been computed, first=%v", prefix, first)
}

// Check that conjugate pair eigevalues are ordered correctly.
Expand Down
2 changes: 1 addition & 1 deletion lapack/testlapack/dhseqr.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func testDhseqr(t *testing.T, impl Dhseqrer, i int, test dhseqrTest, job lapack.
prefix := fmt.Sprintf("Case %v: job=%v, compz=%v, n=%v, ilo=%v, ihi=%v, extra=%v, optwk=%v",
i, job, compz, n, ilo, ihi, extra, optwork)
if unconverged > 0 {
t.Log("%v: Dhseqr did not compute all eigenvalues. unconverged=%v", prefix, unconverged)
t.Logf("%v: Dhseqr did not compute all eigenvalues. unconverged=%v", prefix, unconverged)
if unconverged <= ilo {
t.Fatalf("%v: 0 < unconverged <= ilo", prefix)
}
Expand Down
2 changes: 1 addition & 1 deletion lapack/testlapack/dlaexc.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func testDlaexc(t *testing.T, impl Dlaexcer, wantq bool, n, j1, n1, n2, extra in
if n1 == 1 && n2 == 1 {
t.Errorf("%v: unexpected failure", prefix)
} else {
t.Logf("%v: Dlaexc returned false")
t.Logf("%v: Dlaexc returned false", prefix)
}
}

Expand Down
2 changes: 1 addition & 1 deletion lapack/testlapack/dlaqp2.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Dlaqp2Test(t *testing.T, impl Dlaqp2er) {

impl.Dlaqp2(m, n, test.offset, a.Data, a.Stride, jpiv, tau, vn1, vn2, work)

prefix := fmt.Sprintf("Case %v (offset=%t,m=%v,n=%v,extra=%v)", ti, test.offset, m, n, extra)
prefix := fmt.Sprintf("Case %v (offset=%d,m=%v,n=%v,extra=%v)", ti, test.offset, m, n, extra)
if !generalOutsideAllNaN(a) {
t.Errorf("%v: out-of-range write to A", prefix)
}
Expand Down
2 changes: 1 addition & 1 deletion lapack/testlapack/dlaqps.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func DlaqpsTest(t *testing.T, impl Dlaqpser) {

kb := impl.Dlaqps(m, n, test.offset, test.nb, a.Data, a.Stride, jpiv, tau, vn1, vn2, auxv, f.Data, f.Stride)

prefix := fmt.Sprintf("Case %v (offset=%t,m=%v,n=%v,extra=%v)", ti, test.offset, m, n, extra)
prefix := fmt.Sprintf("Case %v (offset=%d,m=%v,n=%v,extra=%v)", ti, test.offset, m, n, extra)
if !generalOutsideAllNaN(a) {
t.Errorf("%v: out-of-range write to A", prefix)
}
Expand Down
4 changes: 2 additions & 2 deletions lapack/testlapack/dlaqr23.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ func testDlaqr23(t *testing.T, impl Dlaqr23er, test dlaqr23Test, opt bool, recur
t.Errorf("%v: out-of-range write to WV\n%v", prefix, wv.Data)
}
if !isAllNaN(sr[:kbot-nd-ns+1]) || !isAllNaN(sr[kbot+1:]) {
t.Errorf("%v: out-of-range write to sr")
t.Errorf("%v: out-of-range write to sr", prefix)
}
if !isAllNaN(si[:kbot-nd-ns+1]) || !isAllNaN(si[kbot+1:]) {
t.Errorf("%v: out-of-range write to si")
t.Errorf("%v: out-of-range write to si", prefix)
}

if !isUpperHessenberg(h) {
Expand Down
6 changes: 3 additions & 3 deletions lapack/testlapack/dlaset.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ func DlasetTest(t *testing.T, impl Dlaseter) {
}
for i := 0; i < min(m, n); i++ {
if a.Data[i*a.Stride+i] != beta {
t.Errorf("%v: unexpected diagonal of A")
t.Errorf("%v: unexpected diagonal of A", prefix)
}
}
if uplo == blas.Upper || uplo == blas.All {
for i := 0; i < m; i++ {
for j := i + 1; j < n; j++ {
if a.Data[i*a.Stride+j] != alpha {
t.Errorf("%v: unexpected upper triangle of A")
t.Errorf("%v: unexpected upper triangle of A", prefix)
}
}
}
Expand All @@ -65,7 +65,7 @@ func DlasetTest(t *testing.T, impl Dlaseter) {
for i := 1; i < m; i++ {
for j := 0; j < min(i, n); j++ {
if a.Data[i*a.Stride+j] != alpha {
t.Errorf("%v: unexpected lower triangle of A")
t.Errorf("%v: unexpected lower triangle of A", prefix)
}
}
}
Expand Down