From 0c469aca1f6ccaff6aae8df7fea133cb71cfb0f4 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Sun, 2 Aug 2026 16:25:25 +1000 Subject: [PATCH 01/13] chore: markdown consistency changes --- AUTHORS.md | 2 +- CHANGES.md | 2 +- EXAMPLES.md | 2 +- NEWS.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 4b85cef..0b26fd3 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,4 +1,4 @@ -# ANGoLS - Authors +# ANGoLS - Authors ## Contributors: diff --git a/CHANGES.md b/CHANGES.md index 6f59d87..d86d7a4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -# **ANGoLS** Changes +# ANGoLS - CHANGES ## 0.10.0 - 10th March 2026 diff --git a/EXAMPLES.md b/EXAMPLES.md index 652dcfe..c1e6329 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -1,4 +1,4 @@ -# ANGoLS.Go Examples +# ANGoLS - Examples | Name | Source & Description | Summary | | ---- | -------------------- | ------- | diff --git a/NEWS.md b/NEWS.md index e111522..e43189d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# ANGoLS - NEWS +# ANGoLS - News | Date | News Item | From 1b02e7f994e71f87d17d531abbb6f0337bd9db06 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Sun, 2 Aug 2026 16:34:02 +1000 Subject: [PATCH 02/13] chore: LICENSE update --- LICENSE | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index e4fcfa3..f6b17bc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,6 @@ -BSD 3-Clause License - ANGoLS - -Copyright (c) 2019-2025, Matthew Wilson and Synesis Information Systems +ANGoLS - BSD 3-Clause License +Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems All rights reserved. Redistribution and use in source and binary forms, with or without From eb0dfd86ca82bffdfd8c3c67e2e3310a684a8c20 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Sun, 2 Aug 2026 16:52:48 +1000 Subject: [PATCH 03/13] .gitattributes --- .gitattributes | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.gitattributes b/.gitattributes index e69de29..ea88959 100644 --- a/.gitattributes +++ 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 994ea51313a65e4f821235dd4334031af378cc6f Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Sun, 2 Aug 2026 16:53:26 +1000 Subject: [PATCH 04/13] .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 21cb44d2a503b872883aa0dc4b5e62acfb05c972 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 16:37:16 +1000 Subject: [PATCH 05/13] .sis identities --- .sis/project_name.txt | 1 + .sis/script_info_lines.txt | 2 ++ 2 files changed, 3 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..db9a258 --- /dev/null +++ b/.sis/project_name.txt @@ -0,0 +1 @@ +ANGoLS diff --git a/.sis/script_info_lines.txt b/.sis/script_info_lines.txt new file mode 100644 index 0000000..9244429 --- /dev/null +++ b/.sis/script_info_lines.txt @@ -0,0 +1,2 @@ +ANGoLS provides Algorithms Not in the Go Language Standard library +Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems From eef34f79056b63e2ebbd16e5fe0787ba8ebe8a41 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 17:25:14 +1000 Subject: [PATCH 06/13] CI --- .github/workflows/go.yml | 51 ++++++++++++++---- build.sh | 108 ++++++++++++++++++++++++++++++++++----- 2 files changed, 134 insertions(+), 25 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 635b987..6729f3b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,36 +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", "dev", "gha" ] + branches: + - boilerplate + - dev + - idiomatic + - master + - rc1 + - rc2 + - rc3 pull_request: - branches: [ "master", "dev", "gha" ] + +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.21', '1.22', '1.23', '1.24' ] + 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 ${{ matrix.go-version }} - uses: actions/setup-go@v4 + - name: "Set up Go ${{ matrix.go-version }}" + uses: actions/setup-go@v5 with: go-version: '${{ matrix.go-version }}' - - name: Display 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 e144bb91a78866879c483f68b56597990f8190d6 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 17:30:01 +1000 Subject: [PATCH 07/13] dependencies --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d16d014..d38f90e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/synesissoftware/ANGoLS -go 1.24 +go 1.23.6 require ( github.com/stretchr/testify v1.11.0 From 1cec3225545d47268f2f48b368586c46278c7be9 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 17:30:34 +1000 Subject: [PATCH 08/13] 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 b19ef3d73c061e25a98934839ad8d9e3cb261b17 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 17:40:49 +1000 Subject: [PATCH 09/13] fix: eschewing use of `Loop`, and reverting to manual `for`-loops, to enable backwards support for 1.23 --- slices/collect_test.go | 6 +++--- slices/select_test.go | 4 ++-- strings/ascii_test.go | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/slices/collect_test.go b/slices/collect_test.go index d7a9667..ea974f9 100644 --- a/slices/collect_test.go +++ b/slices/collect_test.go @@ -189,7 +189,7 @@ func Benchmark_equal_ints_by_EqualSliceOfInt(b *testing.B) { b.ResetTimer() - for b.Loop() { + for i := 0; i < b.N; i++ { _ = slices.EqualSliceOfInt(ints_1, ints_2) } @@ -203,7 +203,7 @@ func Benchmark_equal_ints_by_EqualSlice(b *testing.B) { b.ResetTimer() - for b.Loop() { + for i := 0; i < b.N; i++ { _ = slices.EqualSlice(ints_1, ints_2) } @@ -217,7 +217,7 @@ func Benchmark_equal_uints_by_EqualSlice(b *testing.B) { b.ResetTimer() - for b.Loop() { + for i := 0; i < b.N; i++ { _ = slices.EqualSlice(ints_1, ints_2) } diff --git a/slices/select_test.go b/slices/select_test.go index 2335437..c091ab7 100644 --- a/slices/select_test.go +++ b/slices/select_test.go @@ -16,7 +16,7 @@ func Benchmark_SelectSliceOfInt(b *testing.B) { {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, } - for b.Loop() { + for i := 0; i < b.N; i++ { for _, input := range inputs { slices.SelectSliceOfInt(input, func(_, _ int) (bool, error) { return true, nil @@ -33,7 +33,7 @@ func Benchmark_SelectSliceOfString(b *testing.B) { {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, } - for b.Loop() { + for i := 0; i < b.N; i++ { for _, input := range inputs { slices.SelectSliceOfString(input, func(_ int, _ string) (bool, error) { return true, nil diff --git a/strings/ascii_test.go b/strings/ascii_test.go index cb028d6..bf9fda3 100644 --- a/strings/ascii_test.go +++ b/strings/ascii_test.go @@ -44,7 +44,7 @@ func Test_ASCIIToUpper(t *testing.T) { func Benchmark_ASCIIToLower(b *testing.B) { const s = "Hello, World!" - for b.Loop() { + for i := 0; i < b.N; i++ { _ = strings.ASCIIToLower(s) } } @@ -52,7 +52,7 @@ func Benchmark_ASCIIToLower(b *testing.B) { func Benchmark_StringsToLower(b *testing.B) { const s = "Hello, World!" - for b.Loop() { + for i := 0; i < b.N; i++ { _ = stdstrings.ToLower(s) } } @@ -60,7 +60,7 @@ func Benchmark_StringsToLower(b *testing.B) { func Benchmark_ASCIIToUpper(b *testing.B) { const s = "Hello, World!" - for b.Loop() { + for i := 0; i < b.N; i++ { _ = strings.ASCIIToUpper(s) } } @@ -68,7 +68,7 @@ func Benchmark_ASCIIToUpper(b *testing.B) { func Benchmark_StringsToUpper(b *testing.B) { const s = "Hello, World!" - for b.Loop() { + for i := 0; i < b.N; i++ { _ = stdstrings.ToUpper(s) } } From 7aefa44c5619a311bf2bbb822cd313043e57601d Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 18:18:57 +1000 Subject: [PATCH 10/13] chore: **README.md**: badges and tag line --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 50bdfbb..295cf3f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # ANGoLS +**A**lgorithms **N**ot in **Go** **L**anguage **S**tandard library + +![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/ANGoLS.svg)](https://github.com/synesissoftware/ANGoLS/releases/latest) [![Last Commit](https://img.shields.io/github/last-commit/synesissoftware/ANGoLS)](https://github.com/synesissoftware/ANGoLS/commits/master) @@ -7,8 +10,6 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/synesissoftware/ANGoLS)](https://goreportcard.com/report/github.com/synesissoftware/ANGoLS) [![Go Reference](https://pkg.go.dev/badge/github.com/synesissoftware/ANGoLS.svg)](https://pkg.go.dev/github.com/synesissoftware/ANGoLS) -**A**lgorithms **N**ot in **Go** **L**anguage **S**tandard library - ## Table of Contents @@ -437,4 +438,3 @@ T.B.C. - From 758ed435c1aaf406164593ff14bc00bd98a2421b Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 18:22:38 +1000 Subject: [PATCH 11/13] 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 9e08d364962796771182d8b32b308875f23e11a0 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 18:28:38 +1000 Subject: [PATCH 12/13] 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 2927354d180a1e7e9d980a26ac8db7e60614eaff Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 19:02:39 +1000 Subject: [PATCH 13/13] 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 }, }