I have followed below steps to create custom beat and which results me to infinite loop. I was digging for past 2 days. Kindly help me.
- Go version source editor
go version go1.13.10 windows/amd64
- Go environment variable
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\myname\AppData\Local\go-build
set GOENV=C:\Users\myname\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\MYDEV\ganesh\samplebeat\
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\MYCOMP~1.SMO\AppData\Local\Temp\2\go-build195706982=/tmp/go-build -gno-record-gcc-switches
- Create directory as per documentation
$ mkdir -p ${GOPATH}/src/github.com/elastic
- Clone the custom beat code
$ git clone https://github.com/elastic/beats ${GOPATH}/src/github.com/elastic/beats
Cloning into 'D:\MYDEV\ganesh\samplebeat\/src/github.com/elastic/beats'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 205668 (delta 0), reused 0 (delta 0), pack-reused 205664
Receiving objects: 100% (205668/205668), 232.73 MiB | 31.97 MiB/s, done.
Resolving deltas: 100% (124645/124645), done.
Checking out files: 100% (18274/18274), done.
- Try generating custom beat
$ mage -debug GenerateCustomBeat
bash: mage: command not found
- Due to mage file not found. Clone mage directory and set the mage exe to env variable.
myname@mymachine MINGW64 /d/MYDEV/ganesh/samplebeat
$ git clone https://github.com/magefile/mage
Cloning into 'mage'...
remote: Enumerating objects: 77, done.
remote: Counting objects: 100% (77/77), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 1981 (delta 28), reused 31 (delta 9), pack-reused 1904
Receiving objects: 100% (1981/1981), 7.79 MiB | 11.22 MiB/s, done.
Resolving deltas: 100% (969/969), done.
$ cd mage
$ go run bootstrap.go
Running target: Install
exec: go env GOBIN
exec: go env GOPATH
exec: git rev-parse --short HEAD
exec: git describe --tags
exec: go build -o D:\MYDEV\ganesh\samplebeat\bin\mage.exe -ldflags=-X "github.com/magefile/mage/mage.timestamp=2020-04-17T21:59:23Z" -X "github.com/magefile/mage/mage.commitHash=310e198" -X "github.com/magefile/mage/mage.gitTag=v1.9.0-12-g310e198" github.com/magefile/mage
myname@mymachine MINGW64 /d/MYDEV/ganesh/samplebeat/mage (master)
$ cd ..
myname@mymachine MINGW64 /d/MYDEV/ganesh/samplebeat
$ cd src/github.com/elastic/beats/
- Try Create custom beat as per documentation
myname@mymachine MINGW64 /d/MYDEV/ganesh/samplebeat/src/github.com/elastic/beats (master)
$ mage -debug GenerateCustomBeat
DEBUG: 22:01:06.132134 getting all non-mage files in .
DEBUG: 22:01:08.451523 found non-mage files
DEBUG: 22:01:08.451523 getting all files plus mage files
DEBUG: 22:01:10.017316 time to scan for Magefiles: 3.8850816s
DEBUG: 22:01:10.017316 found magefiles: magefile.go
DEBUG: 22:01:10.044377 output exe is C:\Users\myname\magefile\4f50871a7b9c2f8e90de6ea0a278a93206baca5d.exe
DEBUG: 22:01:10.075028 go build cache exists, will ignore any compiled binary
DEBUG: 22:01:10.075028 parsing files
DEBUG: 22:01:10.075028 found target AddLicenseHeaders
DEBUG: 22:01:10.075028 found target CheckLicenseHeaders
DEBUG: 22:01:10.075028 found target DumpVariables
DEBUG: 22:01:10.075028 found target Fmt
DEBUG: 22:01:10.075028 found target GenerateCustomBeat
DEBUG: 22:01:10.075028 found target PackageBeatDashboards
DEBUG: 22:01:10.075028 found target Vendor
DEBUG: 22:01:10.075028 time parse Magefiles: 0s
DEBUG: 22:01:10.075028 Creating mainfile at mage_output_file.go
DEBUG: 22:01:10.075028 writing new file at mage_output_file.go
DEBUG: 22:01:10.076021 compiling to C:\Users\myname\magefile\4f50871a7b9c2f8e90de6ea0a278a93206baca5d.exe
DEBUG: 22:01:10.077021 compiling using gocmd: go
DEBUG: 22:01:10.304650 running go build -o C:\Users\myname\magefile\4f50871a7b9c2f8e90de6ea0a278a93206baca5d.exe magefile.go mage_output_file.go
DEBUG: 22:01:12.261719 time to compile Magefile: 1.9520184s
DEBUG: 22:01:12.261719 running binary C:\Users\myname\magefile\4f50871a7b9c2f8e90de6ea0a278a93206baca5d.exe
DEBUG: 22:01:12.261719 running magefile with mage vars:
MAGEFILE_DEBUG=1
MAGEFILE_GOCMD=go
Enter the beat name [examplebeat]: test1
Enter your github name [your-github-name]: test2
Enter the beat path [github.com/test2/test1]: test3
Enter your full name [Firstname Lastname]: test4
Enter the beat type [beat]: beat
Enter the github.com/elastic/beats revision [master]: master
go: creating new go.mod: module test3
go: finding github.com master
...
...
go: extracting github.com/containerd/containerd v1.3.3
go: finding github.com/tsg/go-daemon v0.0.0-20200207173439-e704b93fd89b
DEBUG: 22:01:55.950169 getting all non-mage files in .
DEBUG: 22:01:56.858663 found non-mage files main.go
DEBUG: 22:01:56.858663 marked file as non-mage: "main.go"
DEBUG: 22:01:56.858663 getting all files plus mage files
DEBUG: 22:01:57.506874 time to scan for Magefiles: 1.5576661s
DEBUG: 22:01:57.506874 found magefiles: magefile.go
DEBUG: 22:01:57.534067 output exe is C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe
DEBUG: 22:01:57.565708 go build cache exists, will ignore any compiled binary
DEBUG: 22:01:57.565708 parsing files
DEBUG: 22:01:57.565708 found target Build
DEBUG: 22:01:57.565708 found target BuildGoDaemon
DEBUG: 22:01:57.565708 found target Check
DEBUG: 22:01:57.565708 found target Clean
DEBUG: 22:01:57.565708 found target Config
DEBUG: 22:01:57.565708 found target CrossBuild
DEBUG: 22:01:57.565708 found target Fields
DEBUG: 22:01:57.565708 found target Fmt
DEBUG: 22:01:57.565708 found target GolangCrossBuild
DEBUG: 22:01:57.565708 found target Package
DEBUG: 22:01:57.565708 found target Test
DEBUG: 22:01:57.565708 found target Update
DEBUG: 22:01:57.565708 found target VendorUpdate
DEBUG: 22:01:57.565708 time parse Magefiles: 0s
DEBUG: 22:01:57.565708 Creating mainfile at mage_output_file.go
DEBUG: 22:01:57.843391 writing new file at mage_output_file.go
DEBUG: 22:01:57.858458 compiling to C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe
DEBUG: 22:01:57.858458 compiling using gocmd: go
DEBUG: 22:01:58.054503 running go build -o C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe magefile.go mage_output_file.go
DEBUG: 22:02:00.647532 time to compile Magefile: 2.587994s
DEBUG: 22:02:00.647532 running binary C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe
DEBUG: 22:02:00.647532 running magefile with mage vars:
MAGEFILE_VERBOSE=0
MAGEFILE_DEBUG=1
MAGEFILE_GOCMD=go
MAGEFILE_DEBUG=1
MAGEFILE_GOCMD=go
DEBUG: 22:02:00.821644 getting all non-mage files in .
DEBUG: 22:02:01.480696 found non-mage files main.go
DEBUG: 22:02:01.480696 marked file as non-mage: "main.go"
DEBUG: 22:02:01.480696 getting all files plus mage files
DEBUG: 22:02:02.110479 time to scan for Magefiles: 1.288802s
DEBUG: 22:02:02.110479 found magefiles: magefile.go
DEBUG: 22:02:02.138762 output exe is C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe
DEBUG: 22:02:02.169577 go build cache exists, will ignore any compiled binary
DEBUG: 22:02:02.169577 parsing files
DEBUG: 22:02:02.169577 found target Build
DEBUG: 22:02:02.169577 found target BuildGoDaemon
DEBUG: 22:02:02.169577 found target Check
DEBUG: 22:02:02.169577 found target Clean
DEBUG: 22:02:02.169577 found target Config
DEBUG: 22:02:02.169577 found target CrossBuild
DEBUG: 22:02:02.169577 found target Fields
DEBUG: 22:02:02.169577 found target Fmt
DEBUG: 22:02:02.169577 found target GolangCrossBuild
DEBUG: 22:02:02.169577 found target Package
DEBUG: 22:02:02.169577 found target Test
DEBUG: 22:02:02.169577 found target Update
DEBUG: 22:02:02.169577 found target VendorUpdate
DEBUG: 22:02:02.169577 time parse Magefiles: 0s
DEBUG: 22:02:02.169577 Creating mainfile at mage_output_file.go
DEBUG: 22:02:02.169577 writing new file at mage_output_file.go
DEBUG: 22:02:02.181575 compiling to C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe
DEBUG: 22:02:02.181575 compiling using gocmd: go
DEBUG: 22:02:02.380083 running go build -o C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe magefile.go mage_output_file.go
DEBUG: 22:02:03.253049 time to compile Magefile: 867.9426ms
DEBUG: 22:02:03.253049 running binary C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe
DEBUG: 22:02:03.253049 running magefile with mage vars:
MAGEFILE_VERBOSE=0
MAGEFILE_DEBUG=1
MAGEFILE_GOCMD=go
MAGEFILE_DEBUG=1
MAGEFILE_GOCMD=go
**DEBUG: 22:02:03.336441 getting all non-mage files in .**
**DEBUG: 22:02:03.998261 found non-mage files main.go**
**DEBUG: 22:02:03.998261 marked file as non-mage: "main.go"**
**DEBUG: 22:02:03.998261 getting all files plus mage files**
**DEBUG: 22:02:04.621080 time to scan for Magefiles: 1.284606s**
**DEBUG: 22:02:04.621080 found magefiles: magefile.go**
**DEBUG: 22:02:04.648135 output exe is C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe**
**DEBUG: 22:02:04.678626 go build cache exists, will ignore any compiled binary**
**DEBUG: 22:02:04.678626 parsing files**
**DEBUG: 22:02:04.678626 found target Build**
**DEBUG: 22:02:04.678626 found target BuildGoDaemon**
**DEBUG: 22:02:04.678626 found target Check**
**DEBUG: 22:02:04.678626 found target Clean**
**DEBUG: 22:02:04.678626 found target Config**
**DEBUG: 22:02:04.678626 found target CrossBuild**
**DEBUG: 22:02:04.678626 found target Fields**
**DEBUG: 22:02:04.678626 found target Fmt**
**DEBUG: 22:02:04.678626 found target GolangCrossBuild**
**DEBUG: 22:02:04.678626 found target Package**
**DEBUG: 22:02:04.678626 found target Test**
**DEBUG: 22:02:04.678626 found target Update**
**DEBUG: 22:02:04.678626 found target VendorUpdate**
**DEBUG: 22:02:04.678626 time parse Magefiles: 0s**
**DEBUG: 22:02:04.678626 Creating mainfile at mage_output_file.go**
**DEBUG: 22:02:04.678626 writing new file at mage_output_file.go**
**DEBUG: 22:02:04.690626 compiling to C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe**
**DEBUG: 22:02:04.690626 compiling using gocmd: go**
**DEBUG: 22:02:04.887450 running go build -o C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe magefile.go mage_output_file.go**
**DEBUG: 22:02:05.770923 time to compile Magefile: 878.4584ms**
**DEBUG: 22:02:05.770923 running binary C:\Users\myname\magefile\fa3afd537e6d4bf479585db0acb2048a7bbecfb0.exe**
**DEBUG: 22:02:05.770923 running magefile with mage vars:**
**MAGEFILE_VERBOSE=0**
**MAGEFILE_DEBUG=1**
**MAGEFILE_GOCMD=go**
**MAGEFILE_DEBUG=1**
**MAGEFILE_GOCMD=go**
...
The above terminal is endless.. it was keep running with same blocks highlighted in bold. Kindly provide some insight