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:
@@ -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)
|
||||
Reference in New Issue
Block a user