Closed TerminalFi closed 1 year ago
Looks like it needs updated
https://github.com/ca110us/go-clamav/blob/3f3081af252a147f9eb63a74167012dce5518c1e/define.go#L128
Should be
err := errors.New(C.GoString(C.cl_strerror(C.cl_error_t(code))))
This may be with only the latest clamav
It works fine for me in version 0.104.2, what's your Clamav version.
Could you show me the current version header file clamav.h
.
I was building clamav from source. So whichever is in the master branch of clamav
How did you solved this problem, I have the same on ArchLinux
go/pkg/mod/github.com/ca110us/go-clamav@v0.6.0/define.go:128:45: cannot use _Ctype_int(code) (value of type _Ctype_int) as _Ctype_cl_error_t value in argument to (_Cfunc_cl_strerror)
package main
import (
"fmt"
clamav "github.com/ca110us/go-clamav"
)
func main() {
c := new(clamav.Clamav)
err := c.Init(clamav.SCAN_OPTIONS{
General: 0,
Parse: clamav.CL_SCAN_PARSE_ARCHIVE | clamav.CL_SCAN_PARSE_ELF,
Heuristic: 0,
Mail: 0,
Dev: 0,
})
if err != nil {
panic(err)
}
// free clamav memory
defer c.Free()
// load db
signo, err := c.LoadDB("./db", uint(clamav.CL_DB_DIRECTORY))
if err != nil {
panic(err)
}
fmt.Println("db load succeed:", signo)
// compile engine
err = c.CompileEngine()
if err != nil {
panic(err)
}
c.EngineSetNum(clamav.CL_ENGINE_MAX_SCANSIZE, 1024*1024*40)
c.EngineSetNum(clamav.CL_ENGINE_MAX_SCANTIME, 9000)
// fmt.Println(c.EngineGetNum(clamav.CL_ENGINE_MAX_SCANSIZE))
// scan
scanned, virusName, ret := c.ScanFile("test.txt")
fmt.Println(scanned, virusName, ret)
}
ClamAV 1.0.1/26893/Mon May 1 09:22:05 2023
Seems like I am running into this. Have you seen this?