From d5b704c08959e2252e218e70dc9239291179d87e Mon Sep 17 00:00:00 2001 From: Usta Shrestha Date: Tue, 9 Aug 2022 13:01:45 -0400 Subject: [PATCH] move microfactory main.main() to microfactory.bash package renaming and addition of func main() both done in the same place for clarity Test: m nothing Bug: N/A Change-Id: Icc7d18033fe6049001007fb35271335f19395b8a --- microfactory/microfactory.bash | 1 + microfactory/microfactory.go | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/microfactory/microfactory.bash b/microfactory/microfactory.bash index ded7b33..f037c04 100644 --- a/microfactory/microfactory.bash +++ b/microfactory/microfactory.bash @@ -51,6 +51,7 @@ function build_go local gen_src_dir="${BUILDDIR}/.microfactory_$(uname)_intermediates/src" mkdir -p "${gen_src_dir}" sed "s/^package microfactory/package main/" "${mf_src}/microfactory.go" >"${gen_src_dir}/microfactory.go" + printf "\n//for use with go run\nfunc main() { Main() }\n" >>"${gen_src_dir}/microfactory.go" mf_cmd="${GOROOT}/bin/go run ${gen_src_dir}/microfactory.go" else diff --git a/microfactory/microfactory.go b/microfactory/microfactory.go index a0c9a14..a3c50db 100644 --- a/microfactory/microfactory.go +++ b/microfactory/microfactory.go @@ -617,8 +617,6 @@ func rebuildMicrofactory(config *Config, mybin string) bool { return true } -// microfactory.bash will make a copy of this file renamed into the main package for use with `go run` -func main() { Main() } func Main() { var output, mybin string var config Config