This project is a custom implementation of a file comparison tool built with Go. It was developed as part of a coding challenge here. The tool allows users to compare two files and highlight the differences, providing a clear and intuitive output to track changes.
- Compare two files line by line and display differences.
- Identify added, removed, and unchanged lines.
- Outputs differences in a format similar to traditional diff tools.
- Simple and lightweight implementation for efficient file comparisons.
These instructions will help you set up and run the project on your local machine for development and testing purposes.
- You need to have Go installed on your machine (Go 1.18 or later is recommended).
- You can download and install Go from https://golang.org/dl/.
Clone the repository to your local machine:
git clone https://github.com/nullsploit01/cc-diff.git
cd cc-diff
Compile the project using:
go build -o cc-diff
To run the diff tool, execute the compiled binary with two file paths as arguments.
./cc-diff file1.txt file2.txt
Example Input Files:
file1.txt:
Line 1
Line 2
Line 3
file2.txt:
Line 1
Line 3
Line 4
Command:
./cc-diff file1.txt file2.txt
Example Output:
< Line 2
> Line 4
To run the test suite and ensure the tool works as expected:
go test ./...