Skip to content

Commit cae6003

Browse files
committed
Fix build for 386 and add build.yml workflow
1 parent eb70f94 commit cae6003

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

.github/workflows/build.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
go-versions: [ '1.18', '1.22' ]
15+
go-arch: [ '386' ]
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Setup Go ${{ matrix.go-version }}
19+
uses: actions/setup-go@v4
20+
with:
21+
go-version: ${{ matrix.go-version }}
22+
- name: Build
23+
run: GOARCH=${{ matrix.go-arch }} go build

compiler/compiler.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,7 @@ func (c *compiler) IntegerNode(node *ast.IntegerNode) {
345345
}
346346
c.emitPush(int32(node.Value))
347347
case reflect.Int64:
348-
if node.Value > math.MaxInt64 || node.Value < math.MinInt64 {
349-
panic(fmt.Sprintf("constant %d overflows int64", node.Value))
350-
}
348+
panic(fmt.Sprintf("constant %d overflows int64", node.Value))
351349
c.emitPush(int64(node.Value))
352350
case reflect.Uint:
353351
if node.Value < 0 {
@@ -365,7 +363,7 @@ func (c *compiler) IntegerNode(node *ast.IntegerNode) {
365363
}
366364
c.emitPush(uint16(node.Value))
367365
case reflect.Uint32:
368-
if node.Value > math.MaxUint32 || node.Value < 0 {
366+
if node.Value < 0 {
369367
panic(fmt.Sprintf("constant %d overflows uint32", node.Value))
370368
}
371369
c.emitPush(uint32(node.Value))

0 commit comments

Comments
 (0)