From 32c44e6baa046238caf9be6d9b47febeb36b387a Mon Sep 17 00:00:00 2001 From: Gil Raphaelli Date: Fri, 9 Feb 2018 10:06:52 -0500 Subject: [PATCH 1/3] set libbeat version --- generator/beat/{beat}/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/generator/beat/{beat}/Makefile b/generator/beat/{beat}/Makefile index e983ed2b7aab..314b65cb2978 100644 --- a/generator/beat/{beat}/Makefile +++ b/generator/beat/{beat}/Makefile @@ -8,6 +8,7 @@ ES_BEATS?=./vendor/github.com/elastic/beats GOPACKAGES=$(shell govendor list -no-status +local) PREFIX?=. NOTICE_FILE=NOTICE +GOBUILD_FLAGS=-i -ldflags "-X $(BEAT_PATH)/vendor/github.com/elastic/beats/libbeat/version.buildTime=$(NOW) -X $(BEAT_PATH)/vendor/github.com/elastic/beats/libbeat/version.commit=$(COMMIT_ID)" # Path to the libbeat Makefile -include $(ES_BEATS)/libbeat/scripts/Makefile From ec0f5484974749c6f180d228f20a166959c20ce9 Mon Sep 17 00:00:00 2001 From: Gil Raphaelli Date: Fri, 9 Feb 2018 10:43:28 -0500 Subject: [PATCH 2/3] don't shadow config import --- generator/beat/{beat}/beater/{beat}.go.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generator/beat/{beat}/beater/{beat}.go.tmpl b/generator/beat/{beat}/beater/{beat}.go.tmpl index 564ba4098a88..4d0f5f09a070 100644 --- a/generator/beat/{beat}/beater/{beat}.go.tmpl +++ b/generator/beat/{beat}/beater/{beat}.go.tmpl @@ -18,15 +18,15 @@ type {Beat} struct { } // Creates beater -func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) { - config := config.DefaultConfig - if err := cfg.Unpack(&config); err != nil { +func New(b *beat.Beat, c *common.Config) (beat.Beater, error) { + cfg := config.DefaultConfig + if err := c.Unpack(&cfg); err != nil { return nil, fmt.Errorf("Error reading config file: %v", err) } bt := &{Beat}{ done: make(chan struct{}), - config: config, + config: cfg, } return bt, nil } From a8841e5651d57fa4512c943c0d200ad91ae6853b Mon Sep 17 00:00:00 2001 From: Gil Raphaelli Date: Mon, 12 Feb 2018 10:58:27 -0500 Subject: [PATCH 3/3] switch cfg var per feedback cfg is normally used to represent go-ucfg / common.Config --- generator/beat/{beat}/beater/{beat}.go.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generator/beat/{beat}/beater/{beat}.go.tmpl b/generator/beat/{beat}/beater/{beat}.go.tmpl index 4d0f5f09a070..e2d67f949ee4 100644 --- a/generator/beat/{beat}/beater/{beat}.go.tmpl +++ b/generator/beat/{beat}/beater/{beat}.go.tmpl @@ -18,15 +18,15 @@ type {Beat} struct { } // Creates beater -func New(b *beat.Beat, c *common.Config) (beat.Beater, error) { - cfg := config.DefaultConfig - if err := c.Unpack(&cfg); err != nil { +func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) { + c := config.DefaultConfig + if err := cfg.Unpack(&c); err != nil { return nil, fmt.Errorf("Error reading config file: %v", err) } bt := &{Beat}{ done: make(chan struct{}), - config: cfg, + config: c, } return bt, nil }