diff --git a/.github/workflows/gochecks.yml b/.github/workflows/gochecks.yml index bd48e7e..7715659 100644 --- a/.github/workflows/gochecks.yml +++ b/.github/workflows/gochecks.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Go environment uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # pin@v5 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - name: Run Vulncheck if: matrix.os == 'ubuntu-latest' @@ -34,7 +34,7 @@ jobs: if: matrix.os == 'ubuntu-latest' uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # pin@v6 with: - version: v1.61.0 + version: v1.62.0 - name: Install Git Bash run: | choco install git diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index e9c2281..ba0820e 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -24,7 +24,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 # pin@v3 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - name: Log in to Docker uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pin@v2 diff --git a/eval/eval.go b/eval/eval.go index fb5932a..8a20c82 100644 --- a/eval/eval.go +++ b/eval/eval.go @@ -275,7 +275,7 @@ func (s *State) evalInternal(node any) object.Object { //nolint:funlen,gocognit, log.LogVf("Normalizing non-short lambda form to => lambda") fn.Lambda = true } - fn.SetCacheKey() // sets cache key + object.SetCacheKey(&fn) // sets cache key if name != nil { oerr := s.env.Set(name.Literal(), fn) if oerr.Type() == object.ERROR { diff --git a/go.mod b/go.mod index 02e1e19..49ddbfd 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module grol.io/grol -go 1.22.7 +go 1.23.3 require ( fortio.org/cli v1.9.2 @@ -8,11 +8,11 @@ require ( fortio.org/safecast v1.0.0 fortio.org/sets v1.2.0 fortio.org/struct2env v0.4.1 - fortio.org/terminal v0.27.0 + fortio.org/terminal v0.27.1 fortio.org/testscript v0.3.2 // only for tests fortio.org/version v1.0.4 github.com/rivo/uniseg v0.4.7 - golang.org/x/image v0.21.0 + golang.org/x/image v0.22.0 ) require ( @@ -20,6 +20,6 @@ require ( github.com/kortschak/goroutine v1.1.2 // indirect golang.org/x/crypto/x509roots/fallback v0.0.0-20240916204253-42ee18b96377 // indirect golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/sys v0.26.0 // indirect + golang.org/x/sys v0.27.0 // indirect golang.org/x/tools v0.25.0 // indirect ) diff --git a/go.sum b/go.sum index 23ed46a..ac99bef 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,8 @@ fortio.org/struct2env v0.4.1 h1:rJludAMO5eBvpWplWEQNqoVDFZr4RWMQX7RUapgZyc0= fortio.org/struct2env v0.4.1/go.mod h1:lENUe70UwA1zDUCX+8AsO663QCFqYaprk5lnPhjD410= fortio.org/term v0.23.0-fortio-6 h1:pKrUX0tKOxyEhkhLV50oJYucTVx94rzFrXc24lIuLvk= fortio.org/term v0.23.0-fortio-6/go.mod h1:7buBfn81wEJUGWiVjFNiUE/vxWs5FdM9c7PyZpZRS30= -fortio.org/terminal v0.27.0 h1:wlenFkIdNCyI7pxr+xRpQSefy9/XcL9e3rfrnPgEloc= -fortio.org/terminal v0.27.0/go.mod h1:MikWZO8nnM+W4KjiEakpahRLqSaJvaeDdzysYGCHcP8= +fortio.org/terminal v0.27.1 h1:4TQnDltqCrYEt653dXaX/r388Jj3YxahTEPmBj9MLWs= +fortio.org/terminal v0.27.1/go.mod h1:J7wmCkbBZhCNv3HPgctMOTI8WeJmoBE5BbkFzcXw19I= fortio.org/testscript v0.3.2 h1:ks5V+Y6H6nmeGqnVlZuLdiFwpqXemDkEnyGgCZa/ZNA= fortio.org/testscript v0.3.2/go.mod h1:Z2kUvEDHYETV8FLxsdA6zwSZ8sZUiTNJh2Dw5c4a3Pg= fortio.org/version v1.0.4 h1:FWUMpJ+hVTNc4RhvvOJzb0xesrlRmG/a+D6bjbQ4+5U= @@ -26,9 +26,9 @@ golang.org/x/crypto/x509roots/fallback v0.0.0-20240916204253-42ee18b96377 h1:aDW golang.org/x/crypto/x509roots/fallback v0.0.0-20240916204253-42ee18b96377/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= -golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s= -golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/image v0.22.0 h1:UtK5yLUzilVrkjMAZAZ34DXGpASN8i8pj8g+O+yd10g= +golang.org/x/image v0.22.0/go.mod h1:9hPFhljd4zZ1GNSIZJ49sqbp45GKK9t6w+iXvGqZUz4= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= diff --git a/object/object.go b/object/object.go index 744cf61..2fa30f0 100644 --- a/object/object.go +++ b/object/object.go @@ -607,7 +607,7 @@ func (f Function) Type() Type { return FUNC } // Must be called after the function is fully initialized. // Whether a function result should be cached doesn't depend on the Name, // so it's not part of the cache key. -func (f *Function) SetCacheKey() string { +func SetCacheKey(f *Function) string { out := strings.Builder{} if !f.Lambda { out.WriteString("func ") @@ -616,7 +616,7 @@ func (f *Function) SetCacheKey() string { return f.CacheKey } -func (f *Function) lambdaPrint(ps *ast.PrintState, out *strings.Builder) string { +func (f Function) lambdaPrint(ps *ast.PrintState, out *strings.Builder) string { if len(f.Parameters) != 1 { out.WriteString(")=>") } else { @@ -636,7 +636,7 @@ func (f *Function) lambdaPrint(ps *ast.PrintState, out *strings.Builder) string } // Common part of Inspect and SetCacheKey. Outputs the rest of the function. -func (f *Function) finishFuncOutput(out *strings.Builder, compact bool) string { +func (f Function) finishFuncOutput(out *strings.Builder, compact bool) string { needParen := !f.Lambda || len(f.Parameters) != 1 if needParen { out.WriteString("(") @@ -1188,7 +1188,7 @@ type ShortExtFunction func(args []Object) Object // name is the function name as registered under. type ExtFunction func(eval any, name string, args []Object) Object -func (e *Extension) Usage(out *strings.Builder) { +func (e Extension) Usage(out *strings.Builder) { for i := 1; i <= e.MinArgs; i++ { if i > 1 { out.WriteString(", ")