555 Commits

Author SHA1 Message Date
Sheridan C Rawlins
a39e181c51
[661] Update stdlib to get std.escapeStringXml (#662)
See
- https://github.com/google/jsonnet/issues/1037
- https://github.com/google/jsonnet/pull/1038
2023-01-29 17:54:54 +00:00
Iain Lane
506b37365e
fix: Make lstripChars and rStripChars work with multibyte characters (#663)
We're currently working with the length of the string itself, which is
the number of bytes. That's wrong in these functions which operate at
the level of characters. When applied to a string with a multibyte
character they can return the wrong result. For example, evaluating
`std.rstripChars('• foo\n', '\n')` results in `"• f"`.

What we need to do instead is get the number of runes, and remove one
rune at a time.
2023-01-29 17:44:20 +00:00
Jonathan Regehr
123396675b
Adds jsonnet-lint to the releases (#664) v0.19.2-pre1 2023-01-16 20:12:40 +00:00
Jack
353caa131c
docs: explicit addition for installing other tools (#658) 2022-11-28 22:54:29 +00:00
Salva Corts
0504998e1e
Fix std.member matching sub strings (#657)
* Fix std.member for strings

* Add test case for matching substr in std.member
2022-11-23 20:42:49 +00:00
August Karlstedt
b4633b66f8 Update deps.bzl 2022-10-31 14:49:09 +00:00
Aaron Jheng
f30e2329be Bump go to 1.17 2022-10-31 14:46:30 +00:00
Dave Cunningham
c298238534 Bump version to v0.19.1 v0.19.1 2022-10-27 20:58:41 +01:00
Dave Cunningham
1b99719599 Update python to match cpp version 2022-10-27 20:41:44 +01:00
Dave Cunningham
ec039600bc Update version to v0.19.0 v0.19.0 2022-10-26 20:56:31 +01:00
Dave Cunningham
c1825dc54d Update to latest CPP version 2022-10-26 16:13:21 +01:00
Angus Lees
3f664d81b3 Add a CI test that exercises bazel builds
If it's not tested, then it doesn't work.  Add a CI test that
executes `bazel build //...` and `bazel test //...`, in addition to
the non-bazel build system.
2022-10-26 13:51:42 +01:00
Angus Lees
0a32b8c327 Fix //c-bindings bazel build
Add missing bazel dependency so `bazel build //c-bindings` works again.
2022-10-26 13:03:12 +01:00
Angus Lees
e33730a31e Fix jsonnet-lint bazel build
Update BUILD.bazel files so `bazel build //cmd/jsonnet-lint` works
again.
2022-10-26 13:02:57 +01:00
Angus Lees
aa9d35a814 Fix bazel builds on recent macOS
Update `golang.org/x/sys` package to address golang/go#51706

Update bazel `rules_go` to address bazelbuild/rules_go#3199
2022-10-26 13:02:42 +01:00
Angus Lees
eaf78af502 Update cpp-jsonnet reference to match git submodule version
Unlike naive `go build`, bazel builds generate `astgen/stdast.go` on
the fly from cpp_jsonnet's stdlib.  Cool.

Previously however, the cpp_jsonnet versions in git submodule (used by
naive `go build`) and bazel `http_archive` declarations were not in
sync.  Not so cool.

This meant `bazel test //:go_default_test` failed on
`TestEval/testdata/stdlib_smoke_test`, since the stale bazel
cpp_jsonnet version lacked `std.get`.

This PR updates cpp-jsonnet to match git submodule version.
2022-10-26 11:26:50 +01:00
Angus Lees
69137c91b6 Update bazel cpp_jsonnet reference from update_cpp_jsonnet.sh
Teach `update_cpp_jsonnet.sh` to update the cpp_jsonnet reference in
`bazel/repositories.bzl` too.
2022-10-26 11:26:50 +01:00
Jayme Bird
3aab052ecc fix: use rune for length over string 2022-10-25 19:30:01 +01:00
Dave Cunningham
03df4dc6e9 Revert "Don't pass version to go_register_toolchains() by default"
This reverts commit c17729a921d76a1dcdb48bae5d6ebbb9fb0f6965.
2022-10-25 19:29:45 +01:00
Jayme Bird
62dbb64d72 feat: add builtin implementation test coverage 2022-10-25 16:22:34 +01:00
Jayme Bird
c7dc1bac16 feat: add benchmark data for builtin implementations 2022-10-25 16:22:34 +01:00
Jayme Bird
59e5a7be3f feat: add builtin stripChars go impl 2022-10-25 16:22:34 +01:00
Jayme Bird
dbe6fa55d8 feat: add builtin rStripChars go impl 2022-10-25 16:22:34 +01:00
Jayme Bird
bb0d8a9d2a feat: add builtin lStripChars go impl 2022-10-25 16:22:34 +01:00
Jayme Bird
c8492297df feat: add builtin member go impl 2022-10-25 16:22:34 +01:00
zuiwuchang
b835910677 fix FileImporter not work on windows 2022-10-25 16:21:22 +01:00
Gustaf Lindstedt
c17729a921 Don't pass version to go_register_toolchains() by default
It is disallowed to pass the version parameter if a toolchain has
already been registered.
2022-10-25 14:16:05 +01:00
mikehoyle
eac7db4471 c-bindings: Add jsonnet_realloc export
This adds the realloc function as an export in c-bindings.go so
that it is included in the generated header and can be used by
dependent libraries.
2022-10-21 17:55:35 +01:00
jaymebrd
635d04f264
feat: add support linter std get (#627)
* feat: add missing linter metadata for std.get

* feat: add tests cases for std.get linter with default and optional parameters
2022-10-19 06:19:49 +01:00
Jesse
2655afd2bd
memory align structs (#635)
feat: align most structs and add lint rule to enforce struct alignment
2022-10-19 06:19:15 +01:00
Jayme Bird
8abb4aa639 feat: implementation of manifestTomlEx in Go
Co-authored-by: Wojciech Kocjan <wojciech@kocjan.org>
2022-10-19 04:50:41 +01:00
Josh Santos
6033db5d6a Bump golang.org/x/sys again 2022-10-19 04:22:51 +01:00
Jesse-Cameron
f346241c98 fix: remove go 1.13 → 1.16 as it's incompatible with sys
according to maintainers, they only support the two latest versions:
https://github.com/golang/go/issues/55078#issuecomment-1247321657
2022-10-19 04:22:05 +01:00
Jesse-Cameron
b82fd4c7f5 fix: calculate the number of elements after we convert to a slice 2022-09-27 21:46:37 +01:00
Jesse-Cameron
02194a7f8c chore: update golden tests for fold 2022-09-27 21:46:37 +01:00
Jesse-Cameron
e9a59202cf perf: use native builtin for foldl and foldr
benchmark                                 old ns/op      new ns/op      delta
Benchmark_Builtin_substr-8                17914126       16328579       -8.85%
Benchmark_Builtin_reverse-8               360776847      346691957      -3.90%
Benchmark_Builtin_parseInt-8              8686867        8314151        -4.29%
Benchmark_Builtin_base64Decode-8          22157223       21749268       -1.84%
Benchmark_Builtin_base64DecodeBytes-8     281975629      281841745      -0.05%
Benchmark_Builtin_base64-8                23824149       23716470       -0.45%
Benchmark_Builtin_base64_byte_array-8     141846327      141377054      -0.33%
Benchmark_Builtin_manifestJsonEx-8        9317781        9279067        -0.42%
Benchmark_Builtin_comparison-8            128783954      128362069      -0.33%
Benchmark_Builtin_comparison2-8           2082396660     2029123362     -2.56%
Benchmark_Builtin_foldl-8                 159908963      31278937       -80.44%
2022-09-27 21:46:37 +01:00
Jesse-Cameron
953327b03c feat(test): add foldl benchmark test 2022-09-27 21:46:37 +01:00
Jesse-Cameron
c450a168d4 perf: add size hint to map creation
in order to avoid unnecessary hashmap resizing, add size parameters when
creating maps
2022-09-16 18:26:18 +01:00
Jayme Bird
cb3a759621 feat: add linter testdata 2022-09-04 15:59:03 +01:00
Jayme Bird
5440cc833f feat: add test data 2022-09-04 15:59:03 +01:00
Jayme Bird
6e180a9368 feat: add go implementation of std.parseInt 2022-09-04 15:59:03 +01:00
Moulick Aggarwal
4906958414 Bump golang.org/x/sys 2022-08-18 22:32:51 +01:00
Jayme Bird
a5ddc1c5a4 feat: add support to the jsonnet linter for std.manifestJsonMinified 2022-08-18 22:23:43 +01:00
Rudo Thomas
b42132a7a3 feat: Report native function panics as runtime errors.
Previously, you'd get an "INTERNAL ERROR: (CRASH)" with a full backtrace
and a link to file a bug against go-jsonnet.
2022-07-03 21:39:29 +01:00
Erik Godding Boye
32b292c9cb Bump dependency to fatih/color 2022-05-25 11:43:43 +01:00
Tsuyoshi Hombashi
944900af83 Add maintainer info to a deb package of jsonnetfmt 2022-05-24 20:08:28 +01:00
Dave Cunningham
57d2b0517e Remove Go 1.12 as it seems incompatible with new x/sys 2022-05-24 20:02:38 +01:00
Dave Cunningham
7032dd729f Upgrade x/sys 2022-05-24 20:02:38 +01:00
Dave Cunningham
44ec256189 Fix wasm 2022-05-24 19:53:19 +01:00
Jack Dockerty
9e9321f69a add non-negative check in second parameter for subStr 2022-03-18 02:06:06 +00:00