Documentation ¶
Index ¶
- type Service
- func (s *Service) Build() error
- func (s *Service) CopyExe(name string) error
- func (s *Service) CopySource(file string) error
- func (s *Service) GetExePath() string
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) Stop()
- func (s *Service) WriteExe(w io.Writer) error
- func (s *Service) WriteSource(w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
A Service takes care of creating the source file and building the executable. It can start the executable as well.
func NewConsoleService ¶
NewConsoleService creates a new *Service containing a console application which always exits with the supplied exit code.
func NewWebAppService ¶
NewWebAppService creates a new *Service containing a web application listening on port, returning statusCode and statusMessage in every HTTP response.
func (*Service) CopySource ¶
CopySource creates a named file containing the source code of the application.
func (*Service) GetExePath ¶
GetExePath returns the path to the built executable. If it has not been built yet, GetExePath returns an empty string.
func (*Service) Start ¶
Start starts the built executable. If the supplied context is nil, *Service uses an internal context which can be cancelled by calling Stop(). Otherwise you have to cancel the supplied context yourself.
func (*Service) Stop ¶
func (s *Service) Stop()
Stop stops the built executable if it has been started with the internal context.