Replace kardianos/osext.Executable with os.Executable (#10048)

os.Executable is available since go1.8
https://github.com/kardianos/osext/blob/master/osext_go18.go
This commit is contained in:
zhsj
2020-10-06 16:59:32 +08:00
committed by GitHub
parent b34e61c961
commit ef9713b348
2 changed files with 4 additions and 5 deletions
+3 -4
View File
@@ -15,7 +15,6 @@ import (
"github.com/hashicorp/packer/command"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer/plugin"
"github.com/kardianos/osext"
)
// PACKERSPACE is used to represent the spaces that separate args for a command
@@ -131,7 +130,7 @@ func (c *config) Discover() error {
}
// Next, look in the same directory as the executable.
exePath, err := osext.Executable()
exePath, err := os.Executable()
if err != nil {
log.Printf("[ERR] Error loading exe directory: %s", err)
} else {
@@ -311,7 +310,7 @@ func (c *config) discoverSingle(glob string) (map[string]string, error) {
func (c *config) discoverInternalComponents() error {
// Get the packer binary path
packerPath, err := osext.Executable()
packerPath, err := os.Executable()
if err != nil {
log.Printf("[ERR] Error loading exe directory: %s", err)
return err
@@ -373,7 +372,7 @@ func (c *config) pluginClient(path string) *plugin.Client {
// If that doesn't work, look for it in the same directory
// as the `packer` executable (us).
log.Printf("Plugin could not be found at %s (%v). Checking same directory as executable.", originalPath, err)
exePath, err := osext.Executable()
exePath, err := os.Executable()
if err != nil {
log.Printf("Couldn't get current exe path: %s", err)
} else {
+1 -1
View File
@@ -78,7 +78,7 @@ require (
github.com/joyent/triton-go v0.0.0-20180628001255-830d2b111e62
github.com/json-iterator/go v1.1.6 // indirect
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect
github.com/klauspost/compress v0.0.0-20160131094358-f86d2e6d8a77 // indirect
github.com/klauspost/cpuid v0.0.0-20160106104451-349c67577817 // indirect
github.com/klauspost/crc32 v0.0.0-20160114101742-999f3125931f // indirect