From 4180821fff80b66cd6e2f5fa015afbd9a7b46596 Mon Sep 17 00:00:00 2001 From: John Starich Date: Wed, 2 Oct 2024 01:04:15 -0500 Subject: [PATCH] Bump to Go 1.23 and latest linter (#68) * Bump to Go 1.23 and latest linter * covet: Fix lint failures on Go 1.23 * gopages: Fix lint failures on Go 1.23 * datasize: Fix lint failures on Go 1.23 * dns: Fix lint failures on Go 1.23 * goop: Fix lint failures on Go 1.23 * pipe: Fix lint failures on Go 1.23 * dns: Use latest x/net --- .github/workflows/ci.yml | 9 ++- .golangci.yml | 7 +- Makefile | 2 +- covet/cmd/covet/run.go | 4 +- covet/cmd/covet/run_test.go | 4 +- covet/covet.go | 37 ++++++--- covet/go.mod | 20 ++++- covet/go.sum | 10 --- covet/internal/coverfile/file.go | 32 ++++---- covet/internal/coverstatus/coverage_status.go | 2 +- covet/internal/minmax/minmax.go | 42 ++-------- covet/internal/minmax/minmax_test.go | 38 ++------- covet/internal/span/span.go | 14 ++-- covet/internal/summary/format.go | 6 +- covet/summary.go | 6 +- datasize/size.go | 2 +- dns/go.mod | 2 +- dns/go.sum | 77 +++++++++++++++++++ dns/resolver_test.go | 2 +- dns/scutil/config_test.go | 2 +- dns/staggercast/conn.go | 16 ++-- dns/staggercast/conn_test.go | 8 +- dns/testlogger_test.go | 5 +- goop/cmd/goop/add_test.go | 2 +- goop/cmd/goop/exec.go | 2 +- goop/cmd/goop/exec_test.go | 18 ++--- goop/cmd/goop/info.go | 2 +- goop/cmd/goop/install.go | 2 +- goop/cmd/goop/install_test.go | 18 ++--- goop/cmd/goop/rm.go | 2 +- goop/cmd/goop/rm_test.go | 8 +- gopages/cmd/watch/main.go | 2 +- gopages/internal/flags/flags.go | 4 +- gopages/internal/generate/generate.go | 6 +- pipe/pipe_test.go | 6 +- 35 files changed, 235 insertions(+), 184 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0029064..5faba6b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,11 +27,12 @@ jobs: - 1.20.x - 1.21.x - 1.22.x + - 1.23.x include: - platform: macos-latest - go: 1.22.x + go: 1.23.x - platform: windows-latest - go: 1.22.x + go: 1.23.x name: Test (Go ${{ matrix.go }} on ${{ matrix.platform }}) runs-on: ${{ matrix.platform }} permissions: @@ -45,9 +46,9 @@ jobs: - name: Test run: make -k test env: - LINT_GO_VERSION: 1.19 + LINT_GO_VERSION: 1.23 - name: Publish test coverage - if: "matrix.platform == 'ubuntu-latest' && matrix.go == '1.19.x'" + if: "matrix.platform == 'ubuntu-latest' && matrix.go == '1.23.x'" run: | # Fetch more commits for coverage diff. commits=${{ github.event.pull_request.commits }} diff --git a/.golangci.yml b/.golangci.yml index afa51311..b587447e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,18 +6,18 @@ linters: - errname - errorlint - exhaustive - - exportloopref + - exportloopref # After minimum Go version hits 1.22, replace this with 'copyloopvar' - gochecknoglobals - gochecknoinits - gocognit - goconst - gocritic - gofmt - - gomnd - gosec - ireturn - makezero - misspell + - mnd - nakedret - nilerr - noctx @@ -41,7 +41,7 @@ issues: - gochecknoglobals # Reflection is slow, so some global reflect types are ok - text: ".*Type is a global variable" - source: ".*Type = reflect.TypeOf\\(.*" + source: ".*Type *= *reflect.TypeOf\\(.*" linters: - gochecknoglobals # False positive for paralleltest usage detection @@ -56,6 +56,7 @@ linters-settings: - anon - error - empty + - generic - stdlib # Also allow these common interfaces: - github\.com\/go-git\/go-billy\/v5 diff --git a/Makefile b/Makefile index 8c6bcc33..675973b8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ SHELL := /usr/bin/env bash -LINT_VERSION=1.50.1 +LINT_VERSION=1.61.0 MODULES = $(sort $(patsubst %/,%,$(dir $(wildcard */go.mod)))) GOLANGCI_FLAGS = diff --git a/covet/cmd/covet/run.go b/covet/cmd/covet/run.go index 3d1eedc6..5bc8e1ea 100644 --- a/covet/cmd/covet/run.go +++ b/covet/cmd/covet/run.go @@ -230,7 +230,7 @@ func findFirstUncoveredLines(lines []covet.Line, startIndex int) (uncovered span for _, l := range lines[nextLineIndex:] { nextLineIndex++ if !l.Covered { - n := int64(l.LineNumber) + n := l.LineNumber uncovered = span.Span{ Start: n, End: n + 1, @@ -241,7 +241,7 @@ func findFirstUncoveredLines(lines []covet.Line, startIndex int) (uncovered span } // find next line number jump or covered line for _, l := range lines[nextLineIndex:] { - if l.Covered || int64(l.LineNumber) != uncovered.End { + if l.Covered || l.LineNumber != uncovered.End { break } nextLineIndex++ diff --git a/covet/cmd/covet/run_test.go b/covet/cmd/covet/run_test.go index c819fdba..a1a3b314 100644 --- a/covet/cmd/covet/run_test.go +++ b/covet/cmd/covet/run_test.go @@ -60,7 +60,7 @@ func TestRun(t *testing.T) { t.Parallel() fs, err := mem.NewFS() require.NoError(t, err) - require.NoError(t, fs.Mkdir("tmp", 0700)) + require.NoError(t, fs.Mkdir("tmp", 0o700)) var output bytes.Buffer err = run( tc.args, @@ -428,7 +428,7 @@ Diff coverage is below target. Add tests for these files: } if args.GitHubEndpoint == "replace-me" { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusInternalServerError) })) args.GitHubEndpoint = server.URL diff --git a/covet/covet.go b/covet/covet.go index a6a324fe..979684f6 100644 --- a/covet/covet.go +++ b/covet/covet.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "io/fs" + "math" "path" "sort" "strings" @@ -107,10 +108,26 @@ func (c *Covet) addDiff(diffFiles []*gitdiff.File) { } } +type signedInteger interface { + ~int | ~int64 +} + +// uintFromBoundedSignedInt converts i to a uint. +// If i is outside 0 to [math.MaxUint32], then it is capped at those bounds. +func uintFromBoundedSignedInt[integer signedInteger](i integer) uint { + if i < 0 { + return 0 + } + if i > math.MaxUint32 { + return math.MaxUint32 + } + return uint(i) +} + func findDiffAddSpans(fragments []*gitdiff.TextFragment) []span.Span { var spans []span.Span for _, fragment := range fragments { - lineNumber := fragment.NewPosition + lineNumber := uintFromBoundedSignedInt(fragment.NewPosition) for _, line := range fragment.Lines { if line.Op == gitdiff.OpAdd { if len(spans) == 0 || spans[len(spans)-1].End < lineNumber { @@ -136,13 +153,13 @@ func (c *Covet) addCoverage(fs hackpadfs.FS, baseDir string, coverageFiles []*co } if block.Count > 0 { c.coveredLines[coverageFile] = append(c.coveredLines[coverageFile], span.Span{ - Start: int64(block.StartLine), - End: int64(block.EndLine + 1), + Start: uintFromBoundedSignedInt(block.StartLine), + End: uintFromBoundedSignedInt(block.EndLine + 1), }) } else { c.uncoveredLines[coverageFile] = append(c.uncoveredLines[coverageFile], span.Span{ - Start: int64(block.StartLine), - End: int64(block.EndLine + 1), + Start: uintFromBoundedSignedInt(block.StartLine), + End: uintFromBoundedSignedInt(block.EndLine + 1), }) } } @@ -213,19 +230,19 @@ func (c *Covet) DiffCoverageFiles() []File { for i := s.Start; i < s.End; i++ { coveredFile.Lines = append(coveredFile.Lines, Line{ Covered: true, - LineNumber: uint(i), + LineNumber: i, }) } - coveredFile.Covered += uint(s.Len()) + coveredFile.Covered += s.Len() } for _, s := range uncovered { for i := s.Start; i < s.End; i++ { coveredFile.Lines = append(coveredFile.Lines, Line{ Covered: false, - LineNumber: uint(i), + LineNumber: i, }) } - coveredFile.Uncovered += uint(s.Len()) + coveredFile.Uncovered += s.Len() } sort.Slice(coveredFile.Lines, func(a, b int) bool { return coveredFile.Lines[a].LineNumber < coveredFile.Lines[b].LineNumber @@ -240,7 +257,7 @@ func (c *Covet) DiffCoverageFiles() []File { type ReportFileCoverageOptions struct{} // ReportFileCoverage writes a diff-like plain text report with color to 'w'. -func (c *Covet) ReportFileCoverage(w io.Writer, f File, options ReportFileCoverageOptions) error { +func (c *Covet) ReportFileCoverage(w io.Writer, f File, _ ReportFileCoverageOptions) error { name := path.Join(c.options.GoCoverageBaseDir, f.Name) r, err := c.options.FS.Open(name) if err != nil { diff --git a/covet/go.mod b/covet/go.mod index b15132aa..6f6efd48 100644 --- a/covet/go.mod +++ b/covet/go.mod @@ -1,6 +1,6 @@ module github.com/johnstarich/go/covet -go 1.16 +go 1.18 require ( github.com/bluekeyes/go-gitdiff v0.6.1 @@ -14,3 +14,21 @@ require ( golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 golang.org/x/tools v0.1.10 ) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/golang/protobuf v1.4.2 // indirect + github.com/google/go-querystring v1.1.0 // indirect + github.com/mattn/go-colorable v0.1.9 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.13 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect + golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.25.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) diff --git a/covet/go.sum b/covet/go.sum index 7df79862..083ca6f1 100644 --- a/covet/go.sum +++ b/covet/go.sum @@ -135,8 +135,6 @@ github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/hack-pad/go-indexeddb v0.1.0 h1:UzRAl6WiKxLJePkgi2uaQa9MMPWcjO29zI3pt9D+rNs= github.com/hack-pad/go-indexeddb v0.1.0/go.mod h1:NH8CaojufPNcKYDhy5JkjfyBXE/72oJPeiywlabN/lM= -github.com/hack-pad/hackpadfs v0.1.3 h1:3t82qWNG5otQ3OCOvRZlVhxpQteyj9pG5kz1wE2lPEg= -github.com/hack-pad/hackpadfs v0.1.3/go.mod h1:8bsINHOQhQUioUUiCzCyZZNLfEXjs0RwBIf3lTG+CEg= github.com/hack-pad/hackpadfs v0.1.5 h1:lcMmk2S1B/qma/2AMpnSXGv0RsTR4zRDLMITRm9cuu4= github.com/hack-pad/hackpadfs v0.1.5/go.mod h1:8bsINHOQhQUioUUiCzCyZZNLfEXjs0RwBIf3lTG+CEg= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -198,7 +196,6 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -263,8 +260,6 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -311,14 +306,10 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -326,7 +317,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/covet/internal/coverfile/file.go b/covet/internal/coverfile/file.go index c425db13..2b56abe8 100644 --- a/covet/internal/coverfile/file.go +++ b/covet/internal/coverfile/file.go @@ -5,6 +5,7 @@ import ( "bufio" "io" + "github.com/johnstarich/go/covet/internal/minmax" "github.com/johnstarich/go/covet/internal/span" ) @@ -26,9 +27,13 @@ func (f File) findContextSpans(contextLines uint) []span.Span { var overlappingSpans []span.Span for _, line := range f.Lines { + var start uint = 1 + if contextLines < line.LineNumber { // prevent uint underflow + start = line.LineNumber - contextLines + } overlappingSpans = append(overlappingSpans, span.Span{ - Start: max(1, int64(line.LineNumber)-int64(contextLines)), - End: int64(line.LineNumber + contextLines + 1), // may be beyond end of file, but can stop line iteration at EOF + Start: minmax.Max(1, start), + End: line.LineNumber + contextLines + 1, // may be beyond end of file, but can stop line iteration at EOF }) } spans := []span.Span{overlappingSpans[0]} @@ -77,7 +82,7 @@ func DiffChunks(file File, fileReader io.Reader) ([]DiffChunk, error) { var chunks []DiffChunk iter := newLineIterator(fileReader) const contextLines = 2 - var lineNumber int64 = 1 + var lineNumber uint = 1 diffLineIndex := 0 for _, s := range file.findContextSpans(contextLines) { if lineNumber < s.Start { @@ -95,7 +100,7 @@ func DiffChunks(file File, fileReader io.Reader) ([]DiffChunk, error) { op := noOpPrefix if diffLineIndex < len(file.Lines) { diffLine := file.Lines[diffLineIndex] - if lineNumber == int64(diffLine.LineNumber) { + if lineNumber == diffLine.LineNumber { op = diffLine.diffOpPrefix() diffLineIndex++ } @@ -104,21 +109,14 @@ func DiffChunks(file File, fileReader io.Reader) ([]DiffChunk, error) { lineNumber++ } chunks = append(chunks, DiffChunk{ - FirstLine: uint(s.Start), - LastLine: uint(lineNumber - 1), + FirstLine: s.Start, + LastLine: lineNumber - 1, Lines: lines, }) } return chunks, nil } -func max(a, b int64) int64 { - if a > b { - return a - } - return b -} - type lineIterator struct { scanner *bufio.Scanner } @@ -129,17 +127,17 @@ func newLineIterator(r io.Reader) *lineIterator { } } -func (l *lineIterator) SkipLines(n int64) error { +func (l *lineIterator) SkipLines(n uint) error { more := true - for i := int64(0); i < n && more; i++ { + for i := uint(0); i < n && more; i++ { more = l.scanner.Scan() } return l.scanner.Err() } -func (l *lineIterator) NextLines(n int64) ([]string, error) { +func (l *lineIterator) NextLines(n uint) ([]string, error) { lines := make([]string, 0, n) - for i := int64(0); i < n; i++ { + for i := uint(0); i < n; i++ { more := l.scanner.Scan() if !more { return lines, l.scanner.Err() diff --git a/covet/internal/coverstatus/coverage_status.go b/covet/internal/coverstatus/coverage_status.go index 222386e2..ae30b1f8 100644 --- a/covet/internal/coverstatus/coverage_status.go +++ b/covet/internal/coverstatus/coverage_status.go @@ -16,7 +16,7 @@ const ( // New categorizes the given percentage (between 0 and 1) as a coverage status func New(f float64) Status { - //nolint:gomnd // These magic numbers are indeed arbitrary thresholds. As long as they are monotonically increasing from 0 to 1, we're ok. + //nolint:mnd // These magic numbers are indeed arbitrary thresholds. As long as they are monotonically increasing from 0 to 1, we're ok. switch { case f < 0.50: return coverageError diff --git a/covet/internal/minmax/minmax.go b/covet/internal/minmax/minmax.go index 9123d49e..b166f7f2 100644 --- a/covet/internal/minmax/minmax.go +++ b/covet/internal/minmax/minmax.go @@ -1,48 +1,20 @@ -// Package minmax contains several type-specific min and max functions. +// Package minmax contains min and max functions. package minmax -// MinInt64 returns the smallest of a and b -func MinInt64(a, b int64) int64 { - if a < b { - return a - } - return b -} - -// MaxInt64 returns the largest of a and b -func MaxInt64(a, b int64) int64 { - if a > b { - return a - } - return b -} - -// MinUint returns the smallest of a and b -func MinUint(a, b uint) uint { - if a < b { - return a - } - return b -} - -// MaxUint returns the largest of a and b -func MaxUint(a, b uint) uint { - if a > b { - return a - } - return b +type ordered interface { + ~int | ~int64 | ~uint | ~uint64 } -// MinInt returns the smallest of a and b -func MinInt(a, b int) int { +// Min returns the smallest of a and b +func Min[Value ordered](a, b Value) Value { if a < b { return a } return b } -// MaxInt returns the largest of a and b -func MaxInt(a, b int) int { +// Max returns the largest of a and b +func Max[Value ordered](a, b Value) Value { if a > b { return a } diff --git a/covet/internal/minmax/minmax_test.go b/covet/internal/minmax/minmax_test.go index 0f65a0eb..91f1fb68 100644 --- a/covet/internal/minmax/minmax_test.go +++ b/covet/internal/minmax/minmax_test.go @@ -8,40 +8,14 @@ import ( func TestMin(t *testing.T) { t.Parallel() - testMin(t, "int64", func(a, b int) int { - return int(MinInt64(int64(a), int64(b))) - }) - testMin(t, "uint", func(a, b int) int { - return int(MinUint(uint(a), uint(b))) - }) - testMin(t, "int", MinInt) + assert.EqualValues(t, 1, Min(1, 2)) + assert.EqualValues(t, 1, Min(2, 1)) + assert.EqualValues(t, 0, Min(0, 0)) } func TestMax(t *testing.T) { t.Parallel() - testMax(t, "int64", func(a, b int) int { - return int(MaxInt64(int64(a), int64(b))) - }) - testMax(t, "uint", func(a, b int) int { - return int(MaxUint(uint(a), uint(b))) - }) - testMax(t, "int", MaxInt) -} - -func testMin(t *testing.T, description string, min func(a, b int) int) { - t.Helper() - t.Run(description, func(t *testing.T) { - assert.EqualValues(t, 1, min(1, 2)) - assert.EqualValues(t, 1, min(2, 1)) - assert.EqualValues(t, 0, min(0, 0)) - }) -} - -func testMax(t *testing.T, description string, max func(a, b int) int) { - t.Helper() - t.Run(description, func(t *testing.T) { - assert.EqualValues(t, 2, max(1, 2)) - assert.EqualValues(t, 2, max(2, 1)) - assert.EqualValues(t, 0, max(0, 0)) - }) + assert.EqualValues(t, 2, Max(1, 2)) + assert.EqualValues(t, 2, Max(2, 1)) + assert.EqualValues(t, 0, Max(0, 0)) } diff --git a/covet/internal/span/span.go b/covet/internal/span/span.go index ff806d10..b55c7e54 100644 --- a/covet/internal/span/span.go +++ b/covet/internal/span/span.go @@ -9,16 +9,16 @@ import ( // Span is a numeric range with an inclusive Start and exclusive End index. i.e. [Start, End) type Span struct { - Start int64 // inclusive - End int64 // exclusive + Start uint // inclusive + End uint // exclusive } // Intersection returns a Span representing the intersection of s and other. // Returns false if they do not intersect. func (s Span) Intersection(other Span) (Span, bool) { intersection := Span{ - Start: minmax.MaxInt64(s.Start, other.Start), - End: minmax.MinInt64(s.End, other.End), + Start: minmax.Max(s.Start, other.Start), + End: minmax.Min(s.End, other.End), } if intersection.Start < intersection.End { return intersection, true @@ -27,7 +27,7 @@ func (s Span) Intersection(other Span) (Span, bool) { } // Len returns the distance between Start and End -func (s Span) Len() int64 { +func (s Span) Len() uint { return s.End - s.Start } @@ -43,7 +43,7 @@ func (s Span) Merge(other Span) (Span, bool) { return Span{}, false } return Span{ - Start: minmax.MinInt64(s.Start, other.Start), - End: minmax.MaxInt64(s.End, other.End), + Start: minmax.Min(s.Start, other.Start), + End: minmax.Max(s.End, other.End), }, true } diff --git a/covet/internal/summary/format.go b/covet/internal/summary/format.go index 5982f437..62030956 100644 --- a/covet/internal/summary/format.go +++ b/covet/internal/summary/format.go @@ -64,18 +64,18 @@ func (f Format) StatusIcon(status coverstatus.Status) string { return "" } -func formatWidth(s string, width uint) string { +func formatWidth(s string, width int) string { return fmt.Sprintf(fmt.Sprintf("%%%ds", width), s) } -func formatWidthLeft(s string, width uint) string { +func formatWidthLeft(s string, width int) string { return fmt.Sprintf(fmt.Sprintf("%%-%ds", width), s) } func formatFraction(numerator, denominator uint) string { nStr := fmt.Sprintf("%d", numerator) dStr := fmt.Sprintf("%d", denominator) - width := uint(minmax.MaxInt(len(nStr), len(dStr))) + width := minmax.Max(len(nStr), len(dStr)) return fmt.Sprintf("%s/%s", formatWidth(nStr, width), formatWidthLeft(dStr, width)) } diff --git a/covet/summary.go b/covet/summary.go index 5f82bfb4..a0943711 100644 --- a/covet/summary.go +++ b/covet/summary.go @@ -54,13 +54,13 @@ func findReportableUncoveredFiles(coveredFiles []File, target, current float64) var uncoveredFiles []File // find minimum number of covered lines required to hit target - targetMissingLines := 0 + targetMissingLines := uint(0) totalLines := uint(0) for _, f := range coveredFiles { totalLines += f.Covered + f.Uncovered } if percentDiff := target - current; percentDiff > 0 { - targetMissingLines = int(percentDiff * float64(totalLines)) + targetMissingLines = uint(percentDiff * float64(totalLines)) } else { return nil // target is met } @@ -71,7 +71,7 @@ func findReportableUncoveredFiles(coveredFiles []File, target, current float64) uncoveredFiles = append(uncoveredFiles, f) } if f.Uncovered > minUncoveredThreshold { - targetMissingLines -= int(f.Uncovered) + targetMissingLines -= f.Uncovered } if targetMissingLines <= 0 { break diff --git a/datasize/size.go b/datasize/size.go index 74d65b99..d7f6a938 100644 --- a/datasize/size.go +++ b/datasize/size.go @@ -6,7 +6,7 @@ import ( "math/big" ) -//nolint:gochecknoglobals,gomnd // These are all effectively constants as big.Int types. +//nolint:gochecknoglobals,mnd // These are all effectively constants as big.Int types. var ( kilobytes = big.NewInt(1e3) megabytes = big.NewInt(1e6) diff --git a/dns/go.mod b/dns/go.mod index 78f8209b..c7b4c651 100644 --- a/dns/go.mod +++ b/dns/go.mod @@ -8,5 +8,5 @@ require ( github.com/stretchr/testify v1.4.0 go.uber.org/atomic v1.6.0 go.uber.org/zap v1.14.1 - golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68 // indirect + golang.org/x/net v0.29.0 // indirect ) diff --git a/dns/go.sum b/dns/go.sum index 867b4811..30290f65 100644 --- a/dns/go.sum +++ b/dns/go.sum @@ -3,10 +3,15 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -17,11 +22,15 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= @@ -34,35 +43,103 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68 h1:z8Hj/bl9cOV2grsOpEaQFUaly0JWN3i97mo3jXKJNp0= golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2 h1:IRJeR9r1pYWsHKTRe/IInb7lYvbBVIqOgsX/u0mbOWY= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425 h1:VvQyQJN0tSuecqgcIxMWnnfG5kSmgy9KZR9sW3W5QeA= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/dns/resolver_test.go b/dns/resolver_test.go index 7bc6a0c8..3fe77be9 100644 --- a/dns/resolver_test.go +++ b/dns/resolver_test.go @@ -85,7 +85,7 @@ func TestEnsureNameservers(t *testing.T) { someError := errors.New("some error") dialer := newMacOSDialer(Config{}) callCount := 0 - dialer.readResolvers = func(ctx context.Context) (scutil.Config, error) { + dialer.readResolvers = func(context.Context) (scutil.Config, error) { callCount++ assert.Less(t, callCount, 2, "Read should not be called more than once") return someConfig, someError diff --git a/dns/scutil/config_test.go b/dns/scutil/config_test.go index b444ffd8..67f615a7 100644 --- a/dns/scutil/config_test.go +++ b/dns/scutil/config_test.go @@ -236,7 +236,7 @@ resolver #2 t.Run(tc.description, func(t *testing.T) { t.Parallel() ctx := context.Background() - getSCUtilDNS := func(ctx context.Context) ([]byte, error) { + getSCUtilDNS := func(context.Context) ([]byte, error) { return []byte(tc.scutilOutput), tc.scutilErr } cfg, err := readMacOSDNS(ctx, getSCUtilDNS) diff --git a/dns/staggercast/conn.go b/dns/staggercast/conn.go index 700e5139..eba31f43 100644 --- a/dns/staggercast/conn.go +++ b/dns/staggercast/conn.go @@ -84,7 +84,7 @@ func (s *Conn) Stagger(ticker <-chan struct{}, cancel context.CancelFunc) { ctx, tickerCancel := context.WithCancel(context.Background()) s.tickerCancel = tickerCancel - totalLength := len(s.conns) + totalLength := uint64(len(s.conns)) s.replay = make([]chan struct{}, totalLength) for i := range s.replay { s.replay[i] = make(chan struct{}) @@ -100,7 +100,7 @@ func (s *Conn) Stagger(ticker <-chan struct{}, cancel context.CancelFunc) { select { case <-ticker: count := connCount.Inc() - if count > uint64(totalLength) { + if count > totalLength { // finished enabling all connections cancel() return @@ -159,10 +159,10 @@ func (s *Conn) runReplay(connIndex uint64) { close(s.replay[connIndex]) // fire off any pending iter's } -func (s *Conn) getConnCount() int { - count := int(s.connCount.Load()) - if count > len(s.conns) { - return len(s.conns) +func (s *Conn) getConnCount() uint64 { + count := s.connCount.Load() + if connsLen := uint64(len(s.conns)); count > connsLen { + return connsLen } return count } @@ -192,7 +192,7 @@ func (s *Conn) iter(op connOp, fn func(conn PacketConn) (keepGoing bool, err err } }(ix, conn) } - for i := 0; i < s.getConnCount(); i++ { + for i := uint64(0); i < s.getConnCount(); i++ { select { case <-done: case <-ctx.Done(): @@ -201,7 +201,7 @@ func (s *Conn) iter(op connOp, fn func(conn PacketConn) (keepGoing bool, err err } ctxDone: - if len(errs) >= s.getConnCount() { + if uint64(len(errs)) >= s.getConnCount() { // only return an error if all conns failed err := <-errs return errors.Wrapf(err, "all connections have failed for %q", op) diff --git a/dns/staggercast/conn_test.go b/dns/staggercast/conn_test.go index e679e75c..00cd7b40 100644 --- a/dns/staggercast/conn_test.go +++ b/dns/staggercast/conn_test.go @@ -130,7 +130,7 @@ func TestDialDNS(t *testing.T) { res := &net.Resolver{ PreferGo: true, - Dial: func(ctx context.Context, network, address string) (net.Conn, error) { + Dial: func(_ context.Context, _, _ string) (net.Conn, error) { var conns []PacketConn for _, addr := range servers { conns = append(conns, dialUDP(t, addr)) @@ -182,7 +182,7 @@ func TestStagger(t *testing.T) { servers := startServers(t) res := &net.Resolver{ PreferGo: true, - Dial: func(ctx context.Context, network, address string) (net.Conn, error) { + Dial: func(_ context.Context, _, _ string) (net.Conn, error) { var conns []PacketConn for _, addr := range servers { conns = append(conns, dialUDP(t, addr)) @@ -212,7 +212,7 @@ func TestStagger(t *testing.T) { const delay = 1 * time.Second res := &net.Resolver{ PreferGo: true, - Dial: func(ctx context.Context, network, address string) (net.Conn, error) { + Dial: func(ctx context.Context, _, _ string) (net.Conn, error) { var conns []PacketConn for _, addr := range servers { conns = append(conns, dialUDP(t, addr)) @@ -256,7 +256,7 @@ func TestStagger(t *testing.T) { servers := startServers(t) res := &net.Resolver{ PreferGo: true, - Dial: func(ctx context.Context, network, address string) (net.Conn, error) { + Dial: func(_ context.Context, _, _ string) (net.Conn, error) { var conns []PacketConn for _, addr := range servers { conns = append(conns, dialUDP(t, addr)) diff --git a/dns/testlogger_test.go b/dns/testlogger_test.go index fc1bc0d2..17a775de 100644 --- a/dns/testlogger_test.go +++ b/dns/testlogger_test.go @@ -34,14 +34,15 @@ func (l *testLogger) getCore() zapcore.Core { //nolint:ireturn // Internal core return *l.core.Load().(*zapcore.Core) } -func (l *testLogger) Enabled(level zapcore.Level) bool { return l.getCore().Enabled(level) } -func (l *testLogger) With(fields []zapcore.Field) zapcore.Core { return l } //nolint:ireturn // Implements zapcore.Core +func (l *testLogger) Enabled(level zapcore.Level) bool { return l.getCore().Enabled(level) } +func (l *testLogger) With([]zapcore.Field) zapcore.Core { return l } //nolint:ireturn // Implements zapcore.Core func (l *testLogger) Check(entry zapcore.Entry, checkedEntry *zapcore.CheckedEntry) *zapcore.CheckedEntry { if l.Enabled(entry.Level) { return checkedEntry.AddCore(entry, l) } return checkedEntry } + func (l *testLogger) Write(entry zapcore.Entry, fields []zapcore.Field) error { l.coreMu.RLock() defer l.coreMu.RUnlock() diff --git a/goop/cmd/goop/add_test.go b/goop/cmd/goop/add_test.go index ef89540f..d054a3d6 100644 --- a/goop/cmd/goop/add_test.go +++ b/goop/cmd/goop/add_test.go @@ -12,7 +12,7 @@ func TestUserBinDir(t *testing.T) { t.Run("static bin", func(t *testing.T) { t.Parallel() app := App{ - getEnv: func(s string) string { + getEnv: func(string) string { return "" }, staticBinDir: staticBin, diff --git a/goop/cmd/goop/exec.go b/goop/cmd/goop/exec.go index 7cfdd4a2..66eb29b5 100644 --- a/goop/cmd/goop/exec.go +++ b/goop/cmd/goop/exec.go @@ -77,7 +77,7 @@ func (a App) packageInstallDir(name string) string { return path.Join(a.staticCacheDir, "install", name) } -func (a App) exec(cmd *cobra.Command, args []string) error { +func (a App) exec(cmd *cobra.Command, _ []string) error { _, err := execPipe.Do(cmd, a) return err } diff --git a/goop/cmd/goop/exec_test.go b/goop/cmd/goop/exec_test.go index d40d4572..0d33ffbd 100644 --- a/goop/cmd/goop/exec_test.go +++ b/goop/cmd/goop/exec_test.go @@ -29,7 +29,7 @@ func TestExec(t *testing.T) { encodedName := base64EncodeString(name) encodedPackage := base64EncodeString("bar") app := newTestApp(t, testAppOptions{ - runCmd: func(app *TestApp, cmd *exec.Cmd) error { + runCmd: func(_ *TestApp, cmd *exec.Cmd) error { return runCmd(cmd) // use real command }, }) @@ -108,7 +108,7 @@ Build successful. return nil }, }) - require.NoError(t, hackpadfs.MkdirAll(app.fs, app.packageInstallDir(name), 0700)) + require.NoError(t, hackpadfs.MkdirAll(app.fs, app.packageInstallDir(name), 0o700)) f, err := hackpadfs.Create(app.fs, path.Join(app.packageInstallDir(name), name+systemExt(runtime.GOOS))) require.NoError(t, err) require.NoError(t, f.Close()) @@ -225,18 +225,18 @@ Build successful. app.fs = newFSWithOSPath(app.fs, map[string]string{ thisDir: workingDirFSPath, }) - require.NoError(t, hackpadfs.MkdirAll(app.fs, workingDirFSPath, 0700)) - require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join(workingDirFSPath, "go.mod"), []byte("module foo"), 0700)) + require.NoError(t, hackpadfs.MkdirAll(app.fs, workingDirFSPath, 0o700)) + require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join(workingDirFSPath, "go.mod"), []byte("module foo"), 0o700)) require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join(workingDirFSPath, "main.go"), []byte(` package main func main() {} -`), 0700)) +`), 0o700)) - require.NoError(t, hackpadfs.MkdirAll(app.fs, app.packageInstallDir(name), 0700)) + require.NoError(t, hackpadfs.MkdirAll(app.fs, app.packageInstallDir(name), 0o700)) // set really oudated bin file that needs an update filePath := path.Join(app.packageInstallDir(name), name+systemExt(runtime.GOOS)) - err = hackpadfs.WriteFullFile(app.fs, filePath, nil, 0700) + err = hackpadfs.WriteFullFile(app.fs, filePath, nil, 0o700) require.NoError(t, err) year2000 := time.Date(2000, time.January, 1, 0, 0, 0, 0, time.UTC) require.NoError(t, hackpadfs.Chtimes(app.fs, filePath, year2000, year2000)) @@ -320,8 +320,8 @@ func (fs *fsWithOSPath) FromOSPath(name string) (string, error) { //nolint:unpar func writeFiles(t *testing.T, fs hackpadfs.FS, files map[string]string, modTime time.Time) { t.Helper() for filePath, contents := range files { - require.NoError(t, hackpadfs.MkdirAll(fs, path.Dir(filePath), 0700)) - require.NoError(t, hackpadfs.WriteFullFile(fs, filePath, []byte(contents), 0700)) + require.NoError(t, hackpadfs.MkdirAll(fs, path.Dir(filePath), 0o700)) + require.NoError(t, hackpadfs.WriteFullFile(fs, filePath, []byte(contents), 0o700)) for f := filePath; f != path.Dir(f); f = path.Dir(f) { require.NoError(t, hackpadfs.Chtimes(fs, f, modTime, modTime)) } diff --git a/goop/cmd/goop/info.go b/goop/cmd/goop/info.go index cf27c2ad..74863b3c 100644 --- a/goop/cmd/goop/info.go +++ b/goop/cmd/goop/info.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cobra" ) -func (a App) info(cmd *cobra.Command, args []string) error { +func (a App) info(cmd *cobra.Command, _ []string) error { binDir, err := a.userBinDir() if err != nil { return err diff --git a/goop/cmd/goop/install.go b/goop/cmd/goop/install.go index 10f3cd02..62c5709f 100644 --- a/goop/cmd/goop/install.go +++ b/goop/cmd/goop/install.go @@ -2,7 +2,7 @@ package main import "github.com/spf13/cobra" -func (a App) install(cmd *cobra.Command, args []string) error { +func (a App) install(cmd *cobra.Command, _ []string) error { pkgPattern, err := cmd.Flags().GetString("package") if err != nil { return err diff --git a/goop/cmd/goop/install_test.go b/goop/cmd/goop/install_test.go index 58f52cec..89fc0bb0 100644 --- a/goop/cmd/goop/install_test.go +++ b/goop/cmd/goop/install_test.go @@ -32,7 +32,7 @@ func TestInstall(t *testing.T) { const name = "foo" someErr := errors.New("some error") app := newTestApp(t, testAppOptions{ - runCmd: func(app *TestApp, cmd *exec.Cmd) error { + runCmd: func(*TestApp, *exec.Cmd) error { return someErr }, }) @@ -170,10 +170,10 @@ Build successful. }, }) // binary already installed, still does a reinstall - require.NoError(t, hackpadfs.MkdirAll(app.fs, path.Join("cache/install", appName), 0700)) - require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join("cache/install", appName, appName), nil, 0700)) - require.NoError(t, hackpadfs.Mkdir(app.fs, "bin", 0700)) - require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join("bin", appName), []byte(makeShebang("goop exec ...")), 0700)) + require.NoError(t, hackpadfs.MkdirAll(app.fs, path.Join("cache/install", appName), 0o700)) + require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join("cache/install", appName, appName), nil, 0o700)) + require.NoError(t, hackpadfs.Mkdir(app.fs, "bin", 0o700)) + require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join("bin", appName), []byte(makeShebang("goop exec ...")), 0o700)) err := app.Run([]string{"install", "-p", thisPackage}) assert.NoError(t, err) @@ -219,10 +219,10 @@ Build successful. }, }) // non-goop script already installed, fails reinstall - require.NoError(t, hackpadfs.MkdirAll(app.fs, path.Join("cache/install", appName), 0700)) - require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join("cache/install", appName, appName), nil, 0700)) - require.NoError(t, hackpadfs.Mkdir(app.fs, "bin", 0700)) - require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join("bin", appName), nil, 0700)) + require.NoError(t, hackpadfs.MkdirAll(app.fs, path.Join("cache/install", appName), 0o700)) + require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join("cache/install", appName, appName), nil, 0o700)) + require.NoError(t, hackpadfs.Mkdir(app.fs, "bin", 0o700)) + require.NoError(t, hackpadfs.WriteFullFile(app.fs, path.Join("bin", appName), nil, 0o700)) err := app.Run([]string{"install", "-p", thisPackage}) assert.EqualError(t, err, `pipe: refusing to overwrite non-goop script file: "bin/goop"`) diff --git a/goop/cmd/goop/rm.go b/goop/cmd/goop/rm.go index c20c9bc0..8c162e11 100644 --- a/goop/cmd/goop/rm.go +++ b/goop/cmd/goop/rm.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/cobra" ) -func (a App) rm(cmd *cobra.Command, args []string) error { +func (a App) rm(cmd *cobra.Command, _ []string) error { name, err := cmd.Flags().GetString("name") if err != nil { return err diff --git a/goop/cmd/goop/rm_test.go b/goop/cmd/goop/rm_test.go index 5090a87a..e62670b2 100644 --- a/goop/cmd/goop/rm_test.go +++ b/goop/cmd/goop/rm_test.go @@ -25,12 +25,12 @@ func TestRemove(t *testing.T) { const name = "foo" var binDir, installDir string app := newTestApp(t, testAppOptions{ - runCmd: func(app *TestApp, cmd *exec.Cmd) error { + runCmd: func(app *TestApp, _ *exec.Cmd) error { binDir = app.staticBinDir installDir = app.packageInstallDir(name) - require.NoError(t, hackpadfs.MkdirAll(app.fs, binDir, 0700)) - require.NoError(t, hackpadfs.MkdirAll(app.fs, installDir, 0700)) - return hackpadfs.WriteFullFile(app.fs, path.Join(installDir, name), nil, 0700) + require.NoError(t, hackpadfs.MkdirAll(app.fs, binDir, 0o700)) + require.NoError(t, hackpadfs.MkdirAll(app.fs, installDir, 0o700)) + return hackpadfs.WriteFullFile(app.fs, path.Join(installDir, name), nil, 0o700) }, }) err := app.Run([]string{"install", "--name", name, "-p", thisPackage}) diff --git a/gopages/cmd/watch/main.go b/gopages/cmd/watch/main.go index 0de994b4..93e0077e 100644 --- a/gopages/cmd/watch/main.go +++ b/gopages/cmd/watch/main.go @@ -183,7 +183,7 @@ type httpFileWrapper struct { fs billy.Filesystem } -func (h *httpFileWrapper) Readdir(count int) ([]os.FileInfo, error) { +func (h *httpFileWrapper) Readdir(int) ([]os.FileInfo, error) { return h.fs.ReadDir(h.name) } diff --git a/gopages/internal/flags/flags.go b/gopages/internal/flags/flags.go index 033949f5..e3c28791 100644 --- a/gopages/internal/flags/flags.go +++ b/gopages/internal/flags/flags.go @@ -45,7 +45,9 @@ func Parse(osArgs ...string) (Args, string, error) { } // Linker returns an appropriate source.Linker for the given command line args -func (a Args) Linker(modulePackage string) (source.Linker, error) { //nolint:ireturn // This method's purpose is to determine the correct implementation of source.Linker to return +// +//nolint:ireturn // This method's purpose is to determine the correct implementation of source.Linker to return +func (a Args) Linker(modulePackage string) (source.Linker, error) { if a.SourceLinkTemplate != "" { return newTemplateLinker(modulePackage, a.SourceLinkTemplate) } diff --git a/gopages/internal/generate/generate.go b/gopages/internal/generate/generate.go index a5889868..021a21cb 100644 --- a/gopages/internal/generate/generate.go +++ b/gopages/internal/generate/generate.go @@ -115,14 +115,14 @@ var makePresentationPipe = pipe.New(pipe.Options{}). u := args.Linker.LinkToSource(src, source.LinkOptions{}) return u.String() } - pres.URLForSrcPos = func(src string, line, low, high int) string { + pres.URLForSrcPos = func(src string, line, _, _ int) string { src = strings.TrimPrefix(src, "/src/") u := args.Linker.LinkToSource(src, source.LinkOptions{ Line: line, }) return u.String() } - pres.URLForSrcQuery = func(src, query string, line int) string { + pres.URLForSrcQuery = func(src, _ string, line int) string { src = strings.TrimPrefix(src, "/src/") u := args.Linker.LinkToSource(src, source.LinkOptions{ Line: line, @@ -464,7 +464,7 @@ func (f *filesystemOpener) Open(name string) (vfs.ReadSeekCloser, error) { return f.OpenFile(name, 0, 0) } -func (f *filesystemOpener) RootType(path string) vfs.RootType { +func (f *filesystemOpener) RootType(string) vfs.RootType { return "" } diff --git a/pipe/pipe_test.go b/pipe/pipe_test.go index 43e88417..63cacc5f 100644 --- a/pipe/pipe_test.go +++ b/pipe/pipe_test.go @@ -243,7 +243,7 @@ func TestPipeConcat(t *testing.T) { t.Run("previous error type dropped from bridge func", func(t *testing.T) { t.Parallel() p1 := New(Options{}). - Append(func(args []interface{}) (int, error) { + Append(func([]interface{}) (int, error) { return 1, nil }) p2 := New(Options{}). @@ -267,11 +267,11 @@ func TestPipeConcat(t *testing.T) { t.Run("stops on first pipe err", func(t *testing.T) { t.Parallel() p1 := New(Options{}). - Append(func(args []interface{}) (int, error) { + Append(func([]interface{}) (int, error) { return 0, fmt.Errorf("failed") }) p2 := New(Options{}). - Append(func(args []interface{}) int { + Append(func([]interface{}) int { return 0 }) p := p1.Concat(p2)