Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod

Expand All @@ -35,7 +35,7 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod

Expand All @@ -59,7 +59,7 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22

- name: Build
run: nix build
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod

Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod

Expand Down
2 changes: 1 addition & 1 deletion cmd/msgvault/cmd/addaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Examples:
if err != nil {
return fmt.Errorf("open database: %w", err)
}
defer s.Close()
defer func() { _ = s.Close() }()

if err := s.InitSchema(); err != nil {
return fmt.Errorf("init schema: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/msgvault/cmd/addimap.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Examples:
if err != nil {
return fmt.Errorf("open database: %w", err)
}
defer s.Close()
defer func() { _ = s.Close() }()

if err := s.InitSchema(); err != nil {
return fmt.Errorf("init schema: %w", err)
Expand Down
22 changes: 11 additions & 11 deletions cmd/msgvault/cmd/build_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func buildCache(dbPath, analyticsDir string, fullRebuild bool) (*buildResult, er
if err != nil {
return nil, fmt.Errorf("open duckdb: %w", err)
}
defer db.Close()
defer func() { _ = db.Close() }()

// Set up sqlite_db tables — either via DuckDB's sqlite extension (Linux/macOS)
// or via CSV intermediate files (Windows, where sqlite_scanner is unavailable).
Expand Down Expand Up @@ -511,7 +511,7 @@ var cacheStatsCmd = &cobra.Command{
if err != nil {
return fmt.Errorf("open duckdb: %w", err)
}
defer db.Close()
defer func() { _ = db.Close() }()

// Query stats by joining Parquet files
escapedDir := strings.ReplaceAll(analyticsDir, "'", "''")
Expand Down Expand Up @@ -625,7 +625,7 @@ func setupSQLiteSource(duckDB *sql.DB, dbPath string) (cleanup func(), err error

sqliteDB, err := sql.Open("sqlite3", dbPath+"?mode=ro")
if err != nil {
os.RemoveAll(tmpDir)
_ = os.RemoveAll(tmpDir)
return nil, fmt.Errorf("open sqlite for CSV export: %w", err)
}

Expand All @@ -650,17 +650,17 @@ func setupSQLiteSource(duckDB *sql.DB, dbPath string) (cleanup func(), err error
for _, t := range tables {
csvPath := filepath.Join(tmpDir, t.name+".csv")
if err := exportToCSV(sqliteDB, t.query, csvPath); err != nil {
sqliteDB.Close()
os.RemoveAll(tmpDir)
_ = sqliteDB.Close()
_ = os.RemoveAll(tmpDir)
return nil, fmt.Errorf("export %s to CSV: %w", t.name, err)
}
}
sqliteDB.Close()
_ = sqliteDB.Close()

// Create sqlite_db schema with views pointing to CSV files.
// This lets the existing COPY queries reference sqlite_db.tablename unchanged.
if _, err := duckDB.Exec("CREATE SCHEMA sqlite_db"); err != nil {
os.RemoveAll(tmpDir)
_ = os.RemoveAll(tmpDir)
return nil, fmt.Errorf("create sqlite_db schema: %w", err)
}
for _, t := range tables {
Expand All @@ -677,12 +677,12 @@ func setupSQLiteSource(duckDB *sql.DB, dbPath string) (cleanup func(), err error
t.name, escaped, csvOpts,
)
if _, err := duckDB.Exec(viewSQL); err != nil {
os.RemoveAll(tmpDir)
_ = os.RemoveAll(tmpDir)
return nil, fmt.Errorf("create view sqlite_db.%s: %w", t.name, err)
}
}

return func() { os.RemoveAll(tmpDir) }, nil
return func() { _ = os.RemoveAll(tmpDir) }, nil
}

// csvNullStr is written for NULL values in CSV exports so DuckDB can
Expand All @@ -696,13 +696,13 @@ func exportToCSV(db *sql.DB, query string, dest string) error {
if err != nil {
return err
}
defer rows.Close()
defer func() { _ = rows.Close() }()

f, err := os.Create(dest)
if err != nil {
return err
}
defer f.Close()
defer func() { _ = f.Close() }()

w := csv.NewWriter(f)

Expand Down
Loading