From 97db9d82c4cb8b71a975e2a1c0e77878f2c962a8 Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Wed, 15 May 2024 19:13:34 -0400 Subject: [PATCH] packer: fix splitting error message on pathsep --- packer/plugin_folders.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packer/plugin_folders.go b/packer/plugin_folders.go index 09683d5f0bb..c7c1febd46c 100644 --- a/packer/plugin_folders.go +++ b/packer/plugin_folders.go @@ -13,13 +13,15 @@ import ( "github.com/hashicorp/packer-plugin-sdk/pathing" ) +var pathSep = fmt.Sprintf("%c", os.PathListSeparator) + // PluginFolder returns the known plugin folder based on system. func PluginFolder() (string, error) { if packerPluginPath := os.Getenv("PACKER_PLUGIN_PATH"); packerPluginPath != "" { - if strings.ContainsRune(packerPluginPath, os.PathListSeparator) { + if strings.Contains(packerPluginPath, pathSep) { return "", fmt.Errorf("Multiple paths are no longer supported for PACKER_PLUGIN_PATH.\n"+ "This should be defined as one of the following options for your environment:"+ - "\n* PACKER_PLUGIN_PATH=%v", strings.Join(strings.Split(packerPluginPath, ":"), "\n* PACKER_PLUGIN_PATH=")) + "\n* PACKER_PLUGIN_PATH=%v", strings.Join(strings.Split(packerPluginPath, pathSep), "\n* PACKER_PLUGIN_PATH=")) } return packerPluginPath, nil