1
0
Fork 0

Apply standard Go formatting and update project documentation

- Run go fmt on all Go files to ensure consistent formatting
- Add official Go tooling commands to CLAUDE.md for code quality
- Update project status to reflect current implementation state
This commit is contained in:
Andrew Tomaka 2025-06-12 22:01:45 -04:00
parent 1265f9fb07
commit bde7aeed90
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
7 changed files with 104 additions and 72 deletions

View file

@ -6,7 +6,7 @@ import (
"io"
"os"
"path/filepath"
"github.com/atomaka/collect/collector"
)
@ -26,18 +26,18 @@ func (a *ZipArchiver) Create(outputPath string, files []collector.FileEntry) err
return fmt.Errorf("failed to create output file: %w", err)
}
defer outFile.Close()
// Create zip writer
zipWriter := zip.NewWriter(outFile)
defer zipWriter.Close()
// Add each file to the archive
for _, file := range files {
if err := a.addFileToZip(zipWriter, file); err != nil {
return fmt.Errorf("failed to add file %s: %w", file.Path, err)
}
}
return nil
}
@ -54,32 +54,32 @@ func (a *ZipArchiver) addFileToZip(zw *zip.Writer, file collector.FileEntry) err
return err
}
defer f.Close()
// Get file info
info, err := f.Stat()
if err != nil {
return err
}
// Create zip file header
header, err := zip.FileInfoHeader(info)
if err != nil {
return err
}
// Use the relative path in the archive
header.Name = filepath.ToSlash(file.Path)
// Set compression method
header.Method = zip.Deflate
// Create writer for this file
writer, err := zw.CreateHeader(header)
if err != nil {
return err
}
// Copy file contents
_, err = io.Copy(writer, f)
return err
}
}