From e9153c65264eb7b40e28b12be244a2faeffc0da5 Mon Sep 17 00:00:00 2001 From: "R.I.Pienaar" Date: Thu, 15 Aug 2024 12:35:52 +0200 Subject: [PATCH] (misc) Require go 1.22 Signed-off-by: R.I.Pienaar --- .github/workflows/test.yaml | 2 +- ABTaskFile | 116 ++++++++++++++++++++++++++++++++++++ go.mod | 6 +- go.sum | 8 +-- 4 files changed, 124 insertions(+), 8 deletions(-) create mode 100644 ABTaskFile diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 23012a7..136a1b4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,7 +5,7 @@ jobs: test: strategy: matrix: - go: ["1.20", "1.21"] + go: ["1.22", "1.23"] runs-on: ubuntu-latest steps: diff --git a/ABTaskFile b/ABTaskFile new file mode 100644 index 0000000..19dba5e --- /dev/null +++ b/ABTaskFile @@ -0,0 +1,116 @@ +name: build_tasks +description: Choria Build Tasks + +commands: + - name: dependencies + type: parent + description: Manage dependencies + aliases: [d] + commands: + - name: update + description: Update dependencies + type: exec + aliases: [up] + dir: "{{ AppDir }}" + flags: + - name: verbose + description: Log verbosely + short: v + bool: true + - name: proxy + description: Enable using go proxy + bool: true + default: "true" + script: | + . "{{ BashHelperPath }}" + + ab_announce Updating all dependencies + echo + + {{ if eq .Flags.proxy false }} + export GOPROXY=direct + ab_say Disabling go mod proxy + {{ end }} + + go get -u -n -a -t {{- if .Flags.verbose }} -d -x {{ end }} ./... + + ab_say Running go mod tidy + + go mod tidy + + - name: test + type: parent + aliases: [t] + description: Perform various tests + commands: + - name: unit + type: exec + description: Run ginkgo unit tests + aliases: [u] + arguments: + - name: dir + description: Directory to test + default: . + flags: + - name: update + description: Updates the ginkgo runtime + bool: true + script: | + set -e + + . "{{ BashHelperPath }}" + + {{ if .Flags.update }} + ab_say Updating ginkgo binary + go install github.com/onsi/ginkgo/v2/ginkgo + {{ end }} + + ginkgo -r --skip Integration {{ .Arguments.dir | escape }} + + - name: lint + type: exec + dir: "{{ AppDir }}" + flags: + - name: vet + description: Perform go vet + bool: true + default: true + - name: staticcheck + description: Perform staticcheck + bool: true + default: true + - name: update + description: Updates lint dependencies + bool: true + script: | + set -e + + . "{{ BashHelperPath }}" + + {{ if .Flags.update }} + ab_say Updating linting tools + go install github.com/client9/misspell/cmd/misspell@latest + go install honnef.co/go/tools/cmd/staticcheck@latest + {{ else }} + echo ">>> Run with --update to install required commands" + echo + {{ end }} + + ab_say Formatting source files + go fmt ./... + + ab_say Tidying go mod + go mod tidy + + ab_say Checking spelling + find . -type f -name "*.go" | xargs misspell -error -locale US -i flavour + + {{ if .Flags.vet }} + ab_say Performing go vet + go vet ./... + {{ end }} + + {{ if .Flags.staticcheck }} + ab_say Running staticcheck + staticcheck ./... + {{ end }} \ No newline at end of file diff --git a/go.mod b/go.mod index e0fb601..e3223d4 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/choria-io/fisk -go 1.20 +go 1.22.0 require ( - github.com/stretchr/testify v1.8.4 - golang.org/x/text v0.14.0 + github.com/stretchr/testify v1.9.0 + golang.org/x/text v0.17.0 ) require ( diff --git a/go.sum b/go.sum index e228b7b..53f41df 100644 --- a/go.sum +++ b/go.sum @@ -2,10 +2,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=