From 5ee13f1e6d3018c17687ddc43b3e90c729c56759 Mon Sep 17 00:00:00 2001 From: Hinne Stolzenberg Date: Tue, 17 Feb 2026 12:53:03 +0100 Subject: [PATCH 1/2] Prepare repository for public open-sourcing Scrub internal IPs, company-specific index names, and NegSoft references from source code and README. Add standard open-source files (LICENSE, CONTRIBUTING, CODE_OF_CONDUCT, SECURITY), CI workflows, and dependabot config. Update installation instructions for public access. --- .github/dependabot.yml | 13 ++- .github/workflows/go.yml | 151 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 136 ++++++++++++++++++++++++++++++ .gitignore | 33 +++++++- CODE_OF_CONDUCT.md | 7 ++ CONTRIBUTING.md | 39 +++++++++ LICENSE | 21 +++++ Makefile | 21 +++-- README.md | 45 +++++----- SECURITY.md | 11 +++ internal/cmd/config/config.go | 8 +- internal/cmd/root.go | 21 ++--- internal/cmd/search/search.go | 12 +-- 13 files changed, 467 insertions(+), 51 deletions(-) create mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/release.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 SECURITY.md diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ea63ed5..e1948a9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,16 @@ version: 2 updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + time: "04:00" + labels: + - dependencies + - github-actions + commit-message: + prefix: chore + include: scope - package-ecosystem: gomod directory: / schedule: @@ -7,7 +18,7 @@ updates: time: "04:00" labels: - dependencies - - go + - golang commit-message: prefix: chore include: scope diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..7f8244d --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,151 @@ +name: Go + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +permissions: + contents: read + pull-requests: write + +# Cancel old runs when new commit pushed to PR +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + # Skip job if PR is draft or has WIP in title + if: github.event_name != 'pull_request' || (!github.event.pull_request.draft && !contains(github.event.pull_request.title, 'WIP')) + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: ./go.mod + cache: true + + - name: Set up golangci-lint cache + uses: actions/cache@v5 + with: + path: ~/.cache/golangci-lint + key: golangci-${{ hashFiles('.golangci.yml') }}-${{ hashFiles('go.sum') }} + restore-keys: | + golangci-${{ hashFiles('.golangci.yml') }}- + golangci- + + - name: golangci-lint + uses: golangci/golangci-lint-action@v9 + with: + version: latest + only-new-issues: ${{ github.event_name == 'pull_request' }} + skip-cache: true # Use our custom cache + problem-matchers: true + + test: + name: Test + runs-on: ubuntu-latest + # Skip job if PR is draft or has WIP in title + if: github.event_name != 'pull_request' || (!github.event.pull_request.draft && !contains(github.event.pull_request.title, 'WIP')) + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: ./go.mod + cache: true + + - name: Download dependencies + run: go mod download + + - name: Run tests + run: go test -v -race -coverprofile=coverage.out ./... + + - name: Upload coverage artifact + uses: actions/upload-artifact@v6 + with: + name: coverage + path: coverage.out + + coverage: + name: Coverage Report + runs-on: ubuntu-latest + needs: test + if: github.event_name == 'pull_request' && !github.event.pull_request.draft + permissions: + contents: read + actions: read + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Download coverage artifact + uses: actions/download-artifact@v7 + with: + name: coverage + + - name: Post coverage report + uses: fgrosse/go-coverage-report@v1.2.0 + with: + coverage-artifact-name: "coverage" + coverage-file-name: "coverage.out" + + build: + name: Build + runs-on: ubuntu-latest + needs: [lint, test] + strategy: + matrix: + include: + - goos: linux + goarch: amd64 + - goos: linux + goarch: arm64 + - goos: darwin + goarch: amd64 + - goos: darwin + goarch: arm64 + - goos: windows + goarch: amd64 + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: ./go.mod + cache: true + + - name: Build + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + run: | + VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev") + COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "none") + DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + LDFLAGS="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" + + BINARY_NAME="esq" + if [ "${{ matrix.goos }}" = "windows" ]; then + BINARY_NAME="esq.exe" + fi + + go build -ldflags "${LDFLAGS}" -o "build/${BINARY_NAME}" ./cmd/esq + + - name: Upload build artifact + uses: actions/upload-artifact@v6 + with: + name: esq-${{ matrix.goos }}-${{ matrix.goarch }} + path: build/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fb7e330 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,136 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: ./go.mod + cache: true + + - name: Run tests + run: go test -v -race ./... + + - name: Build binaries + run: | + VERSION=${GITHUB_REF_NAME} + COMMIT=$(git rev-parse --short HEAD) + DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + LDFLAGS="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" + + mkdir -p dist + + # Build for each platform + platforms=( + "linux/amd64" + "linux/arm64" + "darwin/amd64" + "darwin/arm64" + "windows/amd64" + ) + + for platform in "${platforms[@]}"; do + GOOS=${platform%/*} + GOARCH=${platform#*/} + + output_name="esq-${GOOS}-${GOARCH}" + if [ "$GOOS" = "windows" ]; then + output_name+=".exe" + fi + + echo "Building $output_name..." + GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "${LDFLAGS}" -o "dist/${output_name}" ./cmd/esq + done + + # Create archives + cd dist + for file in esq-*; do + if [[ "$file" == *.exe ]]; then + zip "${file%.exe}.zip" "$file" + rm "$file" + else + tar czf "${file}.tar.gz" "$file" + rm "$file" + fi + done + + # Generate checksums + sha256sum * > checksums.txt + + - name: Generate changelog + id: changelog + run: | + # Get previous tag + PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") + + if [ -n "$PREV_TAG" ]; then + echo "Generating changelog from $PREV_TAG to $GITHUB_REF_NAME" + CHANGELOG=$(git log --pretty=format:"- %s (%h)" "$PREV_TAG".."$GITHUB_REF_NAME" --no-merges) + else + echo "No previous tag found, including all commits" + CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges) + fi + + # Escape for GitHub Actions + echo "changelog<> $GITHUB_OUTPUT + echo "$CHANGELOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + name: ${{ github.ref_name }} + body: | + ## What's Changed + + ${{ steps.changelog.outputs.changelog }} + + ## Installation + + ### macOS (Apple Silicon) + ```bash + curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/esq-darwin-arm64.tar.gz | tar xz + chmod +x esq-darwin-arm64 + sudo mv esq-darwin-arm64 /usr/local/bin/esq + ``` + + ### macOS (Intel) + ```bash + curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/esq-darwin-amd64.tar.gz | tar xz + chmod +x esq-darwin-amd64 + sudo mv esq-darwin-amd64 /usr/local/bin/esq + ``` + + ### Linux (x64) + ```bash + curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/esq-linux-amd64.tar.gz | tar xz + chmod +x esq-linux-amd64 + sudo mv esq-linux-amd64 /usr/local/bin/esq + ``` + + ### Windows + Download `esq-windows-amd64.zip` and add to your PATH. + + ## Checksums + + See `checksums.txt` for SHA256 checksums of all binaries. + files: | + dist/* + draft: false + prerelease: ${{ contains(github.ref_name, '-') }} diff --git a/.gitignore b/.gitignore index aa18f16..e0968d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,34 @@ +# Build artifacts +/build/ +/dist/ bin/ -dist/ + +# Test coverage +coverage.out +coverage.html + +# IDE +.idea/ +.vscode/ +*.swp +*.swo +*~ + +# OS files +.DS_Store +Thumbs.db + +# Binary +/esq +/esq.exe *.exe + +# Config (local development) +.env + +# Go +/vendor/ + +# Air (hot reload) +/tmp/ +.claude/ diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..dbbe0b9 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,7 @@ +# Code of Conduct + +This project follows the [Contributor Covenant v2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). + +In short: be respectful, constructive, and inclusive. Harassment or exclusionary behavior will not be tolerated. + +For concerns, contact the maintainers via [GitHub issues](https://github.com/enthus-appdev/esq-cli/issues). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1c0671b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing to esq-cli + +Thanks for your interest in contributing! Here's how to get started. + +## Development Setup + +```bash +git clone https://github.com/enthus-appdev/esq-cli.git +cd esq-cli +make build # Build the binary +make test # Run tests +make lint # Run goimports + golangci-lint +``` + +Requires Go 1.24+ and [golangci-lint](https://golangci-lint.run/). + +## Making Changes + +1. Fork the repository and create a feature branch from `main` +2. Write your code and add tests where appropriate +3. Run `make lint && make test` to ensure all checks pass +4. Commit with a clear message describing the change +5. Open a pull request against `main` + +## Code Style + +- Run `goimports -w .` before committing +- Follow standard Go conventions + +## Reporting Bugs + +Open a [GitHub issue](https://github.com/enthus-appdev/esq-cli/issues) with: +- Steps to reproduce +- Expected vs actual behavior +- CLI version (`esq --version`) and OS + +## License + +By contributing, you agree that your contributions will be licensed under the MIT License. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3a33e8f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 enthus GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile index 6d34e47..9d65a16 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,26 @@ BINARY_NAME := esq VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev") COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "none") -LDFLAGS := -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT)" +LDFLAGS := -ldflags "-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT)" -.PHONY: build install clean lint test +.PHONY: all build install clean lint test help -build: +all: build ## Build the application (default) + +build: ## Build to bin/esq go build $(LDFLAGS) -o bin/$(BINARY_NAME) ./cmd/esq -install: build +install: build ## Build + copy to ~/bin/ cp bin/$(BINARY_NAME) $(HOME)/bin/$(BINARY_NAME) -clean: - rm -rf bin/ +clean: ## Remove build artifacts + rm -rf bin/ dist/ coverage.out coverage.html -lint: +lint: ## Run goimports + golangci-lint goimports -w . && golangci-lint run -test: +test: ## Run tests go test -v ./... + +help: ## Show this help + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' diff --git a/README.md b/README.md index 4707766..c429258 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ Query and inspect Elasticsearch clusters across environments from the command li Requires Go 1.24+. ```bash -# Via go install (requires SSH access to the repo) -GOPRIVATE=github.com/enthus-appdev/* go install github.com/enthus-appdev/esq-cli/cmd/esq@latest +# Via go install +go install github.com/enthus-appdev/esq-cli/cmd/esq@latest # Or clone and build -git clone git@github.com:enthus-appdev/esq-cli.git +git clone https://github.com/enthus-appdev/esq-cli.git cd esq-cli make install # builds and copies to ~/bin/ ``` @@ -23,9 +23,9 @@ Ensure `~/go/bin` or `~/bin` is in your `PATH`. Add your Elasticsearch environments: ```bash -esq config add prod --url http://10.11.20.41:9200 -esq config add stage --url http://10.11.20.44:9200 -esq config add local --url http://localhost:29200 +esq config add prod --url http://es-prod:9200 +esq config add stage --url http://es-stage:9200 +esq config add local --url http://localhost:9200 esq config use prod ``` @@ -37,23 +37,23 @@ Config is stored at `~/.config/esq/config.json`. ```bash # Lucene query string syntax -esq search documents "DocumentNo:12345" -esq search customer "CustomerName:Müller" --size 50 -esq search documents "DocumentStateId:2 AND CustomerName:enthus" +esq search my-index "title:hello" +esq search users "name:John" --size 50 +esq search logs "level:error AND service:api" # Filter returned fields -esq search documents "DocumentNo:12345" --source DocumentNo,DocumentStateId +esq search my-index "title:hello" --source title,status # Full Query DSL -esq query documents '{"query":{"term":{"DocumentNo":12345}},"_source":["DocumentNo","DocumentStateId"]}' +esq query my-index '{"query":{"term":{"title":"hello"}},"_source":["title","status"]}' ``` ### Getting & Counting ```bash -esq get documents offer-122116 # Get by _id -esq count customer # Count all docs -esq count documents "Status:active" # Count matching +esq get documents doc-42 # Get by _id +esq count users # Count all docs +esq count logs "level:error" # Count matching ``` ### Cluster Info @@ -61,7 +61,7 @@ esq count documents "Status:active" # Count matching ```bash esq health # Cluster health + node stats esq indices # List all indices -esq indices sales # Filter by name +esq indices logs # Filter by name esq mapping documents # Show field mapping ``` @@ -78,10 +78,9 @@ You don't need to type full versioned index names. Partial names auto-resolve to | You type | Resolves to | |----------|-------------| -| `documents` | `erp.sales.documents_v30.1.0` | -| `customer` | `crm.customer_v15.0.0` | -| `items` | `erp.items_v15.0.0` | -| `servicetickets` | `jira.servicetickets_v4.0.0` | +| `logs` | `logs_v3.0.0` | +| `users` | `users_v2.1.0` | +| `metrics` | `metrics_v1.5.0` | If multiple indices match, the latest version is used and alternatives are shown. @@ -90,8 +89,8 @@ If multiple indices match, the latest version is used and alternatives are shown Info messages go to stderr, data to stdout — safe for piping: ```bash -esq search documents "DocumentNo:12345" | jq '.hits.hits[]._source' -esq count customer 2>/dev/null | jq .count +esq search my-index "title:hello" | jq '.hits.hits[]._source' +esq count users 2>/dev/null | jq .count ``` ## Shell Completion @@ -115,3 +114,7 @@ make install # Build + copy to ~/bin/ make lint # goimports + golangci-lint make test # Run tests ``` + +## License + +MIT — see [LICENSE](LICENSE) for details. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..22b22ba --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,11 @@ +# Security Policy + +## Reporting Vulnerabilities + +If you discover a security vulnerability, please report it responsibly via [GitHub Security Advisories](https://github.com/enthus-appdev/esq-cli/security/advisories/new) rather than opening a public issue. + +We will acknowledge receipt within 48 hours and aim to provide a fix or mitigation plan within 7 days. + +## Scope + +This policy covers the esq-cli codebase. Issues with Elasticsearch itself should be reported to [Elastic](https://www.elastic.co/community/security). diff --git a/internal/cmd/config/config.go b/internal/cmd/config/config.go index ead9327..20594ec 100644 --- a/internal/cmd/config/config.go +++ b/internal/cmd/config/config.go @@ -14,7 +14,7 @@ func NewConfigCmd() *cobra.Command { cmd := &cobra.Command{ Use: "config", Short: "Manage Elasticsearch environments", - Example: ` esq config add prod --url http://10.11.20.41:9200 + Example: ` esq config add prod --url http://es-prod:9200 esq config use prod esq config list`, } @@ -35,9 +35,9 @@ func newAddCmd() *cobra.Command { cmd := &cobra.Command{ Use: "add ", Short: "Add an Elasticsearch environment", - Example: ` esq config add prod --url http://10.11.20.41:9200 - esq config add stage --url http://10.11.20.44:9200 - esq config add local --url http://localhost:29200`, + Example: ` esq config add prod --url http://es-prod:9200 + esq config add stage --url http://es-stage:9200 + esq config add local --url http://localhost:9200`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { name := args[0] diff --git a/internal/cmd/root.go b/internal/cmd/root.go index a1102b5..4714b01 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -24,15 +24,16 @@ func Execute(ver, commit string) int { rootCmd := &cobra.Command{ Use: "esq", - Short: "Elasticsearch Query CLI for NegSoft", + Short: "Elasticsearch Query CLI", Long: "Query and inspect Elasticsearch clusters across environments (prod, stage, local).", Example: ` # Set up environments - esq config add prod --url http://10.11.20.41:9200 - esq config add stage --url http://10.11.20.44:9200 + esq config add prod --url http://es-prod:9200 + esq config add stage --url http://es-stage:9200 + esq config add local --url http://localhost:9200 esq config use prod # Search for a document - esq search documents "DocumentNo:12813636" + esq search my-index "title:hello" # Check cluster health esq health`, @@ -139,7 +140,7 @@ func newGetCmd() *cobra.Command { Use: "get ", Short: "Get a document by its _id", Example: ` esq get documents abc123 - esq get erp.sales.documents_v30.1.0 offer-122116`, + esq get my-index_v2.0.0 doc-42`, Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { client, envName, err := getClient() @@ -166,8 +167,8 @@ func newCountCmd() *cobra.Command { cmd := &cobra.Command{ Use: "count [query]", Short: "Count documents in an index", - Example: ` esq count customer - esq count documents "DocumentStateId:2"`, + Example: ` esq count users + esq count documents "status:active"`, Args: cobra.RangeArgs(1, 2), RunE: func(cmd *cobra.Command, args []string) error { client, envName, err := getClient() @@ -205,8 +206,8 @@ func newQueryCmd() *cobra.Command { Use: "query ", Short: "Search with Elasticsearch Query DSL", Long: "Execute a full Query DSL search. Pass the JSON body as a string argument.", - Example: ` esq query documents '{"query":{"term":{"DocumentNo":12813636}}}' - esq query documents '{"query":{"match_all":{}},"size":1,"_source":["DocumentNo","DocumentStateId"]}'`, + Example: ` esq query my-index '{"query":{"term":{"title":"hello"}}}' + esq query my-index '{"query":{"match_all":{}},"size":1,"_source":["title","status"]}'`, Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { client, envName, err := getClient() @@ -270,7 +271,7 @@ func newMappingCmd() *cobra.Command { Use: "mapping ", Short: "Show index field mapping", Example: ` esq mapping documents - esq mapping erp.sales.documents_v30.1.0`, + esq mapping my-index_v2.0.0`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { client, envName, err := getClient() diff --git a/internal/cmd/search/search.go b/internal/cmd/search/search.go index 286eeaf..7d94711 100644 --- a/internal/cmd/search/search.go +++ b/internal/cmd/search/search.go @@ -23,11 +23,11 @@ func NewSearchCmd() *cobra.Command { Short: "Search with a Lucene query string", Long: `Search an Elasticsearch index using Lucene query syntax. -Index names support partial matching - "documents" resolves to the latest -version of erp.sales.documents. Use full names for exact matches.`, - Example: ` esq search documents "DocumentNo:12813636" - esq search customer "Name:Müller" --size 50 - esq search documents "DocumentStateId:2 AND CustomerName:enthus"`, +Index names support partial matching - a partial name resolves to the latest +matching versioned index. Use full names for exact matches.`, + Example: ` esq search my-index "title:hello" + esq search users "name:John" --size 50 + esq search logs "level:error AND service:api"`, Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { client, envName, err := getClient(cmd) @@ -56,7 +56,7 @@ version of erp.sales.documents. Use full names for exact matches.`, } cmd.Flags().IntVarP(&size, "size", "s", 10, "Maximum number of results") - cmd.Flags().StringSliceVar(&source, "source", nil, "Limit returned fields (e.g. --source DocumentNo,DocumentStateId)") + cmd.Flags().StringSliceVar(&source, "source", nil, "Limit returned fields (e.g. --source title,status)") return cmd } From 5598c184068a7b6103c83c7051ca24e056824dd9 Mon Sep 17 00:00:00 2001 From: Hinne Stolzenberg Date: Tue, 17 Feb 2026 13:02:46 +0100 Subject: [PATCH 2/2] Simplify CI: drop coverage report and multi-platform build matrix Coverage report fails with no baseline on main and no tests exist yet. Multi-platform builds are redundant with the release workflow. Keep lint, test, and a single build verification. --- .github/workflows/go.yml | 68 ++-------------------------------------- 1 file changed, 2 insertions(+), 66 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7f8244d..4a7a888 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -9,7 +9,6 @@ on: permissions: contents: read - pull-requests: write # Cancel old runs when new commit pushed to PR concurrency: @@ -68,55 +67,12 @@ jobs: run: go mod download - name: Run tests - run: go test -v -race -coverprofile=coverage.out ./... - - - name: Upload coverage artifact - uses: actions/upload-artifact@v6 - with: - name: coverage - path: coverage.out - - coverage: - name: Coverage Report - runs-on: ubuntu-latest - needs: test - if: github.event_name == 'pull_request' && !github.event.pull_request.draft - permissions: - contents: read - actions: read - pull-requests: write - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Download coverage artifact - uses: actions/download-artifact@v7 - with: - name: coverage - - - name: Post coverage report - uses: fgrosse/go-coverage-report@v1.2.0 - with: - coverage-artifact-name: "coverage" - coverage-file-name: "coverage.out" + run: go test -v -race ./... build: name: Build runs-on: ubuntu-latest needs: [lint, test] - strategy: - matrix: - include: - - goos: linux - goarch: amd64 - - goos: linux - goarch: arm64 - - goos: darwin - goarch: amd64 - - goos: darwin - goarch: arm64 - - goos: windows - goarch: amd64 steps: - name: Checkout repository uses: actions/checkout@v6 @@ -128,24 +84,4 @@ jobs: cache: true - name: Build - env: - GOOS: ${{ matrix.goos }} - GOARCH: ${{ matrix.goarch }} - run: | - VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev") - COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "none") - DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - LDFLAGS="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" - - BINARY_NAME="esq" - if [ "${{ matrix.goos }}" = "windows" ]; then - BINARY_NAME="esq.exe" - fi - - go build -ldflags "${LDFLAGS}" -o "build/${BINARY_NAME}" ./cmd/esq - - - name: Upload build artifact - uses: actions/upload-artifact@v6 - with: - name: esq-${{ matrix.goos }}-${{ matrix.goarch }} - path: build/ + run: go build -ldflags "-s -w" -o build/esq ./cmd/esq