godiff

command module
v0.0.0-...-1a4453b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: GPL-2.0 Imports: 20 Imported by: 0

README

godiff

A File/Directory diff-like comparison tool with HTML output.

This program can be use to compare files and directories for differences. When comparing directories, it iterates through all files in both directories and compare files having the same name.

See example output here:

How to use godiff

godiff file1 file2 > results.html

godiff directory1 directory > results.html

See godiff -h for all the available command line options

Features

  • When comparing two directory, place all the differences into a single html file.
  • Supports UTF8 file.
  • Show differences within a line
  • Options for ignore case, white spaces compare, blank lines etc.

Description

I need a program to to compare 2 directories, and report differences in all files. Much like gnudiff, but with a nicer output. And I also like to try out the go programming language, so I created godiff.

The diff algorithm implemented here is based on "An O(ND) Difference Algorithm and its Variations" by Eugene Myers Algorithmica Vol. 1 No. 2, 1986, p 251.

godiff always tries to produce the minimal differences, just like gnudiff with the "-d" option.

Go Language

This program is created in the go programming language. For more information about go, see golang.org

How to Build

On Linux or Darwin OS

go build -o godiff godiff.go godiff_unix.go

On Windows

go build -o godiff.exe  godiff.go godiff_windows.go

Documentation

Overview

File/Directory diff tool with HTML output
Copyright (C) 2012   Siu Pin Chao

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Description:

This program can be use to compare files and directories for differences.
When comparing directories, it iterates through all files in both directories
and compare files having the same name.

It uses the algorithm from "An O(ND) Difference Algorithm and its Variations"
by Eugene Myers Algorithmic Vol. 1 No. 2, 1986, p 251.

Main Features:

  • Supports UTF8 file.
  • Show differences within a line
  • Options for ignore case, white spaces compare, blank lines etc.

Main aim of the application is to try out the features in the go programming language. (golang.org)

  • Slices: Used extensively, and re-slicing too whenever it make sense.

  • File I/O: Use Mmap for reading text files

  • Function Closure: Use in callbacks functions to handle both file and line compare

  • Goroutines: for running multiple file compares concurrently, using channels and mutex too.

    History ------- 2012/09/20 Created

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL