service: do not call osext if go1.8+ is used
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
//+build !go1.8
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/kardianos/osext"
|
||||
)
|
||||
|
||||
func (c *Config) execPath() (string, error) {
|
||||
if len(c.Executable) != 0 {
|
||||
return filepath.Abs(c.Executable)
|
||||
}
|
||||
return osext.Executable()
|
||||
}
|
||||
-10
@@ -64,9 +64,6 @@ package service // import "github.com/kardianos/service"
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/kardianos/osext"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -117,13 +114,6 @@ type Config struct {
|
||||
Option KeyValue
|
||||
}
|
||||
|
||||
func (c *Config) execPath() (string, error) {
|
||||
if len(c.Executable) != 0 {
|
||||
return filepath.Abs(c.Executable)
|
||||
}
|
||||
return osext.Executable()
|
||||
}
|
||||
|
||||
var (
|
||||
system System
|
||||
systemRegistry []System
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//+build go1.8
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func (c *Config) execPath() (string, error) {
|
||||
if len(c.Executable) != 0 {
|
||||
return filepath.Abs(c.Executable)
|
||||
}
|
||||
return os.Executable()
|
||||
}
|
||||
Reference in New Issue
Block a user