fix: change usage from filepath to path (#9260)

# Which Problems Are Solved

Paths for setup steps are joined with "\" when binary is started under
Windows, which results in wrongly joined paths.

# How the Problems Are Solved

Replace the usage of "filepath" with "path" package, which does only
join with "/" and nothing OS specific.

# Additional Changes

None

# Additional Context

Closes #9227
This commit is contained in:
Stefan Benz 2025-01-29 09:53:27 +01:00 committed by GitHub
parent 3fc68e5d60
commit a59c6b9f84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,7 @@ import (
"embed" "embed"
_ "embed" _ "embed"
"net/http" "net/http"
"path/filepath" "path"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
@ -279,7 +279,7 @@ func mustExecuteMigration(ctx context.Context, eventstoreClient *eventstore.Even
// Typ describes the database dialect and may be omitted if no // Typ describes the database dialect and may be omitted if no
// dialect specific migration is specified. // dialect specific migration is specified.
func readStmt(fs embed.FS, folder, typ, filename string) (string, error) { func readStmt(fs embed.FS, folder, typ, filename string) (string, error) {
stmt, err := fs.ReadFile(filepath.Join(folder, typ, filename)) stmt, err := fs.ReadFile(path.Join(folder, typ, filename))
return string(stmt), err return string(stmt), err
} }
@ -293,7 +293,7 @@ type statement struct {
// Typ describes the database dialect and may be omitted if no // Typ describes the database dialect and may be omitted if no
// dialect specific migration is specified. // dialect specific migration is specified.
func readStatements(fs embed.FS, folder, typ string) ([]statement, error) { func readStatements(fs embed.FS, folder, typ string) ([]statement, error) {
basePath := filepath.Join(folder, typ) basePath := path.Join(folder, typ)
dir, err := fs.ReadDir(basePath) dir, err := fs.ReadDir(basePath)
if err != nil { if err != nil {
return nil, err return nil, err