I'm attempting to create a new custom beat but am hitting some errors when using the mage GenerateCustomBeat command.
mage GenerateCustomBeat
Enter the beat name [examplebeat]: testbeat
Enter your github name [your-github-name]: andrewexpanse
Enter the beat path [github.com/andrewexpanse/testbeat]:
Enter your full name [Firstname Lastname]: Andrew Scott
Enter the github.com/elastic/beats revision [master]:
go: creating new go.mod: module github.com/andrewexpanse/testbeat
go get github.com/elastic/beats/v7@master: module github.com/elastic/beats@master found (v7.0.0-alpha2.0.20200224095451-b0c600a28dbc+incompatible), but does not contain package github.com/elastic/beats/v7
Error: error while getting required beats version: running "go get -d -u github.com/elastic/beats/v7@master" failed with exit code 1
It seems like go is trying to fetch a too old version of master branch. We need to adjust the default value to make sure Go is not attempting to fetch an incorrect version. Do you mind opening an issue on GH?
You can work around the issue by providing the last commit from master.
When you say I could work around this by providing the last commit from master, do you mean I should enter a commit hash/id when asked Enter the github.com/elastic/beats revision?
The current supported Go version for beats is 1.13.8 as you can see in .go-version. Please use that to generate your new Beat. Also, that migth be broken as well. I am fixing that now.
This is also effecting x-pack module builds.
mage
Error determining list of magefiles: failed to list non-mage gofiles: exit status 1: go: inconsistent vendoring in /root/go/src/github.com/elastic/beats:
go.mod requires github.com/elastic/beats/v7 but vendor/modules.txt does not include it.
run 'go mod tidy; go mod vendor' to sync
running provided go sync and tidy does not fix it as there is no v7 module available.
I did manage to get it to work after some trial and error, but I've since restarted my machine and lost the command that actually worked - I believe I was just doing what you were doing here though.
This is what I'm getting when trying to get the module code. Keep in mind I can build filebeat but not the x-pack modules:
go mod tidy; go mod vendor
warning: ignoring symlink /root/go/src/github.com/elastic/beats/build/python-env/lib64
warning: ignoring symlink /root/go/src/github.com/elastic/beats/libbeat/build/python-env/lib64
github.com/elastic/beats/v7 imports
fmt: malformed module path "fmt": missing dot in first path element
github.com/elastic/beats/v7 imports
os: malformed module path "os": missing dot in first path element
github.com/elastic/beats/v7 imports
path/filepath: malformed module path "path/filepath": missing dot in first path element
github.com/elastic/beats/v7/auditbeat imports
time: malformed module path "time": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/datastore imports
io: malformed module path "io": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/datastore imports
sync: malformed module path "sync": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/helper/hasher imports
crypto/md5: malformed module path "crypto/md5": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/helper/hasher imports
crypto/sha1: malformed module path "crypto/sha1": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/helper/hasher imports
crypto/sha256: malformed module path "crypto/sha256": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/helper/hasher imports
crypto/sha512: malformed module path "crypto/sha512": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/helper/hasher imports
encoding/hex: malformed module path "encoding/hex": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/helper/hasher imports
hash: malformed module path "hash": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/helper/hasher imports
strings: malformed module path "strings": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/auditd imports
bufio: malformed module path "bufio": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/auditd imports
bytes: malformed module path "bytes": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/auditd imports
os/user: malformed module path "os/user": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/auditd imports
runtime: malformed module path "runtime": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/auditd imports
sort: malformed module path "sort": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/auditd imports
strconv: malformed module path "strconv": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/auditd imports
syscall: malformed module path "syscall": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/file_integrity imports
errors: malformed module path "errors": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/file_integrity imports
math/bits: malformed module path "math/bits": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/file_integrity imports
sync/atomic: malformed module path "sync/atomic": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/module/file_integrity/monitor imports
path: malformed module path "path": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/testing imports
io/ioutil: malformed module path "io/ioutil": missing dot in first path element
github.com/elastic/beats/v7/auditbeat/testing imports
testing: malformed module path "testing": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/cmd/dashboards imports
flag: malformed module path "flag": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/cmd/dashboards imports
log: malformed module path "log": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/cmd/dashboards imports
net/url: malformed module path "net/url": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/cmd/license imports
go/format: malformed module path "go/format": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/cmd/license imports
text/template: malformed module path "text/template": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/mage imports
archive/tar: malformed module path "archive/tar": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/mage imports
archive/zip: malformed module path "archive/zip": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/mage imports
compress/gzip: malformed module path "compress/gzip": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/mage imports
context: malformed module path "context": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/mage imports
encoding/json: malformed module path "encoding/json": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/mage imports
go/build: malformed module path "go/build": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/mage imports
net: malformed module path "net": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/mage imports
net/http: malformed module path "net/http": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/mage imports
os/exec: malformed module path "os/exec": missing dot in first path element
github.com/elastic/beats/v7/dev-tools/mage imports
os/signal: malformed module path "os/signal": missing dot in first path element
etc etc
I managed to get it working by using a previous commit SHA. When asked for the revision of beats to use, don't just hit enter; paste in the SHA of the commit previous to the most recent in master, which is currently 52fa26598cef8a90c8981970414c780e4fd31dbf.
Can you explain what the v7 part of the repository is? I can't find a branch or tag with that name but see it everywhere in the code. Why was this added?
I'm working on a PR that is based on a branch from master but now can't use it in a beat because it pulls beats/v7 into the vendors folder.
EDIT: After reading up on Go modules I figured out that adding a replace to go.mod would suffice. After doing that and running mage vendorUpdate, I can test my branch.
Go modules require us to add the major version to the import path:
By definition, a new major version of a package is not backwards compatible with the previous version. This means a new major version of a module must have a different module path than the previous version. Starting with v2 , the major version must appear at the end of the module path (declared in the module statement in the go.mod file). For example, when the authors of the module github.com/googleapis/gax-go developed v2 , they used the new module path github.com/googleapis/gax-go/v2 . Users who wanted to use v2 had to change their package imports and module requirements to github.com/googleapis/gax-go/v2 .
I have the same problem.
Ttried to downgrade my go version to 1.13.8
and tried the commit that "whatgeorgemade" mentioned.
And then again with the master.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.