Permalink
Browse files

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

  • Loading branch information...
kardianos committed Feb 7, 2017
1 parent 6d3a0ee commit ef06f2f890aa4f20d1ff55da91b29392ba6af3af
Showing with 31 additions and 10 deletions.
  1. +16 −0 pre_go1.8.go
  2. +0 −10 service.go
  3. +15 −0 service_go1.8.go
View
@@ -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()
}
View
@@ -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
View
@@ -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()
}

0 comments on commit ef06f2f

Please sign in to comment.