Bump from go 1.14 to go 1.24 and fix all go lint warnings

This commit is contained in:
pancake committed 2026-01-12 19:32:05 +01:00
1 parent 6f2a92d3fa
commit da420d5b54
9 files changed
+39 -22

No files matched your search

+21 -3
View File
@@ -11,12 +11,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.17
go-version: "1.24"
- name: Set up radare2
run: git clone --depth=1 https://github.com/radareorg/radare2 && radare2/sys/install.sh > /dev/null
@@ -26,3 +26,21 @@ jobs:
- name: Test
run: go test -v .
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
- name: go vet
run: go vet ./...
+1 -1
View File
@@ -45,7 +45,7 @@ func NewApiPipe(file string) (*Pipe, error) {
},
}
if file != "" {
r2p.ApiCmd("o " + file)
_, _ = r2p.ApiCmd("o " + file)
}
return r2p, nil
}
+5 -5
View File
@@ -9,20 +9,20 @@ func TestErrSide(t *testing.T) {
if err != nil {
t.Fatal(err)
}
r2p.Close()
_ = r2p.Close()
var res = false
r2p.On("errmsg", res, func(p *Pipe, typ string, user interface{}, dat string) bool {
_ = r2p.On("errmsg", res, func(p *Pipe, typ string, user interface{}, dat string) bool {
fmt.Println("errmsg received")
res = true
return false
// return true
})
r2p.Cmd("aaa")
time.Sleep(1)
_, _ = r2p.Cmd("aaa")
time.Sleep(100 * time.Millisecond)
if res {
fmt.Println("It works!")
}
defer r2p.Close()
defer func() { _ = r2p.Close() }()
fmt.Println("[*] Testing r2pipe-side stderr message")
}
+1 -1
View File
@@ -1,3 +1,3 @@
module github.com/radareorg/r2pipe-go
go 1.14
go 1.24
+3 -4
View File
@@ -26,7 +26,6 @@ package r2pipe
import "C"
import (
"errors"
"fmt"
"runtime"
"unsafe"
@@ -80,11 +79,11 @@ func dlOpen(path string) (*DL, error) {
}
}
return nil, errors.New(fmt.Sprintf("Failed to open %s in standard paths", path))
return nil, fmt.Errorf("failed to open %s in standard paths", path)
}
func dlSym(dl *DL, name string) (unsafe.Pointer, error) {
err := fmt.Errorf("Failed to load '%s' from '%s'", name, dl.name)
err := fmt.Errorf("failed to load '%s' from '%s'", name, dl.name)
cname := C.CString(name)
if cname == nil {
return nil, err
@@ -152,7 +151,7 @@ func NewNativePipe(file string) (*Pipe, error) {
},
}
if file != "" {
r2p.NativeCmd("o " + file)
_, _ = r2p.NativeCmd("o " + file)
}
return r2p, nil
}
+3 -3
View File
@@ -116,7 +116,7 @@ func newPipeCmd(file string) (*Pipe, error) {
if err == nil {
r2p.stdout, err = r2p.r2cmd.StdoutPipe()
if err == nil {
r2p.stderr, err = r2p.r2cmd.StdoutPipe()
r2p.stderr, _ = r2p.r2cmd.StderrPipe()
}
if err = r2p.r2cmd.Start(); err == nil {
//Read the initial data
@@ -155,14 +155,14 @@ func (r2p *Pipe) On(evname string, p interface{}, cb EventDelegate) error {
go func() {
var buf bytes.Buffer
for {
io.Copy(&buf, f)
_, _ = io.Copy(&buf, f)
if buf.Len() > 0 {
if !cb(r2p, evname, p, buf.String()) {
break
}
}
}
f.Close()
_ = f.Close()
}()
return nil
}
+1 -1
View File
@@ -10,7 +10,7 @@ func TestApiCmd(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer r2p.Close()
defer func() { _ = r2p.Close() }()
version, err := r2p.Cmd("pd 10 @ entry0")
if err != nil {
t.Fatal(err)
+1 -1
View File
@@ -12,7 +12,7 @@ func TestNativeCmd(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer r2p.Close()
defer func() { _ = r2p.Close() }()
version, err := r2p.Cmd("pd 10 @ entry0")
if err != nil {
t.Fatal(err)
+3 -3
View File
@@ -18,7 +18,7 @@ func TestCmd(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer r2p.Close()
defer func() { _ = r2p.Close() }()
check := "Hello World"
@@ -35,13 +35,13 @@ func TestCmd(t *testing.T) {
}
offset := Offset{}
r2p.CmdjStruct("sj ~{0}", &offset)
_ = r2p.CmdjStruct("sj ~{0}", &offset)
if !offset.Current {
t.Errorf("CurrentOffset=%v; want=%v", offset.Current, true)
}
r2p.CmdjfStruct("sj ~{%d}", &offset, 0)
_ = r2p.CmdjfStruct("sj ~{%d}", &offset, 0)
if !offset.Current {
t.Errorf("CurrentOffset=%v; want=%v", offset.Current, true)
}