refactor: merge go modules
Currently, tetragon is split into 3 modules:
github.com/cilium/tetragon/pkg/k8sgithub.com/cilium/tetragon/apigithub.com/cilium/tetragon
Also, there is recursive dependency beteen github.com/cilium/tetragon and github.com/cilium/tetragon/api, and none of them are go-gettable because of it.
Moreover, following is invalid:
github.com/cilium/tetragon/api v0.0.0-00010101000000-000000000000
github.com/cilium/tetragon/pkg/k8s v0.0.0-00010101000000-000000000000
Because replace-es are working only locally and ignored during go-get, and v0.0.0-00010101000000-000000000000 is not a valid revision.
I propose to merge all three of them, or at least root and /api, because it seems like it is impossible to resolve recursive dependencies.
Why they should be go-gettable
I'm using gRPC client to connect to tetragon and want to use github.com/cilium/tetragon/api for it.
Hey! I'm not sure to understand your issue here but I'll try to help. It seems that you wanted to use the gRPC client to connect to Tetragon.
- I had no issue running
go get github.com/cilium/tetragon/api/, it returns this in a fresh new module in a fresh 1.20.1 Golang install:go: downloading github.com/cilium/tetragon/api v0.0.0-20230221103812-a80c50718487 go: downloading github.com/cilium/tetragon v0.8.3 go: added github.com/cilium/tetragon/api v0.0.0-20230221103812-a80c5071848 - Here is a snippet of Go code that uses the gRPC client to interact with Tetragon, assuming it's listening on port
54321:
Can you try to use this andpackage main import ( "context" "fmt" "time" "github.com/cilium/tetragon/api/v1/tetragon" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" ) func main() { // connect and create a gRPC client connCtx, connCancel := context.WithTimeout(context.TODO(), 1*time.Second) defer connCancel() conn, err := grpc.DialContext(connCtx, "localhost:54321", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) if err != nil { panic(err) } defer conn.Close() client := tetragon.NewFineGuidanceSensorsClient(conn) // do an arbitrary request and print resp, err := client.GetVersion(context.TODO(), &tetragon.GetVersionRequest{}) if err != nil { panic(err) } fmt.Println(resp.String()) }go mod tidy?
:thinking: that's strange, it worked for me too now.
I'll close this issue for now, probably I messed up with my local setup in some way, thank you.
same thing(issue) right now(
I also ran into this weird error when I was trying to include my project (with a tetragon gRPC client) in a Go workspace. Suddenly, everything stopped working. Removing all the Go workspace related files fixed it.
This can be reproduced by the example provided above: https://github.com/cilium/tetragon/issues/712#issuecomment-1438821340