Add a rough draft of a guide to the new go/ast and go/types APIs
introduced with Go 1.18, including explanation of how the
x/exp/typeparams package helps bridge gaps.
For golang/go#50447
Change-Id: I2a5f9a5f0801a71466a4faa3e42efca75b3c7d3c
Reviewed-on: https://go-review.googlesource.com/c/exp/+/388274
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
The map type argument for the generic function Equal cannot
be inferred from an untyped nil function argument. Provide
a typed nil instead.
Fixesgolang/go#51438.
Change-Id: Icf32bb2d66fbb26706e81f1322245b14390741a1
Reviewed-on: https://go-review.googlesource.com/c/exp/+/389374
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This is a documentation-only change.
Change-Id: Ic7847471543468f148498785cdb0b1998e1f53b5
Reviewed-on: https://go-review.googlesource.com/c/exp/+/387154
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Eli Bendersky <eliben@golang.org>
By changing LockedSource.src from a pointer to a value its zero value
becomes usable without panics.
Document this behavior and add an example. Notably, it is not simply a
Source protected by a sync.Mutex, as Rand also type-asserts on it for
efficiency.
Fixesgolang/go#49342
Change-Id: Iec00766957229b7c67ede37894c9e5b9d6d8f852
Reviewed-on: https://go-review.googlesource.com/c/exp/+/385094
Reviewed-by: Rob Pike <r@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Clean up dependencies after moving shiny, event, and jsonrpc2 to
separate modules.
For golang/go#37175
Change-Id: Ie72d0eb4b99a625f41615d6ce3bb5c8935eb11c4
Reviewed-on: https://go-review.googlesource.com/c/exp/+/386795
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Now that we've commited CL 358814 putting x/exp/event in its own module,
we can remove the replace directive here and just use the new module.
Change-Id: I707efb1a14c33a01f5283bbe3de814212a755ad7
Reviewed-on: https://go-review.googlesource.com/c/exp/+/386554
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
This allows trybots to be our CI system.
See the similar setup in x/vuln and x/vulndb.
Fixesgolang/go#50467.
Change-Id: I3d339101f999846979aac580fe93555f906609be
Reviewed-on: https://go-review.googlesource.com/c/exp/+/386199
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Use a replace directive for jsonrpc2 temporarily. After x/exp/event is
available, the replace directive can be removed.
Change-Id: If8486bbe111a33a0ff7140105f30e4696fe2a1e9
Reviewed-on: https://go-review.googlesource.com/c/exp/+/385814
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Add a new module for use by tool authors that need operate on generic
code, while still building at older Go versions.
This module API proxies the Go 1.18 API for type parameters, providing
stubs at earlier Go versions. It also contains some common helpers to
supplement the go/types API.
For golang/go#50447
Change-Id: I97feb834eb2da646620f8377904520b511871915
Reviewed-on: https://go-review.googlesource.com/c/exp/+/383375
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Trust: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The top-level internal directory is only used by jsonrpc2.
Move it into jsonrpc2 so that jsonrpc2 can become its own module.
Change-Id: I8c0fad6b2f343e9abfa9b5397403aa58cb9a0005
Reviewed-on: https://go-review.googlesource.com/c/exp/+/383314
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
The shiny package is not related to other exp packages.
Put it in a separate module.
This package uses a modified copy of github.com/BurntSushi/xgb.
Move that out of the vendor directory, so that current go commands work.
For golang/go#37175
Change-Id: Ib3bad0823d2651ff90a9651e405ed7bcd9de94b6
Reviewed-on: https://go-review.googlesource.com/c/exp/+/383197
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Trust: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
The CL adds API for traversal of call graph in search of call stacks
that can serve as witnesses for uses of vulnerable symbols.
Change-Id: Ib45c5c6aad347e1bcecb39ca4a62f589b4766677
Reviewed-on: https://go-review.googlesource.com/c/exp/+/381777
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Add an event handler for OpenTelemetry metrics.
The first time it sees an event.Metric, the handler creates a matching
otel instrument and caches it. On each call, it uses the instrument to
record the metric value.
Change-Id: I07d6f40601c7d2a801ed9fbe3cf7c24d5698f3f1
Reviewed-on: https://go-review.googlesource.com/c/exp/+/320350
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Move to exp from the pre-1.18 standard library.
For golang/go#45458
For golang/go#50792
Change-Id: I70f054c9d68c20e98e750f6501f3eabd04a70f17
Reviewed-on: https://go-review.googlesource.com/c/exp/+/382535
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
It is a little tricky to get right and is useful outside
of the package.
Change-Id: I8b41aa38ad2982fa7848170b0a880372a27bacca
Reviewed-on: https://go-review.googlesource.com/c/exp/+/380435
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
The added data structures are based on the internal discussion and
proposed design document.
Change-Id: I07c3c8fdfcd74d7642e32d8201f1850c48375202
Reviewed-on: https://go-review.googlesource.com/c/exp/+/379574
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Implements golang/go#47619 in the exp/slices package as a
testing ground prior to inclusion in the standard library.
Relies on the modified sorting function code generator proposed
in https://go-review.googlesource.com/c/go/+/353069 to
automatically generate the code of the sorting functions.
Benchmark comparing sort.Ints with the generic Sort function
added in this CL to sort a slice of int:
name old time/op new time/op delta
Sort-8 12.0ms ± 1% 6.5ms ± 1% -46.02% (p=0.000 n=9+10)
Benchmark comparing sort.Sort with SortFunc to sort a slice of
struct pointers based on one field in the struct:
name old time/op new time/op delta
SortStructs-8 18.6ms ± 2% 15.9ms ± 3% -14.43% (p=0.000 n=10+10)
Change-Id: Ic301aae7e5b8f99144e39b8a77fde897779588ed
Reviewed-on: https://go-review.googlesource.com/c/exp/+/378134
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cody Oss <codyoss@google.com>
Trust: Jeremy Faller <jeremy@golang.org>
Although it does an additional index operation, but it avoids the value copy of the range loop,
and it will has a better performance if E is a large structure.
Compares two int slices, the slices length are 10:
name old time/op new time/op delta
Equal_WithIntSlices 5.80ns ± 0% 5.80ns ± 1% ~ (p=0.889 n=14+15)
Compares two string slices, the slices length are 10:
name old time/op new time/op delta
Equal_WithStringSlices 17.6ns ± 1% 16.6ns ± 0% -5.61% (p=0.000 n=15+15)
Compares two runtime.MemStats slices, the slices length are 10:
name old time/op new time/op delta
Equal_WithLagerStructSlices 4.46µs ± 0% 1.53µs ± 1% -65.67% (p=0.000 n=15+15)
Change-Id: I654b4fd4d7c6c3e233e8ee963e0c510e185d398b
GitHub-Last-Rev: 274949314f
GitHub-Pull-Request: golang/exp#24
Reviewed-on: https://go-review.googlesource.com/c/exp/+/373394
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Change the behavior of txtar so that files are extracted only in the
current directory, or a subdirectory of the current directory, by
default.
If the archive contains a path outside the current directory, txtar will
print an error message and quit with exit code 1. It will not extract
any files in this case. This also applies if an environment variable
used in the archive expands into a path outside the current directory.
Add flag -unsafe to remove the restriction and allow extracting files
outside the current dir.
Updates golang/go#46741
Change-Id: Ic12fb8286c5f2a930addd82dcfce196d4a04054c
Reviewed-on: https://go-review.googlesource.com/c/exp/+/371274
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The change also introduces a small fix to an issue related to entry
points.
Change-Id: Id571a31cc86e9129d9fd2392211f1199720eda1d
Reviewed-on: https://go-review.googlesource.com/c/exp/+/371774
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Some vulnerabilities have an empty slice for the osv.Entry Symbols
field, meaning every symbol is vulnerable. This CL adds support for such
vulnerabilities by doing the following, when an import of the
corresponding packages is seen, we list every top-level method and
function of that package and add it as a Vuln in vulncheck.Result.
Change-Id: I0edac51f7e3923ecfd3f203db80e6f7d22272dd2
Reviewed-on: https://go-review.googlesource.com/c/exp/+/371254
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
If a module had empty Dir, we would consider it a valid local dir. This
resulted in skipping loading of such modules, which is incorrect.
Change-Id: I71e965b521387d184bf790398ddacf05ef10ab65
Reviewed-on: https://go-review.googlesource.com/c/exp/+/370934
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
packages.Package can consume a lot of memory for some clients,
so we use its trimmed version vulncheck.Packages instead.
Change-Id: I2f1b50bbc101fdf6aaf49271d51f41cdf4be5cc1
Reviewed-on: https://go-review.googlesource.com/c/exp/+/369135
Reviewed-by: Julie Qiu <julie@golang.org>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
This change introduces vulncheck.Package representation of input
packages and adds conversion API from packages.Package.
This change will be followed by a change that replaces uses of
packages.Package with those of vulncheck.Package.
Change-Id: I4e72bc8e934ebca86d3039ae27ae05820b73d9d6
Reviewed-on: https://go-review.googlesource.com/c/exp/+/369134
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
This allows to correctly filter vulnerabilities for the analysis
beyond the host platform.
Change-Id: I57003d4ccf77cde6a1064ec9c28c6fc31ae48d5d
Reviewed-on: https://go-review.googlesource.com/c/exp/+/366374
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Change-Id: I3d1b59304b18d730dee148142cf1286a26f9da18
Reviewed-on: https://go-review.googlesource.com/c/exp/+/365594
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Fixesgolang/go#49698
Change-Id: I62e25f11695d2a2729588dbb559ec6e144beb5a2
Reviewed-on: https://go-review.googlesource.com/c/exp/+/365575
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
For golang/go#47649
Change-Id: I49c9b1aab0e2204bde7b7e21d68130551118bf92
Reviewed-on: https://go-review.googlesource.com/c/exp/+/364875
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
The binscan package has been mostly copied from internal/audit. The only
change is to use io.ReaderAt as a input binary instead of a file path.
Change-Id: I883139796121bd1d18a6fd828216ff5a36e01421
Reviewed-on: https://go-review.googlesource.com/c/exp/+/363013
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
APIs for accessing data from the Go Vulnerability Database were moved
to a separate repo golang.org/x/vuln.
And the client interface was changed, so this CL updates the references.
Change-Id: I46831ca757ada6122332c7d1dd7c4762e5278597
Reviewed-on: https://go-review.googlesource.com/c/exp/+/364857
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Fixesgolang/go#49660
Change-Id: I2bc371fed2193293509573d8994c94775edcf25e
Reviewed-on: https://go-review.googlesource.com/c/exp/+/365174
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Update the go version in go.mod to go1.18 so that generics are permitted.
For golang/go#45955
Change-Id: Id5ab52d38c465313c27506008aece9356d34e3c9
Reviewed-on: https://go-review.googlesource.com/c/exp/+/363434
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>