Build issue with beats in project using go.mod

Hey all!
I have a project depending on beats/libbeat and after changing my dependency management to go modules I can no longer build the project. It fails with the following message:

unknown import path "github.com/elastic/beats/libbeat/publisher/bc/publisher": cannot find module providing package github.com/elastic/beats/libbeat/publisher/bc/publisher
../../../../pkg/mod/github.com/elastic/beats@v7.0.0+incompatible/libbeat/publisher/processing/default.go:23:2: unknown import path "github.com/elastic/ecs/code/go/ecs": cannot find module providing package github.com/elastic/ecs/code/go/ecs

In my go.mod I require
github.com/elastic/beats v7.0.0+incompatible
github.com/elastic/ecs v1.0.0 // indirect

and the problem seems to be that the file /libbeat/publisher/processing/default.go imports github.com/elastic/ecs/code/go/ecs which previously downloaded the actual folder containing all the go files from the repo (?). But now that I require github.com/elastic/ecs v1.0.0 in my go.mod it pulls the ecs release which does not contain any go files at all.

Am I interpreting this correctly? Can others confirm that they can not build their projects with go mod when depending on libbeat? Do you have any solution for me on how to fix the build?

Uff... I don't think beats or the ecs package os go modules ready. Beats/libbeat have a common release cycle with all elastic stack projects, which is why it doesn't really follow semver.

when using go modules, it doesn't care what you downloaded previously. go modules only care about what is available via the mod file. I can only guess, as I haven't tried this myself, but I assume that your dependency in the go.mod file should be: github.com/elastic/ecs/code/go/ecs // indirect.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.