From a8faa0bc2bde1c50983ae19349fce1d2f7044c52 Mon Sep 17 00:00:00 2001 From: Billy Keyes Date: Fri, 30 Sep 2022 22:31:06 -0700 Subject: [PATCH 1/2] Test with Go 1.19, upgrade golangci-lint The previous version of the golangci-lint action would install its own version of Go, which eventually conflicted with the old pinned version of the linter I was using. Upgrade the action to avoid this, but also update Go and the linter while I'm here. --- .github/workflows/go.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 13ed2a9..558965e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -9,18 +9,18 @@ jobs: name: Verify runs-on: ubuntu-latest steps: - - name: Set up Go 1.16 - uses: actions/setup-go@v2 + - name: Set up Go 1.19 + uses: actions/setup-go@v3 with: - go-version: 1.16 + go-version: 1.19 - name: Check out code into the Go module directory uses: actions/checkout@v2 - name: Lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v3 with: - version: v1.28 + version: v1.49 - name: Test run: go test -v ./... From 6a1588d9498b29137b34157967318f5c3f5e7474 Mon Sep 17 00:00:00 2001 From: Billy Keyes Date: Fri, 30 Sep 2022 22:38:00 -0700 Subject: [PATCH 2/2] Update comment formatting for Go 1.19 --- gitdiff/apply.go | 7 +++---- gitdiff/apply_binary.go | 6 +++--- gitdiff/apply_text.go | 1 - gitdiff/testdata/apply/bin.go | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/gitdiff/apply.go b/gitdiff/apply.go index cc4c3f0..44bbcca 100644 --- a/gitdiff/apply.go +++ b/gitdiff/apply.go @@ -13,10 +13,9 @@ import ( // Users can test if an error was caused by a conflict by using errors.Is with // an empty Conflict: // -// if errors.Is(err, &Conflict{}) { -// // handle conflict -// } -// +// if errors.Is(err, &Conflict{}) { +// // handle conflict +// } type Conflict struct { msg string } diff --git a/gitdiff/apply_binary.go b/gitdiff/apply_binary.go index b1ff4c1..b34772d 100644 --- a/gitdiff/apply_binary.go +++ b/gitdiff/apply_binary.go @@ -115,7 +115,7 @@ func applyBinaryDeltaFragment(dst io.Writer, src io.ReaderAt, frag []byte) error // readBinaryDeltaSize reads a variable length size from a delta-encoded binary // fragment, returing the size and the unused data. Data is encoded as: // -// [[1xxxxxxx]...] [0xxxxxxx] +// [[1xxxxxxx]...] [0xxxxxxx] // // in little-endian order, with 7 bits of the value per byte. func readBinaryDeltaSize(d []byte) (size int64, rest []byte) { @@ -134,7 +134,7 @@ func readBinaryDeltaSize(d []byte) (size int64, rest []byte) { // fragment, returning the amount of data written and the usused part of the // fragment. An add operation takes the form: // -// [0xxxxxx][[data1]...] +// [0xxxxxx][[data1]...] // // where the lower seven bits of the opcode is the number of data bytes // following the opcode. See also pack-format.txt in the Git source. @@ -151,7 +151,7 @@ func applyBinaryDeltaAdd(w io.Writer, op byte, delta []byte) (n int64, rest []by // fragment, returing the amount of data written and the unused part of the // fragment. A copy operation takes the form: // -// [1xxxxxxx][offset1][offset2][offset3][offset4][size1][size2][size3] +// [1xxxxxxx][offset1][offset2][offset3][offset4][size1][size2][size3] // // where the lower seven bits of the opcode determine which non-zero offset and // size bytes are present in little-endian order: if bit 0 is set, offset1 is diff --git a/gitdiff/apply_text.go b/gitdiff/apply_text.go index a404552..43af83a 100644 --- a/gitdiff/apply_text.go +++ b/gitdiff/apply_text.go @@ -10,7 +10,6 @@ import ( // // By default, TextApplier operates in "strict" mode, where fragment content // and positions must exactly match those of the source. -// type TextApplier struct { dst io.Writer src io.ReaderAt diff --git a/gitdiff/testdata/apply/bin.go b/gitdiff/testdata/apply/bin.go index 6d39ffd..e34f06b 100644 --- a/gitdiff/testdata/apply/bin.go +++ b/gitdiff/testdata/apply/bin.go @@ -1,4 +1,4 @@ -//+build ignore +//go:build ignore // bin.go is a helper CLI to manipulate binary diff data for testing purposes. // It can decode patches generated by git using the standard parsing functions