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:
parent
1265f9fb07
commit
bde7aeed90
7 changed files with 104 additions and 72 deletions
|
@ -7,7 +7,7 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
||||
"github.com/atomaka/collect/collector"
|
||||
)
|
||||
|
||||
|
@ -27,22 +27,22 @@ func (a *TarArchiver) Create(outputPath string, files []collector.FileEntry) err
|
|||
return fmt.Errorf("failed to create output file: %w", err)
|
||||
}
|
||||
defer outFile.Close()
|
||||
|
||||
|
||||
// Create gzip writer
|
||||
gzipWriter := gzip.NewWriter(outFile)
|
||||
defer gzipWriter.Close()
|
||||
|
||||
|
||||
// Create tar writer
|
||||
tarWriter := tar.NewWriter(gzipWriter)
|
||||
defer tarWriter.Close()
|
||||
|
||||
|
||||
// Add each file to the archive
|
||||
for _, file := range files {
|
||||
if err := a.addFileToTar(tarWriter, file); err != nil {
|
||||
return fmt.Errorf("failed to add file %s: %w", file.Path, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -59,28 +59,28 @@ func (a *TarArchiver) addFileToTar(tw *tar.Writer, file collector.FileEntry) err
|
|||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
|
||||
// Get file info
|
||||
info, err := f.Stat()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
// Create tar header
|
||||
header, err := tar.FileInfoHeader(info, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
// Use the relative path in the archive
|
||||
header.Name = filepath.ToSlash(file.Path)
|
||||
|
||||
|
||||
// Write header
|
||||
if err := tw.WriteHeader(header); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
// Copy file contents
|
||||
_, err = io.Copy(tw, f)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue