From ef9713b3487dbab2eade693b33a85dbdf5de6732 Mon Sep 17 00:00:00 2001 From: zhsj Date: Tue, 6 Oct 2020 16:59:32 +0800 Subject: [PATCH] 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 --- config.go | 7 +++---- go.mod | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/config.go b/config.go index 358014bc2..5ca68a193 100644 --- a/config.go +++ b/config.go @@ -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 { diff --git a/go.mod b/go.mod index 7bf05abbd..fa927a09a 100644 --- a/go.mod +++ b/go.mod @@ -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