Skip to content

Commit fab3b51

Browse files
chore: Update CI workflow and fix string parsing
Co-Authored-By: [email protected] <[email protected]>
1 parent c34c29d commit fab3b51

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
test:
55
strategy:
66
matrix:
7-
go-version: [1.16.x]
7+
go-version: [1.21.x]
88
os: [ubuntu-latest]
99
runs-on: ${{ matrix.os }}
1010
steps:
@@ -16,8 +16,8 @@ jobs:
1616
uses: actions/checkout@v2
1717
- name: Install dependencies
1818
run: |
19-
go get -u honnef.co/go/tools/cmd/staticcheck@latest
20-
go get -u golang.org/x/tools/cmd/goimports
19+
go install honnef.co/go/tools/cmd/staticcheck@v0.2.2
20+
go install golang.org/x/tools/cmd/goimports@v0.1.10
2121
- name: Run staticcheck
2222
run: staticcheck ./...
2323
- name: Check code formatting

jparse/node.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ type StringNode struct {
3030
}
3131

3232
func parseString(p *parser, t token) (Node, error) {
33+
if t.Value == "" {
34+
return nil, newError(ErrSyntaxError, t)
35+
}
3336

3437
s, ok := unescape(t.Value)
3538
if !ok {
3639
typ := ErrIllegalEscape
3740
if len(s) > 0 && s[0] == 'u' {
3841
typ = ErrIllegalEscapeHex
3942
}
40-
4143
return nil, newErrorHint(typ, t, s)
4244
}
4345

44-
return &StringNode{
45-
Value: s,
46-
}, nil
46+
return &StringNode{Value: s}, nil
4747
}
4848

4949
func (n *StringNode) optimize() (Node, error) {

0 commit comments

Comments
 (0)