build: bump go to 1.24.3 (#7553)

Signed-off-by: sspaink <sspaink@styra.com>
This commit is contained in:
Sebastian Spaink
2025-05-07 14:32:26 -05:00
committed by GitHub
parent 4a9cdf4e4b
commit 5a8932326f
9 changed files with 3 additions and 229 deletions
+1 -1
View File
@@ -1 +1 @@
1.24.2
1.24.3
+2 -3
View File
@@ -2,11 +2,9 @@ module github.com/open-policy-agent/opa
go 1.23.8
toolchain go1.24.2
toolchain go1.24.3
require (
github.com/agnivade/levenshtein v1.2.1
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
github.com/bytecodealliance/wasmtime-go/v3 v3.0.2
github.com/cespare/xxhash/v2 v2.3.0
github.com/containerd/containerd v1.7.27
@@ -57,6 +55,7 @@ require (
require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/agnivade/levenshtein v1.2.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
-24
View File
@@ -1,24 +0,0 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2017 Andrey Tarantsov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-28
View File
@@ -1,28 +0,0 @@
# diff
Quick'n'easy string diffing functions for Golang based on [github.com/sergi/go-diff](https://github.com/sergi/go-diff). Mainly for diffing strings in tests.
See [the docs on GoDoc](https://godoc.org/github.com/andreyvit/diff).
Get it:
go get -u github.com/andreyvit/diff
Example:
import (
"strings"
"testing"
"github.com/andreyvit/diff"
)
const expected = `
...
`
func TestFoo(t *testing.T) {
actual := Foo(...)
if a, e := strings.TrimSpace(actual), strings.TrimSpace(expected); a != e {
t.Errorf("Result not as expected:\n%v", diff.LineDiff(e, a))
}
}
-128
View File
@@ -1,128 +0,0 @@
package diff
import (
"bytes"
"strings"
"github.com/sergi/go-diff/diffmatchpatch"
)
func diff(a, b string) []diffmatchpatch.Diff {
dmp := diffmatchpatch.New()
diffs := dmp.DiffMain(a, b, true)
if len(diffs) > 2 {
diffs = dmp.DiffCleanupSemantic(diffs)
diffs = dmp.DiffCleanupEfficiency(diffs)
}
return diffs
}
// CharacterDiff returns an inline diff between the two strings, using (++added++) and (~~deleted~~) markup.
func CharacterDiff(a, b string) string {
return diffsToString(diff(a, b))
}
func diffsToString(diffs []diffmatchpatch.Diff) string {
var buff bytes.Buffer
for _, diff := range diffs {
text := diff.Text
switch diff.Type {
case diffmatchpatch.DiffInsert:
buff.WriteString("(++")
buff.WriteString(text)
buff.WriteString("++)")
case diffmatchpatch.DiffDelete:
buff.WriteString("(~~")
buff.WriteString(text)
buff.WriteString("~~)")
case diffmatchpatch.DiffEqual:
buff.WriteString(text)
}
}
return buff.String()
}
// LineDiff returns a normal linewise diff between the two given strings.
func LineDiff(a, b string) string {
return strings.Join(LineDiffAsLines(a, b), "\n")
}
// LineDiffAsLines returns the lines of a linewise diff between the two given strings.
func LineDiffAsLines(a, b string) []string {
return diffsToPatchLines(diff(a, b))
}
type patchBuilder struct {
output []string
oldLines []string
newLines []string
newLineBuffer bytes.Buffer
oldLineBuffer bytes.Buffer
}
func (b *patchBuilder) AddCharacters(text string, op diffmatchpatch.Operation) {
if op == diffmatchpatch.DiffInsert || op == diffmatchpatch.DiffEqual {
b.newLineBuffer.WriteString(text)
}
if op == diffmatchpatch.DiffDelete || op == diffmatchpatch.DiffEqual {
b.oldLineBuffer.WriteString(text)
}
}
func (b *patchBuilder) AddNewline(op diffmatchpatch.Operation) {
oldLine := b.oldLineBuffer.String()
newLine := b.newLineBuffer.String()
if op == diffmatchpatch.DiffEqual && (oldLine == newLine) {
b.FlushChunk()
b.output = append(b.output, " "+newLine)
b.oldLineBuffer.Reset()
b.newLineBuffer.Reset()
} else {
if op == diffmatchpatch.DiffDelete || op == diffmatchpatch.DiffEqual {
b.oldLines = append(b.oldLines, "-"+oldLine)
b.oldLineBuffer.Reset()
}
if op == diffmatchpatch.DiffInsert || op == diffmatchpatch.DiffEqual {
b.newLines = append(b.newLines, "+"+newLine)
b.newLineBuffer.Reset()
}
}
}
func (b *patchBuilder) FlushChunk() {
if b.oldLines != nil {
b.output = append(b.output, b.oldLines...)
b.oldLines = nil
}
if b.newLines != nil {
b.output = append(b.output, b.newLines...)
b.newLines = nil
}
}
func (b *patchBuilder) Flush() {
if b.oldLineBuffer.Len() > 0 && b.newLineBuffer.Len() > 0 {
b.AddNewline(diffmatchpatch.DiffEqual)
} else if b.oldLineBuffer.Len() > 0 {
b.AddNewline(diffmatchpatch.DiffDelete)
} else if b.newLineBuffer.Len() > 0 {
b.AddNewline(diffmatchpatch.DiffInsert)
}
b.FlushChunk()
}
func diffsToPatchLines(diffs []diffmatchpatch.Diff) []string {
b := new(patchBuilder)
b.output = make([]string, 0, len(diffs))
for _, diff := range diffs {
lines := strings.Split(diff.Text, "\n")
for idx, line := range lines {
if idx > 0 {
b.AddNewline(diff.Type)
}
b.AddCharacters(line, diff.Type)
}
}
b.Flush()
return b.output
}
-2
View File
@@ -1,2 +0,0 @@
// diff provides quick and easy string diffing functions based on github.com/sergi/go-diff, mainly for diffing strings in tests
package diff
-19
View File
@@ -1,19 +0,0 @@
package diff
import (
"strings"
)
// TrimLines applies TrimSpace to each string in the given array.
func TrimLines(input []string) []string {
result := make([]string, 0, len(input))
for _, el := range input {
result = append(result, strings.TrimSpace(el))
}
return result
}
// TrimLinesInString applies TrimSpace to each line in the given string, and returns the new trimmed string. Empty lines are not removed.
func TrimLinesInString(input string) string {
return strings.Join(TrimLines(strings.Split(strings.TrimSpace(input), "\n")), "\n")
}
-3
View File
@@ -4,9 +4,6 @@ github.com/AdaLogics/go-fuzz-headers
# github.com/agnivade/levenshtein v1.2.1
## explicit; go 1.21
github.com/agnivade/levenshtein
# github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
## explicit
github.com/andreyvit/diff
# github.com/beorn7/perks v1.0.1
## explicit; go 1.11
github.com/beorn7/perks/quantile