I've tried to create a executable as a windows service using golang based on example provided in https://github.com/golang/sys/tree/master/windows/svc/example
I intended to create auto start service with executable specific command line argument 'init'
So whenever service get started executable should perform init operation. Following go code snippet is looks like this.
based on the documentation,
I added command line argument along with binarypath as mentioned in this config https://pkg.go.dev/golang.org/x/sys/windows/svc/mgr#Config
I added commandline argument in CreateService method. https://pkg.go.dev/golang.org/x/sys/windows/svc/mgr#Mgr.CreateService
Tried with Execute args. https://pkg.go.dev/golang.org/x/sys/windows/svc/mgr#Service.Start
But start parameter is not properly added in windows service and executable is nor running as expected.
In created windows service I'm able to see init is added along with executable name, but it is not added in start parameter as well as whenever service is started it is expected to write some log in file, that is also not happening.
Can anyone let me know if this configurations are valid ? If not suggest your thoughts. Thanks.