Rewrite from Python to Go for single-binary cross-platform builds

Replaces imapdown.py with a multi-file Go implementation using
github.com/emersion/go-imap/v2. All features preserved: SSL/STARTTLS,
incremental UID-based downloads, attachment extraction to zip,
modified UTF-7 folder name decoding, and full-mode safety checks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 17:54:41 +00:00
parent 85db1ddba6
commit eb63d8cbc1
11 changed files with 1230 additions and 485 deletions
+32
View File
@@ -0,0 +1,32 @@
.PHONY: build build-all clean test install
# Binary name
BINARY=imapdown
# Build flags for smaller binaries
LDFLAGS=-ldflags="-s -w"
# Build for current platform
build:
go build $(LDFLAGS) -o $(BINARY)
# Cross-compile for multiple platforms
build-all:
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o $(BINARY)-linux-amd64
GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o $(BINARY)-linux-arm64
GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o $(BINARY)-darwin-amd64
GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o $(BINARY)-darwin-arm64
GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o $(BINARY)-windows-amd64.exe
# Clean build artifacts
clean:
rm -f $(BINARY)
rm -f $(BINARY)-*
# Run tests
test:
go test -v ./...
# Install to $GOPATH/bin
install:
go install $(LDFLAGS)