From e8f2476f44c5ee0977a4162b97ab0c2ba917c7ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksa=20Siri=C5=A1ki?= <31509435+aleksasiriski@users.noreply.github.com> Date: Thu, 1 Jun 2023 21:19:57 +0200 Subject: [PATCH] fixed windows exe not working, switch to path.Join --- migrate/util.go | 4 ++-- processor/datastore.go | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/migrate/util.go b/migrate/util.go index f099b8ec..e20668ab 100644 --- a/migrate/util.go +++ b/migrate/util.go @@ -4,7 +4,7 @@ import ( "database/sql" "embed" "fmt" - "path/filepath" + "path" "sort" ) @@ -99,7 +99,7 @@ func (m *Migrator) parse(fs *embed.FS) ([]*migration, error) { return nil, fmt.Errorf("parse migration: %w", err) } - b, err := fs.ReadFile(filepath.Join(m.dir, f.Name())) + b, err := fs.ReadFile(path.Join(m.dir, f.Name())) if err != nil { return nil, fmt.Errorf("read migration: %w", err) } diff --git a/processor/datastore.go b/processor/datastore.go index 6e6378a6..1a9f421c 100644 --- a/processor/datastore.go +++ b/processor/datastore.go @@ -21,15 +21,11 @@ type datastore struct { dbType string } -var ( - //go:embed migrations/sqlite - migrationsSqlite embed.FS -) +//go:embed migrations/sqlite +var migrationsSqlite embed.FS -var ( - //go:embed migrations/postgres - migrationsPostgres embed.FS -) +//go:embed migrations/postgres +var migrationsPostgres embed.FS func newDatastore(db *sql.DB, dbType string, mg *migrate.Migrator) (*datastore, error) { switch dbType {