Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat [Golang] Context Signal + Excellent Improvement 🤪 (#18)
* Feat [Golang] Context Signal - [+] feat(session.go): add context parameter to ConvertSessionsToCSV function - [+] feat(main.go): add context and signal handling to cancel operations on SIGINT or SIGTERM - [+] fix(main.go): exit with code 0 after repairing data - [+] fix(main.go): remove unused code and comments - [+] fix(main.go): handle context cancellation in processCSVOption function - [+] test(main_test.go): add context and cancel function to test ProcessCSVOption function * Feat & Refactor [Golang] Command Module + Code Comment - [+] fix(main.go): add comment to clarify the purpose of the code block - [+] refactor(main.go): rename variable 'store' to 'dataStore' for clarity - [+] feat(main.go): update package description and add support for repairing and exporting chat session data * Fix [Golang] Command Module - [+] fix(main.go): handle EOF error when reading input in promptForInput function * Feat [Golang] Context Main Command Module - [+] refactor(main.go): change promptForInput function signature to include context parameter - [+] feat(main.go): add support for handling EOF and other errors in promptForInput function - [+] feat(main.go): add support for exiting the program on EOF and other errors in promptForInput function - [+] feat(main.go): add support for exiting the program after cancellation in setupSignalHandling function - [+] feat(main.go): add support for exiting the program on other errors in promptForInput function - [+] feat(main.go): add support for exiting the program on invalid format option in processCSVOption function - [+] feat(main.go): add support for exiting the program on failed extraction to dataset in processDatasetOption function - [+] feat(main.go): add support for exiting the program on invalid save output option in saveToFile function - [+] feat(main.go): add support for exiting the program on invalid format option in executeCSVConversion function - [+] feat(main.go): add support for exiting the program on failed creation of * Test [Golang] Testing Proposal Main Command Module - [+] test(main_test.go): add support for capturing and asserting stdout output in TestProcessCSVOption - [+] test(main_test.go): add support for canceling context in TestPromptForInput * Feat [Golang] [Module] Testing + Exporter [Package] Code Comment - [+] chore(session.go): add support for context-aware operations - [+] feat(session.go): add support for context cancellation in ConvertSessionsToCSV function - [+] test(main_test.go): add test for promptForInput function * Feat [Golang] [Module] Main Command Code Comment - [+] refactor(main.go): add context support for cancellation in main function - [+] feat(main.go): add signal handling for graceful termination in setupSignalHandling function - [+] feat(main.go): add context support for cancellation in promptForInput function - [+] feat(main.go): add context support for cancellation in processOutputOption function - [+] feat(main.go): add context support for cancellation in processDatasetOption function - [+] feat(main.go): add context support for cancellation in saveToFile function - [+] refactor(main.go): remove context support from repairJSONData function - [+] feat(main.go): add context support for cancellation in executeCSVConversion function - [+] feat(main.go): add context support for cancellation in createSeparateCSVFiles function - [+] feat(main.go): add context support for cancellation in convertToSingleCSV function - [+] feat(main.go): add context support for cancellation in writeContentToFile function * Refactor [Golang] [Module] Main Command Code Comment - [+] refactor(main.go): improve comments and signal handling in setupSignalHandling function * Test [Golang] Main Command Module - [+] test(main_test.go): add error handling to promptForInput function in TestPromptForInput test * Feat & Fix [Golang] [Module] Main Command Context - [+] feat(main.go): add support for context cancellation during user input prompts - [+] fix(main.go): handle errors during user input prompts and exit program accordingly * Fix [Golang] [Module] Main Command Context - [+] fix(main.go): handle interrupt signal error when prompting for input * Fix [Golang] [Module] [Package] Main Command & Exporter - [+] fix(session.go): handle errors from closing CSV writers and files - [+] fix(session.go): handle errors from initializing CSV files - [+] fix(session.go): handle errors from writing session data - [+] fix(session.go): handle errors from writing message data - [+] fix(main.go): handle errors from promptForInput function - [+] fix(main.go): handle errors from repairJSONData function - [+] fix(main.go): handle errors from exporter.ReadJSONFromFile function - [+] fix(main.go): handle errors from exporter.ExtractToDataset function - [+] fix(main.go): handle errors from saveToFile function - [+] fix(main.go): handle errors from executeCSVConversion function - [+] fix(main.go): handle errors from createSeparateCSVFiles function - [+] fix(main.go): handle errors from exporter.CreateSeparateCSVFiles function - [+] fix(main.go): handle errors from convertToSingleCSV function - [+] fix(main.go): handle errors from writeContentToFile function * Refactor [Golang] [Module] Main Command Repair JSON Data - [+] fix(main.go): pass context to repairJSONData function - [+] refactor(main.go): remove duplicated error handling code in repairJSONData function - [+] refactor(main.go): remove unnecessary comments in repairJSONData function - [+] feat(main.go): simulate a context-aware operation in repairJSONData function * Test [Golang] [Module] Main Command Testing purposes. - [+] test(main_test.go): update package comment to provide a comprehensive description of the tests - [+] test(main_test.go): add TestProcessCSVOption to verify the functionality of processCSVOption - [+] test(main_test.go): add TestPromptForInput to verify the capturing and returning of user input - [+] test(main_test.go): add TestPromptForInputCancellation to check if promptForInput respects context cancellation - [+] test(main_test.go): add TestLoadTestSessionsInvalidPath to verify that loadTestSessions returns an error for non-existent files - [+] test(main_test.go): add TestLoadIncorrectJson to check loadTestSessions' behavior when provided with incorrect JSON format - [+] test(main_test.go): add TestRepairJSONDataFromFile to verify the repairJSONData function with both valid and invalid file paths - [+] test(main_test.go): add TestWriteContentToFile to verify that writeContentToFile function writes the expected content to a file * Refactor [Golang] File System - [+] refactor(file_system.go): rename package from "main" to "filesystem" and move file to "filesystem" directory - [+] refactor(file_system_mock.go): rename package from "main" to "filesystem" and move file to "filesystem" directory Note: This is a better approach because not everything is contained within the "main" package. * Docs [Golang] [Package] File System - [+] feat(filesystem): add package-level documentation for the filesystem package - [+] fix(filesystem): fix comments and formatting in file_system.go - [+] feat(filesystem): add RealFileSystem implementation of the FileSystem interface - [+] fix(filesystem): fix comments and formatting in file_system_mock.go - [+] feat(filesystem): add MockFileSystem implementation of the FileSystem interface * Feat CI Gopher Unit Testing 🧪 - [+] chore(GopherCI.yml): add GopherCI workflow for unit testing - [+] feat(GopherCI.yml): add workflow to run Gopher unit tests on push and pull request events * Docs [README] Gopher Unit Testing 🧪 - [+] docs(README.md): add Gopher Unit Testing badge to README * Chore CI Gopher Unit Testing 🧪 - [+] chore(GopherCI.yml): update Gopher Unit Testing job configuration - Change job name to "Run Gopher Unit Testing on ${{ matrix.os }}" - Update "runs-on" to use ${{ matrix.os }} variable - Add "strategy" section to define matrix for "os" and "go-version" - Update "go-version" to use ${{ matrix.go-version }} variable - Use "actions/setup-go@v3" to set up Go with the specified version - Use "actions/checkout@v3" to check out code into the Go module directory * Chore CI Gopher Unit Testing 🧪 - [+] chore(GopherCI.yml): temporarily remove `windows-latest` from the matrix due to issues with Windows * Feat [Golang] [Package] File System Mock - [+] feat(filesystem): add mock implementation of the FileSystem interface for testing purposes - [+] feat(filesystem): add mock implementation of the exporter.Exporter interface for testing purposes - [+] fix(filesystem): update package comment to include purpose of the mock implementation - [+] fix(filesystem): update MockFileSystem to use map instead of slice to track created files - [+] fix(filesystem): update Create method to create a new buffer in the FilesCreated map - [+] fix(filesystem): update Stat method to return mock file information if file exists in the mock file system - [+] fix(filesystem): update ReadFile method to read content of a file from the FilesCreated map - [+] fix(filesystem): update WriteFile method to write data to a file in the FilesCreated map - [+] feat(filesystem): add dummy implementation of mockFileInfo for testing purposes * Test [Golang] [Module] Main Command Testing purposes - [+] test(main_test.go): add unit test for writeContentToFile function * Chore & Feat [Golang] [Package] File System - [+] chore(file_system.go): update FileSystem interface to include WriteFile method - [+] feat(file_system.go): add WriteFile method to RealFileSystem implementation * Feat [Golang] [Module] Main Command FileSystem - [+] fix(main.go): fix writeContentToFile function to use provided FileSystem interface and handle errors properly - [+] feat(main.go): add support for filesystem package and use RealFileSystem implementation in writeContentToFile function * Chore CI Gopher Unit Testing 🧪 - [+] chore(GopherCI.yml): add workflow_dispatch event to trigger manual workflow runs with branch input * Docs [Golang] [Package] File System Mock - [+] chore(file_system_mock.go): add comments to MockExporter and ConvertSessionsToCSV functions * CI Gopher Unit Testing 🧪 - [+] ci(GopherCI.yml): add build job to build the application on different operating systems * CI Gopher Unit Testing 🧪 - [+] chore(GopherCI.yml): update GopherCI workflow configuration - Update author information - Add CI/CD note - Add todo for integrating AI for summarization tasks - Rename "Build" step to "Test Build"
- Loading branch information