From ee11c3ce401ae13f5031a00992b2ccb06bbf02a4 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Sun, 2 Aug 2026 16:25:51 +1000 Subject: [PATCH 01/11] chore: markdown consistency changes --- CHANGES.md | 2 +- EXAMPLES.md | 2 +- TODO.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 70f9c1b..feb1274 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -# **libCLImate.Go** Changes +# libCLImate.Go - CHANGES ## 0.8.2-beta-1 - 18th August 2025 diff --git a/EXAMPLES.md b/EXAMPLES.md index 77efece..4db8c24 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -1,4 +1,4 @@ -# libCLImate.Go Examples +# libCLImate.Go - Examples |Name|Source & Description|Summary| |---|---|---| diff --git a/TODO.md b/TODO.md index 145b8aa..ddeaaf4 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,4 @@ -# **libCLImate.Go** TODO +# libCLImate.Go - TODO ## **libCLImate.Go** 0.6.x TODOs: From a7eb9586eb497ca463a93baf57f7b5e57ea76c1b Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Sun, 2 Aug 2026 16:34:02 +1000 Subject: [PATCH 02/11] chore: LICENSE update --- LICENSE | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index 9c3dc13..e120e19 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,7 @@ -BSD 3-Clause License - libCLImate.Go +libCLImate.Go - BSD 3-Clause License -Copyright (c) 2019-2025, Matthew Wilson and Synesis Information Systems +Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems Copyright (c) 2015-2019, Matthew Wilson and Synesis Software - All rights reserved. Redistribution and use in source and binary forms, with or without From 9e7f5435920240f543f9f4c0c8cc179dc4ce4998 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Sun, 2 Aug 2026 16:52:49 +1000 Subject: [PATCH 03/11] .gitattributes --- .gitattributes | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ea88959 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +*.c linguist-language=C +*.cpp linguist-language=C++ +*.go linguist-language=Go +*.h linguist-language=C +*.hpp linguist-language=C++ +*.html linguist-detectable=false +*.md linguist-detectable=false +*.sh linguist-detectable=false +makefile linguist-detectable=false +*.vimrc linguist-detectable=false + From 15e10722a563aa4c3b8a9399265a90f5f4f67ab8 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Sun, 2 Aug 2026 16:53:26 +1000 Subject: [PATCH 04/11] .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 301e300..d8fa976 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ *~ *.[568vq] *.a +*.dll *.dylib *.exe *.lib From ab9ca57af42ab4e7335ade508d3c54d8920ac42c Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 16:37:16 +1000 Subject: [PATCH 05/11] .sis identities --- .sis/project_name.txt | 1 + .sis/script_info_lines.txt | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 .sis/project_name.txt create mode 100644 .sis/script_info_lines.txt diff --git a/.sis/project_name.txt b/.sis/project_name.txt new file mode 100644 index 0000000..986e99a --- /dev/null +++ b/.sis/project_name.txt @@ -0,0 +1 @@ +libCLImate.Go diff --git a/.sis/script_info_lines.txt b/.sis/script_info_lines.txt new file mode 100644 index 0000000..2c7bbd6 --- /dev/null +++ b/.sis/script_info_lines.txt @@ -0,0 +1,3 @@ +libCLImate.Go is a Command-Line Interface boilerplate mini-framework for Go +Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems +Copyright (c) 2015-2019, Matthew Wilson and Synesis Software From bb636a9062a7f7a3bc4ea6ae2caa75146942a385 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 17:25:14 +1000 Subject: [PATCH 06/11] CI --- .github/workflows/go.yml | 55 ++++++++++++++++---- build.sh | 108 ++++++++++++++++++++++++++++++++++----- 2 files changed, 140 insertions(+), 23 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 76afd33..6729f3b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,28 +1,65 @@ # This workflow will build a golang project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go +# +# Created: 18th August 2025 +# Updated: 3rd August 2026 +# + name: Go +env: + VERBOSITY: 1 + on: push: - branches: [ "master" ] + branches: + - boilerplate + - dev + - idiomatic + - master + - rc1 + - rc2 + - rc3 pull_request: - branches: [ "master" ] + +defaults: + run: + shell: bash jobs: build: - runs-on: ubuntu-latest + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + + matrix: + go-version: + - '1.23' + - '1.24' + - '1.25' + - '1.26' + os: + - macos-latest + - ubuntu-latest + - windows-latest + + runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v4 + - name: "Set up Go ${{ matrix.go-version }}" + uses: actions/setup-go@v5 with: - go-version: '1.24' + go-version: '${{ matrix.go-version }}' + + - name: "Display Go version" + run: go version - - name: Build + - name: "Build all targets" run: ./build.sh - - name: Test - run: ./run_all_unit_tests.sh + - name: "Run all unit-tests" + run: ./run_all_unit_tests.sh --verbosity ${{ env.VERBOSITY }} diff --git a/build.sh b/build.sh index b6be14a..924db21 100755 --- a/build.sh +++ b/build.sh @@ -2,34 +2,114 @@ ScriptPath=$0 Dir=$(cd $(dirname "$ScriptPath"); pwd) +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") +# ########################################################## +# command-line handling + +while [[ $# -gt 0 ]]; do + + case $1 in + --help) + + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" + cat << EOF +Builds the ${ProjectName} library and (if present) examples + +$ScriptPath [ ... flags/options ... ] + +Flags/options: + + standard flags: + + --help + displays this help and terminates + +EOF + + exit 0 + ;; + *) + + >&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage" + + exit 1 + ;; + esac + + shift +done + + +# ########################################################## +# main() + mkdir -p "$Dir/scratch/build-artefacts/" # library -echo "building library ..." -go build -v $Dir +echo "building ${ProjectName} library ..." +go build -v "$Dir" + # examples -if [ -d "$Dir/examples" ];then +if [ -d "$Dir/examples" ]; then - echo "building examples ..." - cd "$Dir/scratch/build-artefacts/" - find "$Dir/examples" -type f -name '*.go' -print -exec go build -v {} \; - cd ->/dev/null + echo "building ${ProjectName} examples ..." + + # subdirectory examples (examples//main.go) + for example_dir in "$Dir"/examples/*/; do + + [ -d "$example_dir" ] || continue + + if [ -f "${example_dir}main.go" ]; then + + example_name=$(basename "$example_dir") + echo "building example ${example_name} ..." + go build -v -o "$Dir/scratch/build-artefacts/${example_name}" "$example_dir" + fi + done + + # loose single-file examples (examples/*.go) + for example_file in "$Dir"/examples/*.go; do + + [ -f "$example_file" ] || continue + + example_name=$(basename "$example_file" .go) + echo "building example ${example_name} ..." + go build -v -o "$Dir/scratch/build-artefacts/${example_name}" "$example_file" + done fi -# tests -if [ -d "$Dir/tests" ];then +# tests (standalone programs under tests/, if present) +if [ -d "$Dir/tests" ]; then + + echo "building ${ProjectName} tests ..." - echo "building tests ..." - cd "$Dir/scratch/build-artefacts/" - find "$Dir/tests" -type f -name '*.go' -print -exec go build -v {} \; - cd ->/dev/null + for test_dir in "$Dir"/tests/*/; do + + [ -d "$test_dir" ] || continue + + if [ -f "${test_dir}main.go" ]; then + + test_name=$(basename "$test_dir") + echo "building test ${test_name} ..." + go build -v -o "$Dir/scratch/build-artefacts/${test_name}" "$test_dir" + fi + done + + for test_file in "$Dir"/tests/*.go; do + + [ -f "$test_file" ] || continue + + test_name=$(basename "$test_file" .go) + echo "building test ${test_name} ..." + go build -v -o "$Dir/scratch/build-artefacts/${test_name}" "$test_file" + done fi # ############################## end of file ############################# # - From 60e1c3ec143c3b2e523287d10780d3aa774ab09a Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 17:30:34 +1000 Subject: [PATCH 07/11] chore: helper scripts --- run_all_unit_tests.sh | 51 +++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/run_all_unit_tests.sh b/run_all_unit_tests.sh index dc27189..3bf9cfb 100755 --- a/run_all_unit_tests.sh +++ b/run_all_unit_tests.sh @@ -2,7 +2,8 @@ ScriptPath=$0 Dir=$(cd $(dirname "$ScriptPath"); pwd) - +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") ListOnly=0 Verbosity=${XTESTS_VERBOSITY:-${TEST_VERBOSITY:-3}} @@ -25,10 +26,9 @@ while [[ $# -gt 0 ]]; do ;; --help) + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" cat << EOF -ANGoLS provides Algorithms Not in the Go Language Standard library -Copyright (c) 2019-2025, Matthew Wilson and Synesis Information Systems -Runs all (matching) component and unit test programs +Runs all (matching) component and unit test packages $ScriptPath [ ... flags/options ... ] @@ -38,7 +38,7 @@ Flags/options: -l --list-only - lists the target programs but does not execute them + lists the target packages but does not execute them --verbosity specifies an explicit verbosity for the unit-test(s) @@ -68,36 +68,39 @@ done # ########################################################## # main() +cd "$Dir" || exit 1 -for f in $(find $Dir -type f -name '*_test.go') -do +# Only packages that contain tests (avoids broken multi-main examples/ dirs) +Packages=$(go list -f '{{if or .TestGoFiles .XTestGoFiles}}{{.ImportPath}}{{end}}' ./...) - if [ $ListOnly -ne 0 ]; then +if [ -z "$Packages" ]; then - echo "would execute $f:" + echo "${ScriptPath}: no test packages found for ${ProjectName}" - continue - fi + exit 0 +fi - if [ $Verbosity -ge 3 ]; then +if [ $ListOnly -ne 0 ]; then - echo - fi - if [ $Verbosity -ge 2 ]; then + echo "Listing all ${ProjectName} test packages" - echo "executing $f:" - fi + printf '%s\n' $Packages - if [ $Verbosity -ge 2 ]; then + exit 0 +fi - go test -v "$f" - else +if [ $Verbosity -ge 2 ]; then - go test "$f" - fi + echo "Running all ${ProjectName} unit-test packages" +fi -done +if [ $Verbosity -ge 2 ]; then + go test -v $Packages +else -# ############################## end of file ############################# # + go test $Packages +fi + +# ############################## end of file ############################# # From ef6747ce515bf7ae273ef9848c61e9c666f45daf Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 18:18:57 +1000 Subject: [PATCH 08/11] chore: **README.md**: badges and tag line --- AUTHORS.md | 0 NEWS.md | 0 README.md | 6 +++--- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 AUTHORS.md create mode 100644 NEWS.md diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..e69de29 diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index 507f10e..6921142 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # libCLImate.Go +**C**ommand-**L**ine **I**nterface boilerplate mini-framework, for Go + +![Language](https://img.shields.io/badge/Go-00ADD8?style=flat&logo=go&logoColor=white) [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) [![GitHub release](https://img.shields.io/github/v/release/synesissoftware/libCLImate.Go.svg)](https://github.com/synesissoftware/libCLImate.Go/releases/latest) [![Last Commit](https://img.shields.io/github/last-commit/synesissoftware/libCLImate.Go)](https://github.com/synesissoftware/libCLImate.Go/commits/master) @@ -7,8 +10,6 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/synesissoftware/libCLImate.Go)](https://goreportcard.com/report/github.com/synesissoftware/libCLImate.Go) [![Go Reference](https://pkg.go.dev/badge/github.com/synesissoftware/libCLImate.Go.svg)](https://pkg.go.dev/github.com/synesissoftware/libCLImate.Go) -**C**ommand-**L**ine **I**nterface boilerplate mini-framework, for Go - ## Introduction @@ -242,4 +243,3 @@ Defect reports, feature requests, and pull requests are welcome on https://githu - From bb2e9e16e8c0583ecad3664b2d7d15a953549ea3 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 18:22:38 +1000 Subject: [PATCH 09/11] chore: boilerplate --- .gitattributes | 7 +------ .gitignore | 4 +++- .vimrc | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 .vimrc diff --git a/.gitattributes b/.gitattributes index ea88959..3223702 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,11 +1,6 @@ -*.c linguist-language=C -*.cpp linguist-language=C++ *.go linguist-language=Go -*.h linguist-language=C -*.hpp linguist-language=C++ *.html linguist-detectable=false *.md linguist-detectable=false *.sh linguist-detectable=false -makefile linguist-detectable=false *.vimrc linguist-detectable=false - +makefile linguist-detectable=false diff --git a/.gitignore b/.gitignore index d8fa976..bebf8c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Synesis Information Systems .gitignore for Go libraries + + # directories (by name) /scratch/ @@ -28,4 +31,3 @@ *.test *.tmp *.zip - diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..373dfe4 --- /dev/null +++ b/.vimrc @@ -0,0 +1,54 @@ +" Synesis Go project .vimrc — aligned with .vscode/settings.json (Go) + +set nocompatible +filetype indent plugin on +syntax enable +set autoindent +set backspace=indent,eol,start +set hlsearch +set incsearch +set number + +" files.insertFinalNewline +set eol +set fixeol + +" editor.renderWhitespace: all +set list +set listchars=tab:->,trail:-,extends:>,precedes:<,nbsp:+ + +" editor.detectIndentation: false — global defaults (editor.tabSize: 2, insertSpaces: false) +set colorcolumn=76 +set noexpandtab +set shiftwidth=2 +set softtabstop=2 +set tabstop=2 + +" colorcolumn draws a full-column tint in Vim (not a VS Code-style 1px line). +" Keep it subtle via the ColorColumn highlight group; reapply after colorscheme changes. +if has('termguicolors') + " set termguicolors +endif + +function! s:ConfigureColorColumn() abort + highlight ColorColumn ctermbg=236 guibg=#2a2a2a cterm=NONE gui=NONE +endfunction + +call s:ConfigureColorColumn() +autocmd ColorScheme * call s:ConfigureColorColumn() + +" files.trimTrailingWhitespace +autocmd BufWritePre * %s/\s\+$//e + +augroup sis_go + autocmd! + + " [go] — gofmt uses tabs; match .vscode [go] tabSize 2 / insertSpaces false + autocmd FileType go setlocal noexpandtab tabstop=2 shiftwidth=2 softtabstop=2 colorcolumn=60,76,100 + + " [shellscript] + autocmd FileType sh,bash,zsh setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 colorcolumn=60,76 + + " [json] / [markdown] / [yaml] + autocmd FileType json,markdown,yaml setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 +augroup END From f71e5208530b4a029034e83604da0a1353b14b45 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 18:28:38 +1000 Subject: [PATCH 10/11] CI --- .github/workflows/go.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6729f3b..a3a3b41 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -36,10 +36,12 @@ jobs: matrix: go-version: - - '1.23' - - '1.24' - - '1.25' - '1.26' + - '1.25' + - '1.24' + - '1.23' + - '1.22' + - '1.21' os: - macos-latest - ubuntu-latest From 3274c72305e74de0c1e4b7f29b4e01a1cf212a29 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 19:02:40 +1000 Subject: [PATCH 11/11] chore: standardising .vscode/settings.json --- .vscode/settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 42cfed1..58e6d59 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,13 +23,13 @@ ], "go.formatTool": "goimports", "go.lintFlags": [ - "--fast" + "--fast", ], "go.lintOnSave": "workspace", "go.lintTool": "golangci-lint", "go.useLanguageServer": true, "gopls": { + "ui.completion.usePlaceholders": true, "ui.semanticTokens": true, - "ui.completion.usePlaceholders": true }, }