Skip to content

g-laliotis/go-reloaded

🚀 go-reloaded

Go Version Docker Build Status License: MIT Tests Made with ❤️ in Go Docs CLI Usage Security Code of Conduct Contributing GitHub Pages

📘 See AGENTS.md for detailed technical specification of all pipeline agents.
💻 Run make help for a list of available CLI commands.


🧩 TL;DR Overview

go-reloaded is a command-line text transformation tool written in Go using a pipeline architecture.

It reads an input text file, applies a sequence of smart transformations ("agents"), and writes the corrected text to an output file.

This project demonstrates clean modular Go design, testability, and readable rule-based text processing.

Professional Features:

Ideal for: developers who want a reference implementation of a modular Go CLI with full tests, CI, Docker, and security best practices.


🏗️ Architecture

Each transformation is an agent — an independent module implementing:

type Agent interface {
    Name() string
    Process(input string) string
}

The agents form a pipeline that processes text in order:

+-------------------+     +------------------+     +---------------------+     +----------------+
|   HexBinAgent     | --> |  CaseConvAgent   | --> |  PunctuationAgent   | --> |  ArticleAgent  |
| N (hex/bin) → dec |     | (up/low/cap[,N]) |     | spaces, ..., !?,' ' |     | a/A → an/An    |
+-------------------+     +------------------+     +---------------------+     +----------------+

This design keeps each rule isolated, testable, and auditable.


⚙️ Installation

Clone the repository

git clone https://github.com/g-laliotis/go-reloaded.git
cd go-reloaded

Install Go (v1.22 or higher)

go version
# should print go version go1.22+ ...

Download dependencies

go mod tidy

Check version and help

go run ./cmd/go-reloaded --version
# go-reloaded v1.1.0 (built with go1.22+ for darwin/amd64)

go run ./cmd/go-reloaded --help
# Shows comprehensive usage information and examples

🐳 Docker Usage

For Non-Technical Users

Step 1: Install Docker

Step 2: Create a test file

  • Create a text file called input.txt on your Desktop
  • Add some test text like: I have 1E (hex) apples and a orange (up)!

Step 3: Open Terminal/Command Prompt

  • Windows: Press Win + R, type cmd, press Enter
  • Mac: Press Cmd + Space, type terminal, press Enter

Step 4: Navigate to your Desktop

# Windows
cd Desktop

# Mac
cd Desktop

Step 5: Run the transformation

# Windows
docker run --rm -v "%cd%:/data" ghcr.io/g-laliotis/go-reloaded:latest /data/input.txt /data/output.txt

# Mac/Linux
docker run --rm -v "$(pwd):/data" ghcr.io/g-laliotis/go-reloaded:latest /data/input.txt /data/output.txt

Step 6: Check the result

  • Look for output.txt on your Desktop
  • Open it to see the transformed text

For Developers

Using pre-built image (recommended):

# Pull and run directly from GitHub Container Registry
docker run --rm -v "$(pwd):/data" ghcr.io/g-laliotis/go-reloaded:latest /data/input.txt /data/output.txt

# Example with sample file
docker run --rm -v "$(pwd):/data" ghcr.io/g-laliotis/go-reloaded:latest /data/testdata/samples/sample.txt /data/result.txt

Building locally (for development):

make docker-build
make docker-run INPUT=testdata/samples/sample.txt OUTPUT=result.txt

# Or manually
docker build -t go-reloaded .
docker run --rm -v "$(pwd):/data" go-reloaded /data/input.txt /data/output.txt

🚦 Usage

Basic command

go run ./cmd/go-reloaded <input_file> <output_file>

Get help

go run ./cmd/go-reloaded --help
# Shows detailed usage, examples, and agent descriptions

Example:

go run ./cmd/go-reloaded testdata/samples/sample.txt result.txt
cat result.txt

Example transformation:

Input (testdata/samples/punctuation.txt)

Punctuation tests are ... kinda boring ,what do you think ?
As Elton John said: ' I am the most well-known homosexual in the world '
I am exactly how they describe me: ' awesome '
BAMM !!  Are you serious !?  yes...right now

Output

Punctuation tests are... kinda boring, what do you think?
As Elton John said: 'I am the most well-known homosexual in the world'
I am exactly how they describe me: 'awesome'
BAMM!! Are you serious!? yes... right now

🧩 Agents Summary

Agent Purpose Example
🧮 HexBinAgent Converts numbers marked (hex) or (bin) to decimal 1E (hex)30
🔠 CaseConvAgent Changes case with (up), (low), (cap[,N]) this is so exciting (up,2)this is SO EXCITING
✍️ PunctuationAgent Fixes punctuation spacing & quotes ,what ?!, what?!
📰 ArticleAgent Changes a/Aan/An before vowels or 'h' a applean apple

Full agent descriptions and internal specs: AGENTS.md.


🧪 Testing

The project includes comprehensive unit, integration, benchmark, and edge case tests.

Run all tests:

make test
# or
go test ./...

Run comprehensive test cases:

make testcases
# or
go test -v -run TestCases

Force tests to re-run (ignore cache):

go test ./... -count=1

Show coverage:

go test ./... -cover

Test Types:

  • Unit tests: internal/transformations/agents_test.go
  • Integration tests: main_test.go, edge_cases_test.go
  • Comprehensive cases: testcases_test.go (24 comprehensive cases)
  • Performance tests: benchmark_test.go

🧰 Makefile Commands

Command Description
make help Show help menu with all commands
make run Run pipeline on sample data (testdata/samples/)
make build Build binary into bin/go-reloaded
make test Run all tests
make testcases Run comprehensive test cases (24 cases)
make bench Run benchmark tests with memory stats
make fmt Format code
make vet Run static analysis
make clean Remove build artifacts
make clear-cache Clear Go build and test cache
make docker-build Build Docker image locally
make docker-run Run with Docker (specify INPUT/OUTPUT)

Docker Registry:

  • GHCR: ghcr.io/g-laliotis/go-reloaded:latest (recommended)
  • Local build: Use make docker-build for development

Run the help menu any time:

make help

🧱 Project Structure

go-reloaded/
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.yml      # Bug report form
│   │   └── feature_request.yml # Feature request form
│   ├── workflows/
│   │   ├── docker.yml          # Docker build and publish to GHCR
│   │   ├── pages.yml           # GitHub Pages deployment
│   │   └── test.yml            # CI/CD testing workflow
│   └── PULL_REQUEST_TEMPLATE.md # Pull request template
├── cmd/
│   └── go-reloaded/
│       └── main.go         # CLI entrypoint with version support
├── docs/
│   ├── .nojekyll           # bypass Jekyll processing
│   ├── index.html          # GitHub Pages site
│   └── README.md           # docs folder readme
├── internal/
│   ├── transformations/
│   │   ├── agents_test.go  # unit tests
│   │   ├── article.go      # article correction agent
│   │   ├── caseconv.go     # case conversion agent
│   │   ├── hexbin.go       # hex/binary conversion agent
│   │   ├── pipeline.go     # pipeline orchestration
│   │   ├── punctuation.go  # punctuation fixing agent
│   │   └── utils.go        # shared utilities
│   └── version/
│       └── version.go      # version and build info
├── testdata/
│   ├── comprehensive/      # comprehensive test cases (24 cases)
│   │   ├── case*_input.txt     # test inputs
│   │   └── case*_expected_output.txt # expected outputs
│   └── samples/            # sample files for demos
│       ├── cases.txt       # basic test cases
│       ├── punctuation.txt # punctuation examples
│       └── sample.txt      # sample input
├── .dockerignore           # Docker build exclusions
├── .gitignore
├── AGENTS.md               # technical specification
├── benchmark_test.go       # performance tests
├── CHANGELOG.md            # version history
├── CODE_OF_CONDUCT.md      # community guidelines
├── CONTRIBUTING.md         # contribution guidelines
├── Dockerfile              # Docker containerization
├── edge_cases_test.go      # edge case tests
├── go.mod
├── LICENSE
├── main_test.go            # integration tests
├── Makefile                # build automation
├── PRESENTATION_GUIDE.md   # stakeholder briefing document
├── README.md               # project documentation
├── SECURITY.md             # security policy
└── testcases_test.go       # comprehensive test runner

🧑💻 Contributing

Pull requests and audits are welcome! See CONTRIBUTING.md for detailed guidelines.

Quick start:

  • Run make fmt and make vet before committing
  • Add or update tests for any changes
  • Keep agents single-purpose; don't mix rules in one agent
  • Update AGENTS.md if your change affects behavior

Version history: See CHANGELOG.md for release notes and changes.


🧾 License

Distributed under the MIT License.
See LICENSE for details.


❤️ Acknowledgments

This project is part of a Go learning exercise focused on:

  • File system I/O
  • Text manipulation and regex
  • Modular design and testing
  • Pipeline architecture

About

go-reloaded is a command-line text transformation tool written in Go using a pipeline architecture.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors