Skip to content

Commit

Permalink
update builds to use go1.21 (#276)
Browse files Browse the repository at this point in the history
* update builds to use go1.21

* fix lint errors

* remove deprecated goreleaser config
- see https://goreleaser.com/deprecations/#archivesrlcp
  • Loading branch information
AriehSchneier committed Aug 14, 2023
1 parent 39298c7 commit c1f6237
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 41 deletions.
7 changes: 3 additions & 4 deletions .github/goreleaser_configs/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ builds:
goarch:
- amd64
- arm64
- 386
- "386"
goarm:
- 7
- "7"
ignore:
- goos: darwin
goarch: 386
goarch: "386"

archives:
- id: "arrai"
Expand All @@ -44,7 +44,6 @@ archives:
files:
- README.md
- LICENSE
rlcp: true

checksum:
name_template: '{{.ProjectName}}_v{{.Version}}_checksums.txt'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: 1.21

- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand All @@ -25,14 +25,14 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.6.0
with:
version: v1.49.0
version: v1.54.0

- name: Check clean
run: make check-clean

- name: Validate goreleaser config
run: |
go run github.com/goreleaser/goreleaser@v1.18.2 check -f .github/goreleaser_configs/goreleaser.yml
go run github.com/goreleaser/goreleaser@latest check -f .github/goreleaser_configs/goreleaser.yml
build:
name: Build
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: 1.21

- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand All @@ -62,7 +62,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: 1.21

- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: 1.21

- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand All @@ -27,7 +27,7 @@ jobs:

- name: Install golangci-lint
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.49.0
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.0
git restore go.mod go.sum
- name: Build
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Validate goreleaser config
uses: goreleaser/goreleaser-action@v4
with:
version: v1.18.2
version: latest
args: check -f .github/goreleaser_configs/goreleaser.yml

- name: Set GOVERSION env var
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: 1.21

- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand Down
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ linters-settings:
- performance
- style

issues:
exclude:
- "unused-parameter: parameter '\\w+' seems to be unused, consider removing or renaming it as _"

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- bodyclose
- depguard
# - depguard
- dogsled
- dupl
- errcheck
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG go_ver=1.19
ARG alpine_ver=3.16
ARG go_ver=1.21
ARG alpine_ver=3.18

ARG DOCKER_BASE=golang:${go_ver}-alpine${alpine_ver}
FROM ${DOCKER_BASE} AS stage
Expand Down
6 changes: 3 additions & 3 deletions pkg/ctxfs/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ func ZipEqualToFiles(t *testing.T, buf []byte, files map[string]string) {
require.NoError(t, err)
//FIXME: need to check for unexpected files in zip, afero.Walk for some reason does not work
fs := zipfs.New(zipR)
copy := files
cpy := files
for name, content := range files {
f, err := fs.Open(name)
assert.NoError(t, err)
buf, err := io.ReadAll(f)
assert.NoError(t, err)
assert.Equal(t, content, string(buf))
delete(copy, name)
delete(cpy, name)
}
assert.Zero(t, len(copy))
assert.Zero(t, len(cpy))
}

// CreateTestMemMapFs creates a memory fs from provided files
Expand Down
7 changes: 3 additions & 4 deletions pkg/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,12 @@ func (l *lineCollector) appendLine(line string) {
possibleOpener = append(possibleOpener, line[i:i+j+1])
}
for _, p := range possibleOpener {
if close, isOpener := openers[p]; isOpener {
l.push(close)
if clse, isOpener := openers[p]; isOpener {
l.push(clse)
increment = len(p)
break
} else {
increment = 1
}
increment = 1
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/shell/shell_completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s *shellInstance) Do(line []rune, pos int) (newLine [][]rune, length int)

// no need to check partial expr if not attached to token
if notAttachedToExpr {
return
return newLine, length
}
partialExprPreds, residueLen := s.partialExprPredictions(string(line[:pos]))
if len(newLine) == 0 || residueLen < length {
Expand Down Expand Up @@ -114,7 +114,6 @@ func (s *shellInstance) partialExprPredictions(currentLine string) (newLine [][]
// }

func (s *shellInstance) trimExpr(expr string) (realExpr, residue string) {
realExpr = expr
getRe := regexp.MustCompile(`\.(\w*|\"(\\.|[^\\"])*|\'(\\.|[^\\'])*|\x60(\x60\x60|[^\x60])*)$`)
callRe := regexp.MustCompile(`\((\"([^\\"])*|\'(\\.|[^\\'])*|\x60(\x60\x60|[^\x60])*|[^)]*)$`)

Expand Down
28 changes: 14 additions & 14 deletions rel/pattern_tuple.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,23 @@ func (p TuplePattern) Bind(ctx context.Context, local Scope, value Value) (conte
}
extraPattern = &p.attrs[i]
continue
} else {
if attr.pattern.fallback == nil && !names.IsTrue() {
return ctx, EmptyScope, fmt.Errorf("length of tuple %s shorter than tuple pattern %s", tuple, p)
}
if attr.pattern.fallback == nil && !names.IsTrue() {
return ctx, EmptyScope, fmt.Errorf("length of tuple %s shorter than tuple pattern %s", tuple, p)
}
var found bool
tupleValue, found = tuple.Get(attr.name)
if !found {
if attr.pattern.fallback == nil {
return ctx, EmptyScope, fmt.Errorf("couldn't find %s in tuple %s", attr.name, tuple)
}
var found bool
tupleValue, found = tuple.Get(attr.name)
if !found {
if attr.pattern.fallback == nil {
return ctx, EmptyScope, fmt.Errorf("couldn't find %s in tuple %s", attr.name, tuple)
}
var err error
tupleValue, err = attr.pattern.fallback.Eval(ctx, local)
if err != nil {
return ctx, EmptyScope, err
}
var err error
tupleValue, err = attr.pattern.fallback.Eval(ctx, local)
if err != nil {
return ctx, EmptyScope, err
}
}

var err error
ctx, result, err = bind(ctx, attr, result, tupleValue)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions syntax/std_re.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ var (
return rel.NewArray(matches...), nil
}),
createFunc2Attr("sub", func(_ context.Context, a, b rel.Value) (rel.Value, error) {
new, is := tools.ValueAsString(a)
nw, is := tools.ValueAsString(a)
if !is {
return nil, fmt.Errorf("//re.compile(re).sub: new not a string: %v", b)
}
s, is := tools.ValueAsString(b)
if !is {
return nil, fmt.Errorf("//re.compile(re).sub: s not a string: %v", a)
}
return rel.NewString([]rune(regex.ReplaceAllString(s, new))), nil
return rel.NewString([]rune(regex.ReplaceAllString(s, nw))), nil
}),
createFunc2Attr("subf", func(ctx context.Context, a, b rel.Value) (rel.Value, error) {
s, is := tools.ValueAsString(b)
Expand Down

0 comments on commit c1f6237

Please sign in to comment.