service: do not call osext if go1.8+ is used

This commit is contained in:
Daniel Theophanes
2017-02-07 11:25:40 -08:00
parent 6d3a0ee7d3
commit ef06f2f890
3 changed files with 31 additions and 10 deletions
+16
View File
@@ -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
View File
@@ -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
+15
View File
@@ -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()
}