A simple yet powerful text completion, editing, and auto-correction tool built in Go — designed to transform and reformat text files using a set of intuitive inline commands.
- About the Project
- Features
- Tech Stack
- Getting Started
- Usage
- Transformation Rules
- Allowed Packages
- Learning Outcomes
- Authors
go-reloaded is a CLI-based text processing tool that reads an input file, applies a series of text transformations based on inline commands, and writes the corrected output to a new file.
It acts like a lightweight auto-correction engine — handling case conversion, number base conversion, punctuation formatting, quotation cleanup, and grammar correction, all driven by special markers embedded directly in the text.
Why it was built:
- To practice string and number manipulation in Go
- To work with Go's file system (
fs) API - To build a practical, real-world text transformation pipeline
- To reinforce algorithmic thinking through parsing and processing logic
- Hex & Binary Conversion — inline
(hex)and(bin)markers convert numbers to decimal automatically. - Case Transformation —
(up),(low),(cap)modify the case of preceding words. - Bulk Case Transformation —
(up, N),(low, N),(cap, N)apply transformations to N preceding words. - Punctuation Formatting — automatically fixes spacing around
. , ! ? : ;including grouped punctuation like... - Quotation Mark Cleanup — single quotes are placed correctly around enclosed words with no extra spaces.
- Article Correction — automatically changes
atoanbefore words starting with a vowel orh. - File-Based I/O — reads from an input file and writes the transformed result to an output file.
- No External Dependencies — built strictly with Go's standard library.
| Technology | Role | Details |
|---|---|---|
| Go | Core Language | File I/O, string processing, number parsing |
| Algorithms | Logic | Parsing, transformation pipelines, edge cases |
Make sure you have installed:
- Go 1.21+ — https://golang.org/dl/
Verify Go installation:
go version1. Clone the repository:
git clone https://acad.learn2earn.ng/git/lajose/go-reloaded.git2. Navigate into the project:
cd go-reloadedRun the program with an input and output file:
go run . <input_file> <output_file>Example:
go run . sample.txt result.txt1. Create or edit your input file:
cat sample.txtit (cap) was the best of times, it was the worst of times (up) , it was the age of wisdom,
it was the age of foolishness (cap, 6) , IT WAS THE (low, 3) winter of despair.
2. Run the tool:
go run . sample.txt result.txt3. View the output:
cat result.txtIt was the best of times, it was the worst of TIMES, it was the age of wisdom,
It Was The Age Of Foolishness, it was the winter of despair.
| Marker | Action | Example |
|---|---|---|
(hex) |
Converts preceding hex number to decimal | "1E (hex) files" → "30 files" |
(bin) |
Converts preceding binary number to decimal | "10 (bin) years" → "2 years" |
| Marker | Action | Example |
|---|---|---|
(up) |
Uppercases the preceding word | "go (up)" → "GO" |
(low) |
Lowercases the preceding word | "SHOUTING (low)" → "shouting" |
(cap) |
Capitalizes the preceding word | "bridge (cap)" → "Bridge" |
(up, N) |
Uppercases the preceding N words | "so exciting (up, 2)" → "SO EXCITING" |
(low, N) |
Lowercases the preceding N words | "IT WAS THE (low, 3)" → "it was the" |
(cap, N) |
Capitalizes the preceding N words | "age of foolishness (cap, 6)" → "Age Of Foolishness" |
"I was sitting over there ,and then BAMM !!" → "I was sitting over there, and then BAMM!!"
"I was thinking ... You were right" → "I was thinking... You were right"
"I am exactly how they describe me: ' awesome '"
→ "I am exactly how they describe me: 'awesome'"
"As Elton John said: ' I am the most well-known homosexual in the world '"
→ "As Elton John said: 'I am the most well-known homosexual in the world'"
"There it was. A amazing rock!" → "There it was. An amazing rock!"
"bearing a untold story inside you." → "bearing an untold story inside you."
Unit tests are included to validate each transformation individually.
go test ./...Only Go standard library is used:
os
fmt
strings
strconv
regexp
log
No third-party dependencies.
This project helps you understand:
- Go File System API
- Reading and writing files with
os
- Reading and writing files with
- String Manipulation in Go
- Parsing, splitting, replacing, and reformatting text
- Number Base Conversion
- Hexadecimal and binary to decimal using
strconv
- Hexadecimal and binary to decimal using
- Algorithmic Thinking
- Building a multi-step text transformation pipeline
- Unit Testing in Go
- Writing and running tests with the
testingpackage
- Writing and running tests with the
Ajose Lawal 📎 https://acad.learn2earn.ng/git/lajose