Skip to content

A command line tool for merging multiple Go source files into a single file for use in coding competitions like Codingame.com

License

Notifications You must be signed in to change notification settings

mrsombre/codingame-golang-merger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go File Merger

Go File Merger is a command line tool that allows you to merge multiple Go source files into a single file. This can be useful in coding competitions like codingame or other situations where you are limited to a single file for your code.

Installation

Linux / Mac / WSL

git clone https://github.com/mrsombre/codingame-golang-merger.git
cd codingame-golang-merger
go build -o bin/cgmerge ./cmd/cgmerge
sudo mv bin/cgmerge /usr/local/bin/cgmerge

Example

cd example/simple
cgmerge

Usage

To use Go File Merger, navigate to the directory containing the Go source files that you want to merge. Then, use the following command:

cgmerge [--output <output_filename>] [--dir <source_directory_name>]

Options

  -d, --dir string      Source directory to parse (default ".")
  -o, --output string   Output file name (default "_merged.go")
  -h, --help            Show usage summary

Notes

  • This tool could merge only files from one directory using main package namespace and did not merge files imported from other packages.
  • This tool does not check for syntax errors, so make sure that your code is syntactically correct before merging the files.
  • The tool does not check for conflicts between files, so you need to make sure that there are no conflicts manually.
  • The tool does not delete any of the original files, so you can keep them for reference.

Contribution

If you find a bug or have an idea for a new feature, don't hesitate to open an issue or a pull request.

About

A command line tool for merging multiple Go source files into a single file for use in coding competitions like Codingame.com

Topics

Resources

License

Stars

Watchers

Forks

Languages