Skip to content

Commit

Permalink
ISSUE-221 Per request, upgrading dependency goja to v0.0.0-2023081210…
Browse files Browse the repository at this point in the history
…5242-81d76064690d to include all ES6 features (#222)

This is a major upgrade for omniparser since the upgrade of goja requires go version 1.16, thus we're bumping
omniparser min go version to 1.16 as well. Be careful when you upgrade omniparser.
  • Loading branch information
jf-tech authored Jul 3, 2024
1 parent dd04a11 commit 0ae53cc
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: '^1.14.2'
go-version: '^1.16.2'
id: go

- name: Check out code into the Go module directory
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.14
FROM golang:1.16
WORKDIR /omniparser
COPY . .
# when Dockerfile building in heroku, .git isn't available (removed by heroku slug compiler)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Omniparser is a native Golang ETL parser that ingests input data of various form
XML, EDI/X12/EDIFACT, JSON**, and custom formats) in streaming fashion and transforms data into desired JSON output
based on a schema written in JSON.

Min Golang Version: 1.14
Min Golang Version: 1.16

## Licenses and Sponsorship
Omniparser is publicly available under [MIT License](./LICENSE).
Expand Down Expand Up @@ -69,7 +69,7 @@ As for now (2023/03/14), all of our previous free docker hosting solutions went
situations.

## Requirements
- Golang 1.14 or later.
- Golang 1.16 or later.

## Recent Major Feature Additions/Changes
- 2022/09: v1.0.4 released: added `csv2` file format that supersedes the original `csv` format with support of hierarchical and nested records.
Expand Down
2 changes: 1 addition & 1 deletion doc/gettingstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and by the CLI tool.

## Prerequisites and Notes

- Golang 1.14 installed.
- Golang 1.16 installed.
- [`github.com/jf-tech/omniparser`](https://github.com/jf-tech/omniparser) cloned (assuming the clone
location is: `~/dev/jf-tech/omniparser/`)
- The guide assumes Mac OS or Linux dev environment. If you're on Windows, you need make minor
Expand Down
17 changes: 12 additions & 5 deletions extensions/omniv21/customfuncs/javascript_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ func TestJavaScript(t *testing.T) {
err: "",
expected: "one-2",
},
{
name: "#issue-221: verify ES6 String.prototype.replaceAll() implementation",
js: "\"tic tac toe\".replaceAll('t', 'b');",
args: nil,
err: "",
expected: "bic bac boe",
},
// all error cases
{
name: "num of args wrong",
Expand All @@ -79,7 +86,7 @@ func TestJavaScript(t *testing.T) {
name: "javascript throws",
js: "throw 'failure';",
args: nil,
err: "failure at <eval>:1:7(1)",
err: "failure at <eval>:1:1(1)",
expected: nil,
},
{
Expand Down Expand Up @@ -157,10 +164,10 @@ func TestJavaScriptClearVarsAfterRunProgram(t *testing.T) {
}

// go test -bench=. -benchmem -benchtime=30s
// BenchmarkJavaScriptWithNoCache-8 225940 160696 ns/op 136620 B/op 1698 allocs/op
// BenchmarkJavaScriptWithCache-8 22289469 1612 ns/op 140 B/op 9 allocs/op
// BenchmarkConcurrentJavaScriptWithNoCache-8 1479 24486799 ns/op 27331471 B/op 339793 allocs/op
// BenchmarkConcurrentJavaScriptWithCache-8 69219 517898 ns/op 34722 B/op 1952 allocs/op
// BenchmarkJavaScriptWithNoCache-8 371036 96020 ns/op 149597 B/op 1860 allocs/op
// BenchmarkJavaScriptWithCache-8 36966369 976.9 ns/op 177 B/op 8 allocs/op
// BenchmarkConcurrentJavaScriptWithNoCache-8 3368 10797315 ns/op 29926101 B/op 372172 allocs/op
// BenchmarkConcurrentJavaScriptWithCache-8 199069 181978 ns/op 36569 B/op 1750 allocs/op

var (
benchTitles = []string{"", "Dr", "Sir"}
Expand Down
2 changes: 1 addition & 1 deletion extensions/omniv21/fileformat/flatfile/recdecl.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type RecDecl interface {
// flexibility. Note RecDecl's ChildDecls need to return child decls and each format specific decl
// is different, so that's the first incompatibility here that ChildDecls cannot be even be included
// in the struct if we go down the RecDecl being struct route. Yes, generics can do that but we
// don't want to move omniparser 1.14 dependency up all the way to 1.18 simply because of this.
// don't want to move omniparser 1.16 dependency up all the way to 1.18 simply because of this.
// Second, depending on formats, the default values for min/max are different: csv/fixed-length
// min/max default to 0/-1, but for EDI min/max default to 1/1. Given these incompatibility and
// loss of flexibility, we chose to stick with the RecDecl interface route and have each format
Expand Down
11 changes: 4 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
module github.com/jf-tech/omniparser

go 1.14
go 1.16

require (
github.com/antchfx/xmlquery v1.3.1
github.com/antchfx/xpath v1.1.11
github.com/bradleyjkemp/cupaloy v2.3.0+incompatible
github.com/dlclark/regexp2 v1.2.1 // indirect
github.com/dop251/goja v0.0.0-20201002140143-8ce18d86df5f
github.com/dop251/goja v0.0.0-20230812105242-81d76064690d
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/google/uuid v1.1.2
github.com/jf-tech/go-corelib v0.0.14
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.6.1
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/net v0.0.0-20200904194848-62affa334b73
golang.org/x/text v0.3.3
gopkg.in/yaml.v2 v2.3.0 // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b
golang.org/x/text v0.3.8
)
Loading

0 comments on commit 0ae53cc

Please sign in to comment.