micro--go-micro
aa7cd6dc3b
goreleaser / goreleaser (push) Has been cancelled
* examples: support desk agent + blog walkthrough A real-world, runnable example (examples/support): customers/tickets/notify services become the agent's tools, a flow turns a ticket.created event into the agent's work, and an approval gate guards the one action that touches a customer. Runs with no API key (mock model) or against a live provider. Adds blog/28 'Building a Support Agent in Go' and indexes both. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL * fix(new): protoless services by default; fix @latest install (#2985) micro new now scaffolds a reflection-based service by default — plain Go types registered via service.Handle, no .proto, no Makefile proto target. The generated project builds and runs with 'go run .' and zero external tooling. Protocol Buffers move behind --proto (the crud/pubsub/api templates imply it). When the proto workflow is used and protoc / protoc-gen-go / protoc-gen-micro are missing, print exact install instructions instead of failing with a cryptic plugin error. Also fixes the 'go install go-micro.dev/v6/cmd/micro@latest' version constraint conflict: the vanity go-import meta still advertised /v5, so Go fell back to the bare module and resolved an ancient v1.x tag. Advertise /v6 (keeping /v5 for existing users) and add a version-pin fallback note to the install docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL * fix(new,install): pin generated go.mod to current go-micro; lead install with prebuilt binary (#2985) - micro new now requires the exact go-micro version the CLI was built from (via build info), falling back to 'latest' for dev builds. An explicit require is also more robust than a bare import: 'go mod tidy' reliably resolves it, where a requireless go.mod could fail vanity discovery. - Make the precompiled binary (curl install.sh) the recommended install in the docs; demote 'go install' to a from-source option with the version-pin fallback note. - Sync the stale internal/scripts/install.sh to the working website script (it expected an old micro-OS-ARCH asset name; releases ship micro_OS_ARCH.tar.gz). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL * website: add corrected nginx vanity-import config (#2985) The live go-micro.dev handler echoed the full request path into the go-import prefix ($host$1), so go install go-micro.dev/v6/cmd/micro@latest got prefix go-micro.dev/v6/cmd/micro — a package, not the module root — and Go fell back to the ancient v1.x tags (version constraints conflict). Add a dedicated /vN location that emits the module root (go-micro.dev/vN) for any sub-path, and make the catch-all advertise the current module roots instead of echoing arbitrary paths. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL --------- Co-authored-by: Claude <noreply@anthropic.com>
103 行
2.5 KiB
Bash
可执行文件
103 行
2.5 KiB
Bash
可执行文件
#!/bin/bash
|
|
# Install script for micro CLI
|
|
# Usage: curl -fsSL https://go-micro.dev/install.sh | sh
|
|
|
|
set -e
|
|
|
|
VERSION="${MICRO_VERSION:-latest}"
|
|
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
ARCH=$(uname -m)
|
|
|
|
# Normalize architecture
|
|
case $ARCH in
|
|
x86_64|amd64) ARCH="amd64" ;;
|
|
aarch64|arm64) ARCH="arm64" ;;
|
|
armv7l) ARCH="armv7" ;;
|
|
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
|
|
esac
|
|
|
|
# Normalize OS
|
|
case $OS in
|
|
darwin) OS="darwin" ;;
|
|
linux) OS="linux" ;;
|
|
*) echo "Unsupported OS: $OS"; exit 1 ;;
|
|
esac
|
|
|
|
# Determine install directory
|
|
if [ "$EUID" -eq 0 ] || [ "$(id -u)" -eq 0 ]; then
|
|
INSTALL_DIR="/usr/local/bin"
|
|
else
|
|
INSTALL_DIR="$HOME/.local/bin"
|
|
mkdir -p "$INSTALL_DIR"
|
|
fi
|
|
|
|
echo "Installing micro ${VERSION} for ${OS}/${ARCH}..."
|
|
|
|
# Download URL
|
|
if [ "$VERSION" = "latest" ]; then
|
|
URL="https://github.com/micro/go-micro/releases/latest/download/micro_${OS}_${ARCH}.tar.gz"
|
|
else
|
|
URL="https://github.com/micro/go-micro/releases/download/${VERSION}/micro_${OS}_${ARCH}.tar.gz"
|
|
fi
|
|
|
|
# Create temp directory for extraction
|
|
TMP_DIR=$(mktemp -d)
|
|
TMP_FILE="${TMP_DIR}/micro.tar.gz"
|
|
|
|
# Download
|
|
if command -v curl &> /dev/null; then
|
|
curl -fsSL "$URL" -o "$TMP_FILE"
|
|
elif command -v wget &> /dev/null; then
|
|
wget -q "$URL" -O "$TMP_FILE"
|
|
else
|
|
echo "Error: curl or wget required"
|
|
rm -rf "$TMP_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
# Extract and install
|
|
tar -xzf "$TMP_FILE" -C "$TMP_DIR"
|
|
|
|
# Handle different archive structures (binary at root or in subdirectory)
|
|
if [ -f "${TMP_DIR}/micro" ]; then
|
|
BINARY_PATH="${TMP_DIR}/micro"
|
|
elif [ -f "${TMP_DIR}/micro_${OS}_${ARCH}/micro" ]; then
|
|
BINARY_PATH="${TMP_DIR}/micro_${OS}_${ARCH}/micro"
|
|
else
|
|
# Try to find any executable named 'micro' in the extracted content
|
|
BINARY_PATH=$(find "$TMP_DIR" -name "micro" -type f -executable | head -n1)
|
|
fi
|
|
|
|
if [ -z "$BINARY_PATH" ] || [ ! -f "$BINARY_PATH" ]; then
|
|
echo "Error: Could not find micro binary in archive"
|
|
echo "Archive contents:"
|
|
tar -tzf "$TMP_FILE"
|
|
rm -rf "$TMP_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
chmod +x "$BINARY_PATH"
|
|
mv "$BINARY_PATH" "$INSTALL_DIR/micro"
|
|
|
|
# Cleanup
|
|
rm -rf "$TMP_DIR"
|
|
|
|
echo ""
|
|
echo "✓ Installed micro to $INSTALL_DIR/micro"
|
|
echo ""
|
|
|
|
# Verify
|
|
if command -v micro &> /dev/null; then
|
|
micro --version
|
|
else
|
|
echo "Note: Add $INSTALL_DIR to your PATH:"
|
|
echo " export PATH=\"\$PATH:$INSTALL_DIR\""
|
|
fi
|
|
|
|
echo ""
|
|
echo "Get started:"
|
|
echo " micro new myservice # Create a new service"
|
|
echo " micro run # Run locally"
|
|
echo " micro deploy # Deploy to server"
|
|
echo ""
|