Skip to content

Commit 8569bbc

Browse files
authored
Merge pull request #284 from thaJeztah/cleanup_readme
fix badges in readme, gofmt, and minor linting fix
2 parents 9aa7888 + 732dfcf commit 8569bbc

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

README.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
A collection of packages to augment `testing` and support common patterns.
44

5-
[![GoDoc](https://godoc.org/gotest.tools?status.svg)](https://pkg.go.dev/gotest.tools/v3/?tab=subdirectories)
5+
[![PkgGoDev](https://pkg.go.dev/badge/gotest.tools/v3?status.svg)](https://pkg.go.dev/gotest.tools/v3)
66
[![CircleCI](https://circleci.com/gh/gotestyourself/gotest.tools/tree/main.svg?style=shield)](https://circleci.com/gh/gotestyourself/gotest.tools/tree/main)
7-
[![Go Reportcard](https://goreportcard.com/badge/gotest.tools)](https://goreportcard.com/report/gotest.tools)
7+
[![Go Reportcard](https://goreportcard.com/badge/gotest.tools/v3)](https://goreportcard.com/report/gotest.tools/v3)
88

99
## Usage
1010

11-
With Go modules enabled (go1.11+)
11+
With Go modules enabled
1212

1313
```
1414
$ go get gotest.tools/v3
@@ -18,10 +18,6 @@ $ go get gotest.tools/v3
1818
import "gotest.tools/v3/assert"
1919
```
2020

21-
To use `gotest.tools` with an older version of Go that does not understand Go
22-
module paths pin to version `v2.3.0`.
23-
24-
2521
## Packages
2622

2723
* [assert](http://pkg.go.dev/gotest.tools/v3/assert) -

internal/difflib/difflib.go

+17-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
/*Package difflib is a partial port of Python difflib module.
1+
/*
2+
Package difflib is a partial port of Python difflib module.
23
34
Original source: https://github.com/pmezard/go-difflib
45
56
This file is trimmed to only the parts used by this repository.
67
*/
78
package difflib // import "gotest.tools/v3/internal/difflib"
89

9-
func min(a, b int) int {
10+
func minInt(a, b int) int {
1011
if a < b {
1112
return a
1213
}
1314
return b
1415
}
1516

16-
func max(a, b int) int {
17+
func maxInt(a, b int) int {
1718
if a > b {
1819
return a
1920
}
@@ -170,12 +171,15 @@ func (m *SequenceMatcher) isBJunk(s string) bool {
170171
// If IsJunk is not defined:
171172
//
172173
// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
173-
// alo <= i <= i+k <= ahi
174-
// blo <= j <= j+k <= bhi
174+
//
175+
// alo <= i <= i+k <= ahi
176+
// blo <= j <= j+k <= bhi
177+
//
175178
// and for all (i',j',k') meeting those conditions,
176-
// k >= k'
177-
// i <= i'
178-
// and if i == i', j <= j'
179+
//
180+
// k >= k'
181+
// i <= i'
182+
// and if i == i', j <= j'
179183
//
180184
// In other words, of all maximal matching blocks, return one that
181185
// starts earliest in a, and of all those maximal matching blocks that
@@ -393,12 +397,12 @@ func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {
393397
if codes[0].Tag == 'e' {
394398
c := codes[0]
395399
i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
396-
codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2}
400+
codes[0] = OpCode{c.Tag, maxInt(i1, i2-n), i2, maxInt(j1, j2-n), j2}
397401
}
398402
if codes[len(codes)-1].Tag == 'e' {
399403
c := codes[len(codes)-1]
400404
i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
401-
codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)}
405+
codes[len(codes)-1] = OpCode{c.Tag, i1, minInt(i2, i1+n), j1, minInt(j2, j1+n)}
402406
}
403407
nn := n + n
404408
groups := [][]OpCode{}
@@ -408,11 +412,11 @@ func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {
408412
// End the current group and start a new one whenever
409413
// there is a large range with no changes.
410414
if c.Tag == 'e' && i2-i1 > nn {
411-
group = append(group, OpCode{c.Tag, i1, min(i2, i1+n),
412-
j1, min(j2, j1+n)})
415+
group = append(group, OpCode{c.Tag, i1, minInt(i2, i1+n),
416+
j1, minInt(j2, j1+n)})
413417
groups = append(groups, group)
414418
group = []OpCode{}
415-
i1, j1 = max(i1, i2-n), max(j1, j2-n)
419+
i1, j1 = maxInt(i1, i2-n), maxInt(j1, j2-n)
416420
}
417421
group = append(group, OpCode{c.Tag, i1, i2, j1, j2})
418422
}

0 commit comments

Comments
 (0)