From cf14bc73332e66e97ab3cdc3a18fac46ff95d12e Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Sat, 26 Feb 2022 14:35:38 -0800
Subject: [PATCH] Fix "flag provided but not defined: -test.testlogfile"

Cannot use `Flag.parse` in init: https://github.com/golang/go/issues/46869#issuecomment-865650868
---
 .gitlab-ci.yml      | 2 --
 Makefile            | 2 +-
 eth-log-alerting.go | 4 +++-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 77dc0c6..1db537a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,8 +21,6 @@ before_script:
   - cd $GOPATH/src/$REPO_NAME
   - cp config-sample.json config.json
 
-  - export CC=clang
-
   - make dep
 
 unit_tests:
diff --git a/Makefile b/Makefile
index 92e0dda..9620b61 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ dep:
 	@go get github.com/mitchellh/gox
 
 build: dep
-	@gox -output="${CI_PROJECT_DIR}/eth-log-alerting-builds/{{.Dir}}_{{.OS}}_{{.Arch}}" -parallel=4 -osarch '!darwin/386'
+	@gox -output="${CI_PROJECT_DIR}/${PROJECT_NAME}/{{.Dir}}_{{.OS}}_{{.Arch}}" -parallel=6 -osarch '!darwin/386'
 
 clean:
 	@rm -f $(PROJECT_NAME)
diff --git a/eth-log-alerting.go b/eth-log-alerting.go
index 0b1ed74..ea70792 100644
--- a/eth-log-alerting.go
+++ b/eth-log-alerting.go
@@ -42,7 +42,7 @@ var (
 	debug     bool
 )
 
-func init() {
+func initConfig() {
 	flag.StringVar(&configPath, "config", "./config.json", "Path to configuration file")
 	flag.Parse()
 
@@ -69,6 +69,8 @@ func init() {
 }
 
 func main() {
+	initConfig()
+
 	logger.Printf("Starting log monitoring with config %s", configPath)
 
 	sig := make(chan os.Signal, 1)
-- 
GitLab