From 1314a5dafea85addd287fc76959959be34d00cf6 Mon Sep 17 00:00:00 2001 From: sam-at-luther Date: Fri, 29 Mar 2024 14:58:38 -0700 Subject: [PATCH 1/2] Use golang 1.22 --- .github/workflows/elps.yml | 18 +++++++++--------- go.mod | 2 +- lisp/lisplib/libjson/encode.go | 8 ++++++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/elps.yml b/.github/workflows/elps.yml index 50ba508..a88ef0b 100644 --- a/.github/workflows/elps.yml +++ b/.github/workflows/elps.yml @@ -7,13 +7,13 @@ jobs: build: runs-on: ubuntu-latest container: - image: golang:1.20 + image: golang:1.22 steps: - - uses: actions/checkout@v3.5.0 - - name: Install golangci-lint - run: wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "v${GOLANGCI_LINT_VERSION}" - env: - GOLANGCI_LINT_VERSION: 1.52.2 - BINDIR: /usr/local/bin - - name: Run static checks and CI tests - run: make static-checks citest + - uses: actions/checkout@v3.5.0 + - name: Install golangci-lint + run: wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "v${GOLANGCI_LINT_VERSION}" + env: + GOLANGCI_LINT_VERSION: 1.57.2 + BINDIR: /usr/local/bin + - name: Run static checks and CI tests + run: make static-checks citest diff --git a/go.mod b/go.mod index 71326a5..b6f703e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/luthersystems/elps -go 1.21 +go 1.22 require ( github.com/chzyer/readline v1.5.0 diff --git a/lisp/lisplib/libjson/encode.go b/lisp/lisplib/libjson/encode.go index d82830e..ce27e43 100644 --- a/lisp/lisplib/libjson/encode.go +++ b/lisp/lisplib/libjson/encode.go @@ -240,7 +240,7 @@ func (enc *encoder) encodeBytes(b []byte) (err error) { w := base64.NewEncoder(enc64, &enc.buf) for len(b) > 0 { // This clobbers the variable we were using for encoded-len to save - // stack sapce but we don't need that anymore. + // stack space but we don't need that anymore. n, _ = w.Write(b) b = b[n:] } @@ -263,7 +263,7 @@ func (enc *encoder) encodeLString(v *lisp.LVal) error { } // NOTE: encodeString adapted from the json package. -// https://cs.opensource.google/go/go/+/refs/tags/go1.16.4:src/encoding/json/encode.go;l=1029 +// https://cs.opensource.google/go/go/+/refs/tags/go1.22.1:src/encoding/json/encode.go;l=956 func (enc *encoder) encodeString(s string) error { const hex = "0123456789abcdef" enc.buf.WriteByte('"') @@ -281,6 +281,10 @@ func (enc *encoder) encodeString(s string) error { switch b { case '\\', '"': enc.buf.WriteByte(b) + case '\b': + enc.buf.WriteByte('b') + case '\f': + enc.buf.WriteByte('f') case '\n': enc.buf.WriteByte('n') case '\r': From 22f19fae269bd14ad9aec6cd426021c6db8e40f5 Mon Sep 17 00:00:00 2001 From: sam-at-luther Date: Fri, 29 Mar 2024 15:02:17 -0700 Subject: [PATCH 2/2] Fix linter --- scripts/static-checks.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/static-checks.sh b/scripts/static-checks.sh index 246487d..97e8d36 100755 --- a/scripts/static-checks.sh +++ b/scripts/static-checks.sh @@ -6,4 +6,7 @@ set -exuo pipefail +# work around for golangci-lint -buildvcs=false +git config --global --add safe.directory $PWD +golangci-lint version golangci-lint run -v