osquery / osquery-go

Go bindings for osquery
MIT License
386 stars 78 forks source link

not enough arguments in call to iprot. [...] #90

Closed hrstrand closed 3 years ago

hrstrand commented 3 years ago

go version go1.15.6 darwin/amd64

Running the default example in

https://github.com/osquery/osquery-go/blob/master/examples/query/main.go

results in compile errors :

# github.com/kolide/osquery-go/gen/osquery
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:134:37: not enough arguments in call to iprot.ReadStructBegin
    have ()
    want (context.Context)
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:140:57: not enough arguments in call to iprot.ReadFieldBegin
    have ()
    want (context.Context)
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:152:29: not enough arguments in call to iprot.Skip
    have (thrift.TType)
    want (context.Context, thrift.TType)
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:181:33: not enough arguments in call to iprot.ReadFieldEnd
    have ()
    want (context.Context)
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:185:32: not enough arguments in call to iprot.ReadStructEnd
    have ()
    want (context.Context)
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:192:32: not enough arguments in call to iprot.ReadString
    have ()
    want (context.Context)
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:201:32: not enough arguments in call to iprot.ReadString
    have ()
    want (context.Context)
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:210:32: not enough arguments in call to iprot.ReadString
    have ()
    want (context.Context)
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:219:35: not enough arguments in call to oprot.WriteStructBegin
    have (string)
    want (context.Context, string)
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:226:33: not enough arguments in call to oprot.WriteFieldStop
    have ()
    want (context.Context)
../src/github.com/kolide/osquery-go/gen/osquery/osquery.go:226:33: too many errors

Compilation finished with exit code 2

Is this expected to work out of the box, or is there any manual Thrift work that needs to be done?

triggspy commented 3 years ago

Hi @hrstrand, did you resolve this? I am getting the same error.

jemos commented 3 years ago

In case it helps, I had same problem while trying to build a go extension. To overcome this I had to use a go.mod in my extension with the same apache thrift version used by osquery-go:

module ...

require (
    github.com/apache/thrift v0.13.1-0.20200603211036-eac4d0c79a5f
    github.com/osquery/osquery-go v0.0.0-20210622151333-99b4efa62ec5
)

go 1.13
directionless commented 3 years ago

I'm not sure if there's an issue here. If I build in this repo, I get a working extension:

dover:osquery-go seph$ go build -o /tmp/q.ext ./examples/query/
dover:osquery-go seph$ /tmp/q.ext /tmp/osq.sock "select version from osquery_info"
Got results:
osquery.ExtensionPluginResponse{map[string]string{"version":"4.8.0"}}
zhaojiajun193 commented 1 year ago

I think you can look at this. https://www.cloudwego.io/zh/docs/kitex/tutorials/code-gen/code_generation/ Maybe because of the different api interface of different versions of thrift.