Add common function to create a service.
This commit is contained in:
+9
-1
@@ -1,7 +1,15 @@
|
|||||||
// Package service provides a simple way to create a system service.
|
// Package service provides a simple way to create a system service.
|
||||||
// Currently only supprts Windows.
|
// Currently only supports Windows.
|
||||||
package service
|
package service
|
||||||
|
|
||||||
|
// Creates a new service. name is the internal name
|
||||||
|
// and should not contain spaces. Display name is the pretty print
|
||||||
|
// name. The description is an arbitrary string used to describe the
|
||||||
|
// service.
|
||||||
|
func NewService(name, displayName, description string) Service {
|
||||||
|
return newService(name, displayName, description)
|
||||||
|
}
|
||||||
|
|
||||||
// Represents a generic way to interact with the system's service.
|
// Represents a generic way to interact with the system's service.
|
||||||
type Service interface {
|
type Service interface {
|
||||||
// Installs this service on the system. May return an
|
// Installs this service on the system. May return an
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewService(name, displayName, description string) Service {
|
func newService(name, displayName, description string) Service {
|
||||||
return &windowsService{
|
return &windowsService{
|
||||||
name: name,
|
name: name,
|
||||||
displayName: displayName,
|
displayName: displayName,
|
||||||
|
|||||||
Reference in New Issue
Block a user