# Getting error while running main function in packetbeat

**URL:** <https://discuss.elastic.co/t/getting-error-while-running-main-function-in-packetbeat/51082>\
**Category:** Beats\
**Tags:** packetbeat\
**Created:** [May 26, 2016, 4:52pm UTC](https://discuss.elastic.co/t/getting-error-while-running-main-function-in-packetbeat/51082 "2016-05-26T16:52:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshafrnd4u](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@harshafrnd4u](https://discuss.elastic.co/u/harshafrnd4u)\
**Post date:** [May 26, 2016, 4:52pm UTC](https://discuss.elastic.co/t/getting-error-while-running-main-function-in-packetbeat/51082/1 "2016-05-26T16:52:38Z")

</div>

I am trying to build packetbeat from sources, and I tried running using command  
"go run main.go -c packetbeat.yml"

It gives error  
Exiting: error initializing publisher: Error loading template /tmp/go-build318793343/command-line-arguments/\_obj/exe/packetbeat.template.json: open /tmp/go-build318793343/command-line-arguments/\_obj/exe/packetbeat.template.json: no such file or directory  
exit status 1

Some background  
Installed go language, configured env variables. Ran commands  
"make"  
"make update"  
and then I ran command "go run main.go -c packetbeat.yml" and then it started giving above exception.

---

<div class="post-metadata">

**Author:** ![harshafrnd4u](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@harshafrnd4u](https://discuss.elastic.co/u/harshafrnd4u)\
**Post date:** [May 26, 2016, 6:09pm UTC](https://discuss.elastic.co/t/getting-error-while-running-main-function-in-packetbeat/51082/2 "2016-05-26T18:09:41Z")

</div>

I came to know after reading makefile that I need to run packetbeat executable generated from "make build".

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [May 30, 2016, 8:30am UTC](https://discuss.elastic.co/t/getting-error-while-running-main-function-in-packetbeat/51082/3 "2016-05-30T08:30:56Z")

</div>

@harshafrnd4u I assume it is now working as expected?

---

<div class="post-metadata">

**Author:** ![harshafrnd4u](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@harshafrnd4u](https://discuss.elastic.co/u/harshafrnd4u)\
**Post date:** [May 30, 2016, 8:48am UTC](https://discuss.elastic.co/t/getting-error-while-running-main-function-in-packetbeat/51082/4 "2016-05-30T08:48:56Z")

</div>

Yes ruflin it is working now, may be it would be good if you could add build process to documentation . It would help a newbie for go language and packetbeat like me. I actually went through makefile to understand the process.

Thanks @ruflin

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 9:51pm UTC](https://discuss.elastic.co/t/getting-error-while-running-main-function-in-packetbeat/51082/5 "2017-07-05T21:51:24Z")

</div>


