Skip to content

robotmaxtron/minimockbob

Repository files navigation

minimockbob

Go Reference Go Report Card License

minimockbob is a sarcastic text generator written in Go that transforms strings into alternating capitalization (e.g., "hello world" -> "hElLo WoRlD").

It can be imported as a Go package, compiled to a binary, or run as a container.

Features

  • Alternating Capitalization: The classic "mocking" text format.
  • Multiple Interfaces: Use it as a CLI tool, a Go library, or a containerized service.
  • Modern Tooling: Optimized for ko (containers) and melange (Wolfi APK packages).
  • Minimal Footprint: Distroless-based container images (~10MB) and stripped binaries.
  • Flexible Input: Supports CLI arguments, quoted strings, and piped input.
  • Go 1.26+: Built using modern Go idioms and toolchain.

Table of Contents

Quick Start

go run github.com/robotmaxtron/minimockbob/cmd/minimockbob@latest "mocking intensifies"
# mOcKiNg InTeNsIfIeS

Installation

Install as a Binary

Install with Go:

go install github.com/robotmaxtron/minimockbob/cmd/minimockbob@latest

Or build from source:

git clone https://github.com/robotmaxtron/minimockbob.git
cd minimockbob/cmd/minimockbob
go build

Build as a Container

Build with ko:

# Set the target repository (use ko.local for local builds)
KO_DOCKER_REPO=ko.local ko build ./cmd/minimockbob

# Or build with OCI image labels and tags
KO_DOCKER_REPO=ko.local ko build \
  --image-label org.opencontainers.image.source=https://github.com/robotmaxtron/minimockbob \
  --image-label org.opencontainers.image.description="A sarcastic text generator" \
  --image-label org.opencontainers.image.licenses=Apache-2.0 \
  --tags latest,v0.0.1 \
  ./cmd/minimockbob

Build as a Wolfi APK Package

Build with melange:

# Generate a signing key (first time only)
melange keygen

# Build the package
melange build .melange.yaml \
  --signing-key melange.rsa \
  --runner docker \
  --arch aarch64

To install in a Wolfi container:

# Run Wolfi container with your packages directory mounted
docker run -v $(pwd)/packages:/packages --rm -it cgr.dev/chainguard/wolfi-base sh

# Inside the container, install the package
apk add --allow-untrusted /packages/aarch64/minimockbob-0.0.1-r0.apk

# Test the binary
minimockbob "Hello Wolfi"

Usage

Command Line

The binary supports three usage modes:

  1. Quoted argument:

    minimockbob "Hello, World!"
    # Output: hElLo, WoRlD!
  2. Multiple unquoted arguments:

    minimockbob Hello World
    # Output: hElLo WoRlD
  3. Pipe input:

    echo "Hello, World!" | minimockbob
    # Output: hElLo, WoRlD!

Container Usage

Run the container built with ko:

# With arguments (use the image name from ko build output)
docker run --rm ko.local/minimockbob-<hash>:latest "Hello Container"

# With piped input
echo "Hello Container" | docker run --rm -i ko.local/minimockbob-<hash>:latest

As a Go Package

Import and use in your code:

package main

import (
    "fmt"
    "github.com/robotmaxtron/minimockbob"
)

func main() {
    result := minimockbob.Gen("Hello, World!")
    fmt.Println(result)  // Output: hElLo, WoRlD!
}

Testing

Go Test Suite

Run the full test suite:

go test ./...

Run CLI functional tests:

cd cmd/minimockbob && go test -v

Run tests with coverage:

go test -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -func=coverage.out

Run performance benchmarks:

go test -bench=. -benchmem

Wolfi Package Testing

Test the Wolfi APK package build and functionality:

# Run all melange tests (requires melange and Docker)
go test -v -run TestMelange

# Skip melange tests (faster local development)
go test -short ./...

Note: If using Docker alternatives like colima, rancher-desktop, or podman, the melange build tests may fail due to Docker mount path issues. In this case, run melange directly as shown in the Installation section.

Configuration

The project includes configuration for building optimized container images and packages:

  • .ko.yaml: Configuration for ko container builds.
  • .melange.yaml: Configuration for melange APK builds.

Both configurations focus on minimal attack surface (distroless), CGO disabled, and reproducible builds.

Documentation

View the full package documentation:

# View package documentation locally
go doc -all github.com/robotmaxtron/minimockbob

# Or use godoc for a local server
# go install golang.org/x/tools/cmd/godoc@latest
godoc -http=:6060

Online documentation is available at pkg.go.dev.

Words

This package is a joke. Shoutout to mockbob. For my friend, James.

"Once men turned their thinking over to machines in the hope that this would set them free. But that only permitted other men with machines to enslave them."

Reverend Mother Gaius Helen Mohiam, Dune by Frank Herbert

License

This project is licensed under the Apache License 2.0 – see the LICENCE file for details.

About

Sarcastic Text Generator

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages