instance_id stringlengths 10 65 | repo stringlengths 5 59 | pr_number int64 1 313k | task_type stringclasses 1
value | base_commit stringlengths 40 40 | review_commit stringlengths 40 40 | title stringlengths 2 282 | body stringlengths 7 3k | patch stringlengths 202 204k | n_defects int64 1 72 | n_supported int64 1 65 | n_major int64 0 32 | defects stringlengths 140 18.8k | certifier_count int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u-root__u-root__3379 | u-root/u-root | 3,379 | defect | eab425a6f6067029a99f9fe1c64da91876329abb | f59e67f6a3a0ba2d68b534a2a3e7a6742473b203 | integration/generic: add traceroute | Add integration tests for traceroute
TODO:
- [x] IPv4
- [x] TCP
- [x] UDP
- [x] ICMP
- [x] IPv6
- [x] TCP
- [x] UDP
- [x] ICMP | diff --git a/cmds/exp/traceroute/main.go b/cmds/exp/traceroute/main.go
index 58a6178e3e0..47ae27764f8 100644
--- a/cmds/exp/traceroute/main.go
+++ b/cmds/exp/traceroute/main.go
@@ -52,6 +52,7 @@ func parseFlags(args []string) (*traceroute.Flags, error) {
}
trargs.Host = leftoverArgs[0]
+
flags.Host = trargs.Hos... | 4 | 3 | 1 | [{"id": "G0", "claim": "The unchecked type assertion addr.(*net.IPNet) before the type switch can panic if addr is a *net.IPAddr; do the type switch first and inspect IP.To4() only for *net.IPNet before skipping IPv4 addresses.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"... | null |
u-root__u-root__3380 | u-root/u-root | 3,380 | defect | b6b92bcacd9d77f8fa7f1d6a12580ff4e3fe229a | 920d27cb3512c01ca83213a757fd86c1926c22a3 | Ip tunnel integration test | This PR adds the IP tunnel subcommand to the IP integration test.
It also contains some fixes and extensions of the cmd itself. | diff --git a/cmds/core/ip/tunnel_linux.go b/cmds/core/ip/tunnel_linux.go
index 9fb19176ca5..89e3d50d9ed 100644
--- a/cmds/core/ip/tunnel_linux.go
+++ b/cmds/core/ip/tunnel_linux.go
@@ -14,10 +14,10 @@ import (
)
const (
- tunnelHelp = `Usage: ip tunnel { show } [ NAME ]
+ tunnelHelp = `Usage: ip tunnel { show | add... | 4 | 2 | 0 | [{"id": "G0", "claim": "The mode string 'any' printed for *netlink.Iptun tunnels may be ambiguous; consider using a more descriptive and consistent mode name.", "category": "maintainability", "verdict": "uncertain", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "Initializing 'valid' to false in tunnel... | null |
u-root__u-root__3409 | u-root/u-root | 3,409 | defect | 0dfc9477012ade4ecc366b93f2fa6af4c446d815 | 3fda59b41e80dd273c85ca625975ae1acf17f4e2 | cmds/core/backoff: fix 30s default timeout | Use time.Duration instead of string, fix documentation, remove parsing test that are no longer needed, rename files according to other u-root commands, make verbose false by default to match documentation. | diff --git a/cmds/core/backoff/main.go b/cmds/core/backoff/backoff.go
similarity index 54%
rename from cmds/core/backoff/main.go
rename to cmds/core/backoff/backoff.go
index 60c4a50a03..9278f9dfd3 100644
--- a/cmds/core/backoff/main.go
+++ b/cmds/core/backoff/backoff.go
@@ -1,4 +1,4 @@
-// Copyright 2012-2021 the u-roo... | 2 | 1 | 0 | [{"id": "G0", "claim": "While on this code, it would make sense to also bump the cenkalti/backoff dependency from v4 to the newest version v5.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "pre_existing"}, {"id": "G1", "claim": "The doc-comment example was changed from '$ backoff -... | null |
u-root__u-root__3429 | u-root/u-root | 3,429 | defect | 89ecf12d328d2d7f135ecc943269e029a403ab27 | 3b1a1c8ed6155393bcbd5a1fe382ada2bfc3f5c1 | kmodule: insert independent modules in parallel (Fixes #3424) | This can be used to speed up boot if there's some modules that take a long time (e.g. probing hardware, etc.).
Probe() et. al. are concurrent unsafe since they create independent depMaps, and may in turn end up calling loadModule for the same module at once. This is wasteful since we'll load the images multiple time... | diff --git a/pkg/kmodule/kmodule_linux.go b/pkg/kmodule/kmodule_linux.go
index ca099340145..0b644d0ba00 100644
--- a/pkg/kmodule/kmodule_linux.go
+++ b/pkg/kmodule/kmodule_linux.go
@@ -16,8 +16,10 @@ import (
"path"
"path/filepath"
"strings"
+ "sync"
"golang.org/x/sys/unix"
+ "golang.org/x/sync/errgroup"
)
... | 7 | 5 | 2 | [{"id": "G0", "claim": "The comment on parallelProbeDep misspells the possessive, writing \"it's dependencies\" instead of \"its dependencies\".", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "There is no stated guarantee that concurrent access to ... | null |
u-root__u-root__3437 | u-root/u-root | 3,437 | defect | 58474a921df18949b97abf0de0a3b030d5fb2013 | 8219460ee9d8b59c596c7f6c5c255cf182f6b885 | fix(coreutils): adjustments to `chmod` and `gzip` | This PR fixes some inconsistency in `chmod` and `gzip` compared to the other implementations. Found because I needed special handling for these core utils [here](https://github.com/mvdan/sh/blob/10c1e4af0f4e6b2497c2344d5507f923de0f6592/moreinterp/coreutils/coreutils_test.go#L42-L55). With this PR merged, I'll be remove... | diff --git a/cmds/core/gzip/gzip.go b/cmds/core/gzip/gzip.go
index f2f0ab0b1a5..4133e60b078 100644
--- a/cmds/core/gzip/gzip.go
+++ b/cmds/core/gzip/gzip.go
@@ -14,7 +14,7 @@ import (
func main() {
cmd := gzip.New()
- if err := cmd.Run(os.Args...); err != nil {
+ if err := cmd.Run(os.Args[1:]...); err != nil {
... | 1 | 1 | 1 | [{"id": "G0", "claim": "Hardcoding the command name in the gzip package (the usage output printing a fixed \"gzip\" and the cmd field being hardwired to \"gzcat\" in NewGzcat) makes the package inconsistent when it is used from a command that is not named that way; the name should come from the actual program name inst... | null |
u-root__u-root__3454 | u-root/u-root | 3,454 | defect | 781bbef37950ffe6f5ff2128e94bfd9cf846e16f | 3fcca2b1d70733ddae2d5d3a065000f9d4376d5b | ip_linux test using the cpu command | This is an implementation that is equivalent to the ip test in integration. It does not use a shell script. It tests on amd64, arm, arm64, and risc-v.
It's easy to run locally and should be faster.
To run it locally,
go test -test.run IP
in this directory. | diff --git a/integration/generic-tests-cpu/ip_linux_test.go b/integration/generic-tests-cpu/ip_linux_test.go
new file mode 100644
index 00000000000..d6fbeddef18
--- /dev/null
+++ b/integration/generic-tests-cpu/ip_linux_test.go
@@ -0,0 +1,428 @@
+// Copyright 2025 the u-root Authors. All rights reserved
+// Use of this... | 8 | 7 | 2 | [{"id": "G0", "claim": "Remove the leftover debugging marker lines 'HEREr'/'HERE' and 'DONE' from the embedded test script.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The tunnel tests expect IP addresses to be excluded from fib_trie after th... | null |
u-root__u-root__3456 | u-root/u-root | 3,456 | defect | 90d648519e2a25ab01a5d6b4620ff6a700433d56 | 3ab4f5c50a7da29bb52d224be5b59fddc4f0db3d | Enable UniveralPayload solution in Github CI | The boot flow of UniversalPayload solution for real production should be:
EDK2 UEFI -> Linuxboot (kernel) -> UniversalPayload (integrated in u-root) -> Target OS
In order to cover whole boot flow of UniversalPayload, we need to switch to following boot flow:
EDK2 OVMF -> Linuxboot (kernel) -> UniversalPayload (in... | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 8deed868b1e..d064b89849a 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -35,6 +35,11 @@ jobs:
vmarch: 'amd64'
pattern: '.'
+ # Only run UPL ARM64 test with VM arch arm64 for n... | 4 | 3 | 1 | [{"id": "G0", "claim": "Remove the unnecessary else blocks after every Skipf call, assigning the variable directly in the if statement instead.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The os.Stat checks skip only on IsNotExist, so any oth... | null |
u-root__u-root__3477 | u-root/u-root | 3,477 | defect | 2f8c7e763cf82670c7953219d1b5b983188afa41 | dd11c04e816223bbdb40f6548c20a88a11a48e77 | Add the builtin package, with a forth example | The builtin package is an proposal to
implementing command builtins. The core idea is
that a package can be used as a builtin, without
using the gobusybox.
It is only for special circumstances where use of the gobusybox is not practical.
Gobusybox remains the preferred approach, since it can incorporate arbitr... | diff --git a/pkg/builtin/builtin.go b/pkg/builtin/builtin.go
new file mode 100644
index 0000000000..58d6ca852d
--- /dev/null
+++ b/pkg/builtin/builtin.go
@@ -0,0 +1,45 @@
+// Copyright 2025 the u-root Authors. All rights reserved
+// Use of this source code is governed by a BSD-style
+// license that can be found in th... | 13 | 11 | 1 | [{"id": "G0", "claim": "The Run-method doc comment misspells \"users\" as \"uses\" (\"With the returned struct, uses can call the Run method\").", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "Command assigns the same buffer to both Stdout and Stde... | null |
u-root__u-root__3478 | u-root/u-root | 3,478 | defect | 2f8c7e763cf82670c7953219d1b5b983188afa41 | 0c40e64b84766543ad8ff8bc080b49cc053cc8e0 | tools/testramfs: upgrade to use VMs | The testramfs tool was of limited usefulness, as it only worked on the host architecture
The command now uses the "github.com/u-root/cpu/vm", which provides pre-built kernels and initramfs with cpud built in.
Testramfs has one required argument, which is the directory in which to run u-root; and optional argument... | diff --git a/tools/testramfs/testramfs.go b/tools/testramfs/testramfs.go
index f0467918aa..7e62a4b208 100644
--- a/tools/testramfs/testramfs.go
+++ b/tools/testramfs/testramfs.go
@@ -2,152 +2,79 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// testramfs ... | 6 | 5 | 1 | [{"id": "G0", "claim": "The comment 'not working on mac right now; qemu issue?' contradicts the PR description's claim of 'Tested on OSX so far', creating confusion about platform support.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The variabl... | null |
u-root__u-root__3490 | u-root/u-root | 3,490 | defect | 0be682ef7f03646bda8efa145db53aab9139bc54 | 2729de37fcf7549209be85981d83d577fe510da1 | uefivars: Add boot option parsing for MBR disks | This change adds FilterMBRSig to blockdev to find devices matching a given MBR signature. It also implements the UEFI boot option parsing for SigType 1, which uses the MBR signature and partition number to identify the boot device. Test cases are added for FilterMBRSig. | diff --git a/pkg/mount/block/blockdev_linux.go b/pkg/mount/block/blockdev_linux.go
index b3a7f6f5aa..a730da9cea 100644
--- a/pkg/mount/block/blockdev_linux.go
+++ b/pkg/mount/block/blockdev_linux.go
@@ -21,6 +21,7 @@ import (
"github.com/rekby/gpt"
"github.com/u-root/u-root/pkg/mount"
+ urgpt "github.com/u-root/u... | 7 | 7 | 1 | [{"id": "G0", "claim": "The hard-coded 0x55,0xaa MBR format signature literal should be defined as a named global constant.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The check `len(pt.MasterBootRecord) < 512` should require the MBR to be ex... | null |
u-root__u-root__3492 | u-root/u-root | 3,492 | defect | 0be682ef7f03646bda8efa145db53aab9139bc54 | e633394988df908b18edd3e3c854248be8675421 | pkg/boot/linux: support PEZ-formatted images on arm64 | On arm64, some Linux distros (such as Fedora) use PE-compressed Linux images (vmlinuz). This requires userspace to extract the raw Image from the vmlinuz file before calling kexec_file_load.
Add an extra step to loadImage(): on arm64, attempt to extract the raw Image from the vmlinuz. If extraction fails, ignore the... | diff --git a/pkg/boot/linux.go b/pkg/boot/linux.go
index cc0f64b8da..85df522ca5 100644
--- a/pkg/boot/linux.go
+++ b/pkg/boot/linux.go
@@ -9,10 +9,12 @@ import (
"fmt"
"io"
"os"
+ "runtime"
"strings"
"github.com/u-root/u-root/pkg/boot/kexec"
"github.com/u-root/u-root/pkg/boot/linux"
+ "github.com/u-root/u... | 7 | 5 | 0 | [{"id": "G0", "claim": "The unsupported-compression error should be formatted with the compression value first and the sentinel error last, and should say which compression types are supported.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The ... | null |
u-root__u-root__3532 | u-root/u-root | 3,532 | defect | 8f81f73513f36722b33b7d8352208e03d40003ac | cd256fe7be60f8b6d8815a29b0cded5b2234a354 | gosh: make completer_liner the default | bubbline has caused lots of issues for non-Linux, non-standard environments such as embedded platforms.
This change makes completer_liner, a far simpler UI, the default.
I'd actually rather remove bubbline completely, it's huge, hard to work with (it forks at least one other package and then puts it in internal/,... | diff --git a/cmds/core/gosh/completer.go b/cmds/core/gosh/completer.go
index 5944ff4341..e5914b302f 100644
--- a/cmds/core/gosh/completer.go
+++ b/cmds/core/gosh/completer.go
@@ -2,83 +2,25 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build (!tinyg... | 4 | 2 | 2 | [{"id": "G0", "claim": "The package no longer compiles because the pull request removed the `completion` flag and `HistFile` declarations while code still references them.", "category": "correctness", "verdict": "supported", "priority": "P0", "scope": "introduced"}, {"id": "G1", "claim": "gosh would be much simpler if ... | null |
u-root__u-root__945 | u-root/u-root | 945 | defect | ba9b0699af820ee1a30edbb6c7d1ade3cf62532f | 7945245f80ecb22704fa4e57f29aebbeff74157b | mv: Add update switch | This pull request adds the `-u` switch which only moves files if the source is newer than the destination.
The existing tests that were there are pretty useless, they only check that there is no error. Those could be improved as well. The best case would be some declarative tests that describe how the file system an... | diff --git a/cmds/mv/mv.go b/cmds/mv/mv.go
index 5f7a0acd3e..7f734a8699 100644
--- a/cmds/mv/mv.go
+++ b/cmds/mv/mv.go
@@ -1,4 +1,4 @@
-// Copyright 2012-2017 the u-root Authors. All rights reserved
+// Copyright 2012-2018 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
/... | 7 | 5 | 1 | [{"id": "G0", "claim": "The doc string at the top of cmds/mv/mv.go (lines 5-12) should be updated to also document the new -u option.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The moveFile call and its error check should be written on one lin... | null |
uPortal-Project__uPortal__1006 | uPortal-Project/uPortal | 1,006 | defect | 50688ed60e9334294b38f9153ff5bde57de519f5 | f955b5800b096a0fc494d38d35f98795da70d90f | UP-4930: Moved over changes from PR#994 to clean branch | https://issues.jasig.org/browse/UP-4930
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should be reported on the issue tracker: https://issues.jasig.org/browse/UP/
Contributors guide: https://github.com/Jasig/uPortal/blob/master/CONTRIBUTING.md
-->
#####... | diff --git a/docs/README.md b/docs/README.md
index 3282bd85797..c8e880cc2d4 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -155,6 +155,7 @@ below.
* [Building / Deploying uPortal](building-and-deploying-uportal.md)
* [Implementing uPortal](implement/README.md)
+* [uPortal System Administration](sysadmin/README... | 8 | 7 | 2 | [{"id": "G0", "claim": "The new Portlet Setup how-to documentation is brittle, likely to become incorrect as the platform evolves, and a massive undertaking the project probably lacks bandwidth to maintain, so the UI should be made intuitive instead.", "category": "documentation", "verdict": "supported", "priority": "P... | null |
uPortal-Project__uPortal__1319 | uPortal-Project/uPortal | 1,319 | defect | f4ac2448fbb980a984317d86d874dae5a90375be | d627b3704289e06b105bd92f5bf830a67e56faef | feat: Adding Missing User Attribute pags | <!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should be reported on the issue tracker: https://github.com/Jasig/uPortal/issues
Contributors guide: https://github.com/Jasig/uPortal/blob/master/CONTRIBUTING.md
-->
##### Checklist
<!-- Remove items that do n... | diff --git a/uPortal-groups/uPortal-groups-pags/src/main/java/org/apereo/portal/groups/pags/dao/EntityPersonAttributesGroupStore.java b/uPortal-groups/uPortal-groups-pags/src/main/java/org/apereo/portal/groups/pags/dao/EntityPersonAttributesGroupStore.java
index 396298c495c..6f97ae4b450 100644
--- a/uPortal-groups/uPor... | 2 | 1 | 0 | [{"id": "G0", "claim": "The test() body should be simplified to `return atts == null || atts.length < 1` instead of the if-block.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "The `@since 5.2` Javadoc comment should be moved onto the class rath... | null |
uPortal-Project__uPortal__1504 | uPortal-Project/uPortal | 1,504 | defect | 661b2d2d1cefc8e0d64aaaaf1c93d5d26b4a97eb | f98603bbe34037dee6d02c3884563a4e87c83b05 | feat: add a new REST API ('/v5-5/assignments/users/{username}') to Pe… | …rmissionsRESTController that returns permissions assignments based on a username
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should be reported on the issue tracker: https://github.com/Jasig/uPortal/issues
Contributors guide: https://github.com/Jasig/uPo... | diff --git a/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/layout/dlm/remoting/GroupListHelperImpl.java b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/layout/dlm/remoting/GroupListHelperImpl.java
index a2e81b07038..4d4d08af8e6 100644
--- a/uPortal-api/uPortal-api-internal/src/main... | 1 | 1 | 1 | [{"id": "G0", "claim": "Since the API appears user-focused, the new endpoint's URL should arguably be /v5-5/users/{username}/assignments rather than /v5-5/assignments/users/{username}.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
uPortal-Project__uPortal__1954 | uPortal-Project/uPortal | 1,954 | defect | 5d04fe27064f9b0a17e5eccee9947003d721e0e5 | 873c42f4e0268aefa6bc4f1ff587d78235f2e329 | feat(user-attr-json): Add user attributes via tokens to portlet in la… | …youtDoc api
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should be reported on the issue tracker: https://github.com/Jasig/uPortal/issues
Contributors guide: https://github.com/Jasig/uPortal/blob/master/CONTRIBUTING.md
-->
##### Checklist
<!-- Remove... | diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 1b16c34a71c..4bfb7ee1cbe 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,6 @@
+#Mon Feb 10 14:13:40 PST 2020
+distributionUrl=https\://services.gradle.or... | 11 | 10 | 2 | [{"id": "G0", "claim": "The pull request needlessly switches the Gradle wrapper distribution from -bin to -all, an unrelated change the author did not make deliberately, and should revert it.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The ad... | null |
uPortal-Project__uPortal__2801 | uPortal-Project/uPortal | 2,801 | defect | d0a75bc7f898127b25e7f57ace408301d80f00c3 | b86d0096806c9e595902b6583c0920965667d745 | fix/issue-#2800: Fix bug with favorites getting deleted when a favori… | …ted portlet gets deleted and a user subequently favorites another portlet or unfavorites a portlet
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should be reported on the issue tracker: https://github.com/uPortal-Project/uPortal/issues
Contributors guide: ... | diff --git a/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/favorites/FavoritesUtils.java b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/favorites/FavoritesUtils.java
index 83e20c40166..7c30e15308d 100644
--- a/uPortal-api/uPortal-api-internal/src/main/java/org/ap... | 1 | 1 | 0 | [{"id": "G0", "claim": "It would also make sense to add a test for an error case such as a null portlet id passed to addFavorite.", "category": "testing", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
uPortal-Project__uPortal__961 | uPortal-Project/uPortal | 961 | defect | e1c06694423d6e9254dcf8fbc6af6b3e5af56c72 | 172c40957235573befded12f96dc3f779fc9d9b4 | UP-4901- added unit tests for package org.apereo.portal.api.portlet | …dded assert statement to check window state and portletmode
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should be reported on the issue tracker: https://issues.jasig.org/browse/UP/
Contributors guide: https://github.com/Jasig/uPortal/blob/master/CONTRIBU... | diff --git a/uPortal-api/uPortal-api-platform-impl/build.gradle b/uPortal-api/uPortal-api-platform-impl/build.gradle
index 030b977d8bf..a28eca20486 100644
--- a/uPortal-api/uPortal-api-platform-impl/build.gradle
+++ b/uPortal-api/uPortal-api-platform-impl/build.gradle
@@ -7,4 +7,6 @@ dependencies {
compileOnly "... | 2 | 1 | 1 | [{"id": "G0", "claim": "Use of Spring's `Assert` in the DelegateState constructor is questioned: what are its impacts versus a plain null guard conditional, and has Assert usage been discussed for uPortal source (the author later adds they would personally prefer throwing IllegalArgumentException and offers to make tha... | null |
uPortal-Project__uPortal__989 | uPortal-Project/uPortal | 989 | defect | 00d7af05f97673d2787bd794b4378192243c20ba | 73e2efe098896cbcbf4c9b00a9b0f499695c358b | UP-4926: Attempt to prevent absence of 'username' and 'displayName' … | …attributes in collections from Person Directory
https://issues.jasig.org/browse/UP-4926
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should be reported on the issue tracker: https://issues.jasig.org/browse/UP/
Contributors guide: https://github.com/Jas... | diff --git a/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/swapper/AttributeSwapperHelperImpl.java b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/swapper/AttributeSwapperHelperImpl.java
index 03ce1209a15..239e1cf2d21 100644
--- a/uPortal-api/uPortal-api-internal/... | 3 | 3 | 1 | [{"id": "G0", "claim": "Add a `@since 5.0` tag to the new class PortalRootPersonAttributeDao's Javadoc.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The class Javadoc should read \"its best\" instead of the misspelling \"it's best\".", "category... | null |
ua-parser__uap-go__89 | ua-parser/uap-go | 89 | defect | 3a4781585db6719d364e35638acf15745b9f7f91 | 9ebfdd4503a6248665670e60043f84547422a253 | deps: upgraded dependency | There were vulernabilities in older dependencies so I have upgraded it
(GO-2020-0036)
(GO-2021-0061)
(GO-2022-0956)
| diff --git a/go.mod b/go.mod
index 6e90dc6..b192872 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,8 @@
module github.com/ua-parser/uap-go
+go 1.23.1
+
require (
- github.com/hashicorp/golang-lru v0.5.4
- gopkg.in/yaml.v2 v2.2.1
+ github.com/hashicorp/golang-lru v1.0.2
+ gopkg.in/yaml.v3 v3.0.1
)
diff --git a/go.sum ... | 2 | 1 | 1 | [{"id": "G0", "claim": "The dependency upgrades are accepted only provided the project's tests pass, and since the tests are not automated yet the author should run them to verify the upgrade.", "category": "testing", "verdict": "uncertain", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "Setting go 1.... | null |
ua-parser__uap-go__95 | ua-parser/uap-go | 95 | defect | 9c035f085b905a603b688f7e462247d9735e8e43 | f158bc54df6bf8147f52b6ea407aeccdb04ec5bd | Add the ability to configure the parser cache size | The PR introduces the ability to configure the parser cache size. It turns out that the current value (1024) is not always suitable for all use cases and sometimes significantly slows down the parser. Here is a benchmark that shows the problem:
```
BenchmarkParserWithDifferentCacheSize/CacheSize=1024-16 ... | diff --git a/uaparser/benchmark_test.go b/uaparser/benchmark_test.go
index abdfff7..1fc99c1 100644
--- a/uaparser/benchmark_test.go
+++ b/uaparser/benchmark_test.go
@@ -1,12 +1,17 @@
package uaparser
import (
+ "fmt"
"log"
+ "math/rand"
+ "os"
+ "strings"
"testing"
)
var benchedParser *Parser
var benchedPa... | 4 | 4 | 4 | [{"id": "G0", "claim": "Parser configuration values should reach newFromBytes through a shared internal helper taking them as a parameter (the author proposes a Config struct) instead of module-level variables, which are unclean and could suffer a data race if multiple goroutines create parsers at the same time.", "cat... | null |
ua-parser__uap-go__96 | ua-parser/uap-go | 96 | defect | f7f5a2f9f5bc98ca28855de87184abf44cceb571 | c88c537b7dfa315762dcffe4f6c9da1889b21621 | feat!: Introduce New function with functional options pattern | Today, we have separate functions for creating the Parser - `NewFromSaved` for using the built-in yaml definitions, `NewFromBytes` for providing your own regexes as bytes of a yaml file, and `NewWithOptions` for providing a path to a yaml file with various options from the library selected - e.g. configuring the LRU ca... | diff --git a/uaparser/parser.go b/uaparser/parser.go
index 9d617f6..2a78a1d 100644
--- a/uaparser/parser.go
+++ b/uaparser/parser.go
@@ -234,6 +234,10 @@ func New(regexFile string) (*Parser, error) {
}
func NewFromSaved() *Parser {
+ return NewFromSavedWithOptions(defaultParserConfig())
+}
+
+func NewFromSavedWithO... | 3 | 3 | 2 | [{"id": "G0", "claim": "NewFromSavedWithOptions ignores its config parameter and builds the parser with defaultParserConfig() instead, so a caller's custom configuration has no effect.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "As written the PR... | null |
uber-common__jvm-profiler__1 | uber-common/jvm-profiler | 1 | defect | 27c6e3f534a907727347e2d75ef96858ee16cde6 | 229a4ac16470d6f7de57a5c9a5ec0e4386ba0502 | Add YamlConfigProvider | Add ConfigProvider interface and YamlConfigProvider implementation | diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..d3ae3a4
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,5 @@
+language: java
+
+jdk:
+ - oraclejdk8
+ - openjdk8
\ No newline at end of file
diff --git a/NOTICE b/NOTICE
index f7b1b34..eb8e3e5 100644
--- a/NOTICE
+++ b/NOTICE
@@ -27,5 +27,9 @@ This... | 5 | 1 | 0 | [{"id": "G0", "claim": "The new catch-all around config loading in AgentImpl.run should perhaps fail instead of only logging a warning when the config provider throws.", "category": "design", "verdict": "uncertain", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "YamlConfigProvider should try to enforc... | null |
uber-common__jvm-profiler__81 | uber-common/jvm-profiler | 81 | defect | 6dbc2f874621a44a524ab6f9abc5903fe10860f6 | 37a886f27e2047594d8cf09a3f8aa229355fa95d | [Feature] Adding ThreadMXBean information in the profiler #Issue52 | As per the discussion on #52, adding Support for Collecting Some stats related to JVM Threads.
1. A new Profiler called `ThreadInfoProfiler` is added which makes use of `ThreadMXBean` to Collect and report the Stats.
2. Unit Tests for the same are added.
The Metric Looks like the following:
```
ConsoleOutput... | diff --git a/README.md b/README.md
index e065a3e..4e75e6f 100644
--- a/README.md
+++ b/README.md
@@ -87,6 +87,8 @@ Uber JVM Profiler supports following features:
6. Debug IO metrics (disk read/write bytes for the application, CPU iowait for the machine).
+7. Debug JVM Thread Metrics like Count of Total Threads, Pe... | 2 | 2 | 0 | [{"id": "G0", "claim": "The variable totalThreadCount should be renamed to totalStartedThreadCount because that matches the ThreadMXBean method name and is clearer.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "A flag similar to ioProfiling sho... | null |
uber-go__automaxprocs__10 | uber-go/automaxprocs | 10 | defect | 55a48d6c82a4d54171a5920cd96aba4ac7baffed | b2d808b9bb368799ae15fed1b43f250e38620b40 | Minimum GOMAXPROCS should be 1 | We previously set the minimum GOMAXPROCS value to 2 as that was the
minimum allocation we expected internally. However, if the allocation is
actually smaller, we should use lower GOMAXPROCS.
This will also allow us to reduce the allocation size and use a more
appropriate GOMAXPROCS which will reduce the amount of... | diff --git a/internal/runtime/runtime.go b/internal/runtime/runtime.go
index 01ce041..a0b0781 100644
--- a/internal/runtime/runtime.go
+++ b/internal/runtime/runtime.go
@@ -31,6 +31,3 @@ const (
// CPUQuotaMinUsed is return when CPU quota is larger than the min value
CPUQuotaMinUsed
)
-
-// MinGOMAXPROCS defines t... | 1 | 1 | 1 | [{"id": "G0", "claim": "Min(n) with n<1 should either be handled (leaving GOMAXPROCS unchanged, i.e. using the default) or its behaviour should be noted in the docs.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
uber-go__automaxprocs__3 | uber-go/automaxprocs | 3 | defect | 346f2ebcc84cf260659b509d6848d753e76b2bf1 | 86f5e75c8382585e2550454c99a604bd7eb631c0 | Make exported API more flexible | The current package API is both rigid and difficult to test; in general,
we should avoid exposing complex functionality *only* via import-time
side-effects.
This PR refactors the package API to be more testable and flexible, and
then adds a code sample to the README, some testable examples, and
enough tests to g... | diff --git a/README.md b/README.md
index 6f92777..6ad7401 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,25 @@ Set `GOMAXPROCS` to match container CPU quota.
`go get -u go.uber.org/automaxprocs`
+## Quick Start
+
+```go
+import (
+ "log"
+
+ "go.uber.org/automaxprocs"
+)
+
+func main() {
+ undo, err := autom... | 3 | 3 | 1 | [{"id": "G0", "claim": "The package should be split into a maxprocs sub-package with an explicit API and a top-level blank-importable package with side effects.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "Set should default to the log package for its ... | null |
uber-go__automaxprocs__4 | uber-go/automaxprocs | 4 | defect | c6d5fbec28848d17d71416dd8e8fd38ca970bd64 | 09b723fd0f97206739bbd4b5043b255c0f577f3e | Unset $GOMAXPROCS during tests | In order to test the `maxprocs` package, we need to control the value of
`$GOMAXPROCS`. Unfortunately, Travis sets `$GOMAXPROCS` in every
container.
To work around this, use `TestMain` to unset `$GOMAXPROCS` for the
`maxprocs` package tests, restoring the previous value after tests
complete. | diff --git a/Makefile b/Makefile
index a7b23eb..2822c3c 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ dependencies:
glide install
ifdef SHOULD_LINT
@echo "Installing golint..."
- go install ./vendor/github.com/golang/lint/golint
+ go get -u github.com/golang/lint/golint
else
@echo "Not installing golin... | 2 | 2 | 0 | [{"id": "G0", "claim": "Use log.Fatal instead of the fmt.Printf-plus-os.Exit(1) pair when TestMain fails to clear GOMAXPROCS.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "Restoring GOMAXPROCS in TestMain is unnecessary since the process exits ... | null |
uber-go__automaxprocs__44 | uber-go/automaxprocs | 44 | defect | 0180b04c18a7f6d2ce6cc490b3913574957a1768 | 0ae5491e17536ceb5f083c7b6c2fe7547a202da1 | Support cgroup2 | CGroup-V2 has a different architecture which is unified. Since it is not yet supported in go, it makes sense to currently have the
support. This commit adds the functionality to set GOMAXPROCS in cgroup2 enabled systems.
Also there were lint errors because of build annotation comments which are fixed in a separate ... | diff --git a/internal/cgroups/cgroup.go b/internal/cgroups/cgroup.go
index 1257d0c..fe4ecf5 100644
--- a/internal/cgroups/cgroup.go
+++ b/internal/cgroups/cgroup.go
@@ -18,6 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+//go:build linux
// +build linux
p... | 8 | 6 | 3 | [{"id": "G0", "claim": "Declare isV2 with the zero value (\"var isV2 bool\") instead of initializing it to false.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "Return \"isV2, nil\" directly instead of the trailing conditional that returns true ... | null |
uber-go__automaxprocs__73 | uber-go/automaxprocs | 73 | defect | d064ede19db88036b1a2fb6b41113717a84dfda2 | 820227bd0e516a1f57bdffacd67fc63c2b420539 | fix: mountinfo parsing | Fix the parsing of mountinfo when super options has fields with spaces in, which is the case on WSL as it includes `path=C:\\Program Files\...`.
Fixes #72 | diff --git a/internal/cgroups/mountpoint.go b/internal/cgroups/mountpoint.go
index 2efde4c..f3877f7 100644
--- a/internal/cgroups/mountpoint.go
+++ b/internal/cgroups/mountpoint.go
@@ -95,8 +95,12 @@ func NewMountPointFromLine(line string) (*MountPoint, error) {
for i, field := range fields[_miFieldIDOptionalFields... | 1 | 1 | 1 | [{"id": "G0", "claim": "Add a test case covering the new SplitN-based mountinfo line parsing (the WSL super-options case).", "category": "testing", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
uber-go__automaxprocs__79 | uber-go/automaxprocs | 79 | defect | e83e959d8845f659d02749ba5598fd62a7129e4e | f5ff8d281cdd2d9319d8d1dbb365479cb186d9d2 | Add option to round up CPU quota | Add a `RoundQuotaFunc` option to control how the CPU quota should be rounded. The default is still rounding down (floor).
This is related to issue https://github.com/uber-go/automaxprocs/issues/78 | diff --git a/internal/runtime/cpu_quota_linux.go b/internal/runtime/cpu_quota_linux.go
index 3b97475..4dd54cb 100644
--- a/internal/runtime/cpu_quota_linux.go
+++ b/internal/runtime/cpu_quota_linux.go
@@ -32,7 +32,7 @@ import (
// CPUQuotaToGOMAXPROCS converts the CPU quota applied to the calling process
// to a va... | 6 | 6 | 2 | [{"id": "G0", "claim": "The round-up switch should not be a bare bool; it should be an enum-typed option (e.g. RoundDown/RoundUp, or ceil/floor) so callers can express the rounding mode.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The default-floor-th... | null |
uber-go__automaxprocs__8 | uber-go/automaxprocs | 8 | defect | 55a48d6c82a4d54171a5920cd96aba4ac7baffed | 1a12ecae8cf9772c77b4bbbb888c64d69b1f69bc | Refactor maxprocs: better logging and only set on success | Currently, we call `GOMAXPROCS` even if we are unable to determine the
CPU quota. Since the returned value is 0, this doesn't have an impact,
but avoid calling `runtime.GOMAXPROCS` to set the value unless we
successfully determine the quota.
Improve logging so users have clear messaging about the source of logs
... | diff --git a/maxprocs/maxprocs.go b/maxprocs/maxprocs.go
index 5f7d473..6553969 100644
--- a/maxprocs/maxprocs.go
+++ b/maxprocs/maxprocs.go
@@ -75,30 +75,39 @@ func Set(opts ...Option) (func(), error) {
o.apply(cfg)
}
- prev := currentMaxProcs()
undo := func() {
- cfg.log("resetting GOMAXPROCS to %d", prev)
... | 1 | 1 | 0 | [{"id": "G0", "claim": "The no-op undo closure should be named undoNoop to differentiate it from the real undo.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
uber-go__config__27 | uber-go/config | 27 | defect | 1278baf8a5065bafb11f658520b8c4fffef649cb | ce04aedea6d69a1d72eb1e1bf7b6b01914b07a32 | Check implementation of TextUnmarshaller on all types | `Populate` is using `encoding.TextUnmarshaller` interface only on scalar types,
functions and channels, but any type can implement it, e.g. [zap.AtomicLevel](https://github.com/uber-go/zap/blob/master/level.go#L109)
We are using `Value.String()` to construct the byte array. In case of scalar types
received from a... | diff --git a/decoder.go b/decoder.go
index 1f784a5..73e1527 100644
--- a/decoder.go
+++ b/decoder.go
@@ -454,16 +454,6 @@ func (d *decoder) pointer(name string, value reflect.Value, def string) error {
return d.unmarshal(name, value.Elem(), def)
}
-// Sets value to a channel type.
-func (d *decoder) channel(key st... | 5 | 2 | 0 | [{"id": "G0", "claim": "The `cartoon` struct and its method should be defined inside the test itself instead of at package scope.", "category": "maintainability", "verdict": "uncertain", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The kind range check `kind >= reflect.Array && kind <= reflect.Slice... | null |
uber-go__config__31 | uber-go/config | 31 | defect | ded39eddb7fb016152a7222dc0e8bbb6b169bc3d | 9dcef554245cdf0dcb1912a2f3b32053875a72e4 | Check underlying collection types | We have several bugs related to collections:
1. [Populate doesn't fail on malformed data](https://github.com/uber-go/config/issues/21)
1. [Command line is implemented via maps, so slices aliases can't be used for unmarshaling data](https://github.com/uber-go/config/issues/29).
1. Populate for slices iterates only ... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26c5793..a7be102 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,8 @@
## v1.0.0-rc2 (unreleased)
-- No changes yet.
+- **[Breaking]** `ValueType` and `GetType` functionality is removed in favor of using
+ `reflect.Kind`
## v1.0.0-rc1 (26 Jun 2017)
diff -... | 5 | 4 | 0 | [{"id": "G0", "claim": "Reviewer asks whether the removal of ValueType/GetType breaks the public API or is just internals, questioning the accuracy of the changelog's [Breaking] characterization.", "category": "documentation", "verdict": "opposed", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "The ne... | null |
uber-go__config__60 | uber-go/config | 60 | defect | c79dcee3b5ba70bf9aa03c1c089d39701b8252fe | c65808ada0ff9aa91fc29bc662d588ccc2d5a6b5 | Fixed populate panic for a nil pointer | We can't populate a value if there no value.
`reflect.Indirect` of a nil pointer returns an invalid `reflect.Value` and panics in the decoder. | diff --git a/CHANGELOG.md b/CHANGELOG.md
index b390377..7cd878f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,8 @@
# Changelog
-## v1.1.0 (not released yet)
+## v1.0.2 (2017-08-14)
-- No changes yet.
+- Fixed populate panic for a nil pointer.
## v1.0.1 (2017-08-04)
diff --git a/static_provider_test.... | 1 | 1 | 0 | [{"id": "G0", "claim": "The CHANGELOG release date the pull request set to 2017-08-14 should be updated to 2017-08-16.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
uber-go__config__85 | uber-go/config | 85 | defect | 3ff3202fa6fca4708d01844f44c48e8955ed466d | 89773e4a03c1ba4e5fea4e4afbaf4754c7ddeb9d | Add a small package to deep-merge YAML | Since we're only planning to use this package during process startup,
there's no need to micro-optimize our YAML merging. Given that, we can
implement our deep-merging logic in a small, standalone package that
doesn't require any explicit reflection. That package takes a more naive
approach than our current logic: ... | diff --git a/internal/merge/merge.go b/internal/merge/merge.go
new file mode 100644
index 0000000..8b6d656
--- /dev/null
+++ b/internal/merge/merge.go
@@ -0,0 +1,151 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this softwar... | 5 | 4 | 0 | [{"id": "G0", "claim": "The package doc comment should not say that merging mismatched types \"silently fails\"; it should instead say that, to preserve backwards compatibility, new values replace existing values when mismatched types are merged.", "category": "documentation", "verdict": "supported", "priority": "P2", ... | null |
uber-go__dig__109 | uber-go/dig | 109 | defect | 7fc0dce67beac73fc5dcfe3d0d93ed158e7c27f5 | 35534e84c1758964f880b45f32282353af1208ae | Named instances | On the third time of asking, here's one atomic PR that solves the rest of what's needed for #80
Object are now uniquely identified by `reflect.Type:string`, everything else stems from there. Far cleaner than the lasts two attempts to get this in.
Optional edges are prepended with `~` now in the output, i.e. requ... | diff --git a/dig.go b/dig.go
index 09a82bc1..2a13c53f 100644
--- a/dig.go
+++ b/dig.go
@@ -30,21 +30,36 @@ import (
const (
_optionalTag = "optional"
+ _nameTag = "name"
)
+// Unique identification of an object in the graph.
+type key struct {
+ t reflect.Type
+ name string
+}
+
// A Container is a dire... | 7 | 6 | 3 | [{"id": "G0", "claim": "Registering constructed values with `c.set(key{t: con.Type()}, con)` drops the name, so a named `get(key{name: \"foo\", t: someType})` would `set(key{t: someType})`.", "category": "correctness", "verdict": "opposed", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "Add a comment ... | null |
uber-go__dig__114 | uber-go/dig | 114 | defect | 3fb3e421009c9f6309bb0cac236ffcb7762d7eb3 | be06c58a5dc5dbca6050491c148c491414e21559 | Allow optional dependencies to have missing deps | If an Invoke takes an optional dependency on type `A`, but `A`'s
provided constructor has unmet dependencies, we should provide the zero
value. This makes optional params work as most users would expect.
Fixes #111. | diff --git a/dig.go b/dig.go
index b865f5d2..6c56452b 100644
--- a/dig.go
+++ b/dig.go
@@ -284,9 +284,10 @@ func (c *Container) createInObject(t reflect.Type) (reflect.Value, error) {
e := edge{key: key{t: f.Type, name: f.Tag.Get(_nameTag)}, optional: isOptional}
v, err := c.get(e)
- if err != nil {
- return... | 1 | 1 | 1 | [{"id": "G0", "claim": "The code should differentiate between \"failed to instantiate object\" and \"object is missing\" instead of treating any error from get() as an unmet optional dependency.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
uber-go__dig__130 | uber-go/dig | 130 | defect | f407770ddd130b106a6c615fca31f4b040ed7b1a | 9d50b807567241403801e8fbed3918f57b19b15d | Change exported IsIn/IsOut to use interface{} | This makes external experience a lot better to check when something is
and isn't an In/Out type.
Use the previous iteration of the function under the hood.
Changelog not needed, since this hasn't been released. | diff --git a/dig.go b/dig.go
index 9ac3f63e..8f13ce54 100644
--- a/dig.go
+++ b/dig.go
@@ -183,7 +183,7 @@ func (c *Container) getReturnKeys(
}
// Tons of error checking
- if IsIn(k.t) {
+ if isInType(k.t) {
return errors.New("can't provide parameter objects")
}
if _, ok := returnTypes[k]; ok... | 2 | 2 | 1 | [{"id": "G0", "claim": "The new IsIn/IsOut API requires a non-nil value, since reflect.TypeOf returns nil when the value is nil, so nils need to be handled (a nil value means a non-struct type that can't be a dig.In).", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": ... | null |
uber-go__dig__135 | uber-go/dig | 135 | defect | 11a116f098560d8b0099978385852c3adc0b96f0 | 84d76758fe09475e6c21dd155a605b943d107fe2 | Basic tests for Go 1.9 aliases | This verifies the behavior of Dig with Go 1.9 aliases.
I had to change the Travis setup to run lint only for Go 1.9 because it fails
syntax check for other versions.
Resolves #134
| diff --git a/.travis.yml b/.travis.yml
index 8501deaf..32a725d0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,15 +1,19 @@
language: go
sudo: false
-go:
- - 1.7
- - 1.8
- - tip
go_import_path: go.uber.org/dig
+
+matrix:
+ include:
+ - go: 1.7
+ - go: 1.8
+ - go: tip
+ env: LINT=1
+
cache:
dir... | 4 | 2 | 1 | [{"id": "G0", "claim": "Questions why lint runs on Go tip rather than the latest release, implying lint should run on the latest release instead.", "category": "design", "verdict": "opposed", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "Remember to switch the lint job from tip to Go 1.9 once 1.9 is ... | null |
uber-go__dig__137 | uber-go/dig | 137 | defect | 4d20ce69a3f0c9474329b43cedcfb6f6c2b75f50 | 94ead92af2ffe6b461ddeed9f605661d0f7d5327 | Error on private fields inside dig.In/Out | As discussed in the issue, we no longer accept private fields on these structs as valid input. I tried to make the error message informative, pointing out the exact field and suggesting an export.
Original issue from Fx repo https://github.com/uber-go/fx/issues/565
Fixes #136 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2519540a..5f44dbdd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,9 @@
## v1.0.0-rc3 (unreleased)
-- No changes yet.
+- `Provide` and `Invoke` will now error out if `dig.In` or `dig.Out` structs
+ contain private fields. Previously these fields were ignored ... | 4 | 4 | 0 | [{"id": "G0", "claim": "The private-field error in traverseOutTypes should not nest fmt.Sprintf inside fmt.Errorf; the field name, type and struct can be passed as Errorf arguments directly with the suggested format.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id... | null |
uber-go__dig__142 | uber-go/dig | 142 | defect | c4f0153ff3715deeb306d344e17b4e92e507603e | a781c03100b1c9f17b0f89989423f6c88858f5be | Rewrite godocs | This rewrites most of the godocs of this library and documents
undocumented features (dig.In, dig.Out, etc.).
The package-level docs give a general overview of the library and
showcase different dig.In/dig.Out features by use case.
Entity-level docs for dig.In and dig.Out act as the authoritative
reference lis... | diff --git a/dig.go b/dig.go
index 41e8b744..f1475553 100644
--- a/dig.go
+++ b/dig.go
@@ -57,12 +57,11 @@ type InvokeOption interface {
unimplemented()
}
-// A Container is a directed, acyclic graph of dependencies. Dependencies are
-// constructed on-demand and returned from a cache thereafter, so they're
-// ef... | 23 | 18 | 1 | [{"id": "G0", "claim": "The Provide doc should also state that Provide expresses the constructor's dependency types.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The Invoke doc should specify what \"immediately\" means and describe how the funct... | null |
uber-go__dig__151 | uber-go/dig | 151 | defect | 809ed57c66b4c4b74e882be9da77d997ec439cde | 4c6a91fe795d8bdd8654e758de4b34cda9849e89 | Detect cycles in `param` | This updates the cycle detection logic to rely on `param` types. | diff --git a/dig.go b/dig.go
index 4b4f9360..d454aa95 100644
--- a/dig.go
+++ b/dig.go
@@ -261,7 +261,7 @@ func traverseOutTypes(k key, f func(key) error) error {
}
func (c *Container) isAcyclic(n *node) error {
- return detectCycles(n, c.nodes, nil)
+ return detectCycles(n.Params, c.nodes, []key{n.key})
}
// R... | 2 | 2 | 0 | [{"id": "G0", "claim": "The cycle test should be made to recurse at least once.", "category": "testing", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The panic message for an unknown param type should clearly tell the user they have found a bug in dig and should file an issue... | null |
uber-go__dig__153 | uber-go/dig | 153 | defect | 809ed57c66b4c4b74e882be9da77d997ec439cde | 6d17ee7eef52d6e64bcdb9737665bc6fdff4ea35 | Shallow dependency check for `param` types | This implements a shallow check (previously implemented by
`Container.contains`) in terms of `param`. This check just verifies that
constructors for all dependencies of the provided param are present in
the container.
Note that this is the last usage of `Dependencies()` and we should be
able to delete it now. | diff --git a/dig.go b/dig.go
index 4b4f9360..9c151ade 100644
--- a/dig.go
+++ b/dig.go
@@ -261,7 +261,7 @@ func traverseOutTypes(k key, f func(key) error) error {
}
func (c *Container) isAcyclic(n *node) error {
- return detectCycles(n, c.nodes, nil)
+ return detectCycles(n.Params, c.nodes, []key{n.key})
}
// R... | 2 | 2 | 0 | [{"id": "G0", "claim": "The name forEachSimpleParam is misleading because the function walks any param in the tree rather than being restricted to simple params.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The panic message for an unknown par... | null |
uber-go__dig__155 | uber-go/dig | 155 | defect | 809ed57c66b4c4b74e882be9da77d997ec439cde | b9ebe4c69e9846c5826cb2f3dabda78ed009743b | Build dependencies using `param`s | This moves the logic to build a `reflect.Value` given a `*Container`
from `Container.get` into individual `param` types.
- `paramList` builds a `[]reflect.Value` by calling its underlying
`param`s.
- `paramSingle` builds a `reflect.Value` by fetching its cached value
from the container or retrieving and call... | diff --git a/.codecov.yml b/.codecov.yml
index 90e22c81..0496bf53 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -12,3 +12,8 @@ coverage:
# option: "X%" a static target percentage to hit
if_not_found: success # if parent is not found report status as success, error, or failu... | 6 | 5 | 0 | [{"id": "G0", "claim": "willhug asks whether paramSingle.Build will panic with a weird error message when a provided constructor returns no values, or whether Provide validates that provided constructors return something.", "category": "correctness", "verdict": "opposed", "priority": "P3", "scope": "introduced"}, {"id"... | null |
uber-go__dig__175 | uber-go/dig | 175 | defect | a84ae412585ef6c4b8fc2f7577ff80f701317314 | 9a48c775a56558ad2a778089da823b9a29989531 | Provide: Add Name option | This adds a `Name(string)` option to `Provide()` so that the following,
c.Provide(NewThing, Name("foo"))
Is the same as the following,
type result struct {
dig.Out
Thing *Thing `name:"foo"`
}
c.Provide(func(...) result {
return result{Thing: NewThing(..)}
}... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54f4cbef..92aadea7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,10 @@
## v1.4.0 (unreleased)
-- No changes yet.
+- Added `Name` option for `Provide` to add named values to the container
+ without rewriting constructors. See package documentation for more
+... | 7 | 4 | 1 | [{"id": "G0", "claim": "The comment on ProvideOption still saying it is included for future functionality with no concrete implementations needs to be updated now that Name exists.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "pre_existing"}, {"id": "G1", "claim": "The comment in th... | null |
uber-go__dig__188 | uber-go/dig | 188 | defect | 15c67344e48b1b3317399a647b0ec0069c34321d | dd814626ce80cccab68488f055c5c5b3efe73042 | Introspection: Introduce DOT graph in Container | Added dotgraph field in Container that represents the type dependency graph using graph edges. | diff --git a/dig.go b/dig.go
index 65fbfe57..7c2d32c1 100644
--- a/dig.go
+++ b/dig.go
@@ -111,6 +111,20 @@ type InvokeOption interface {
unimplemented()
}
+// A graphNode represents a node in the dependency DOT graph
+type graphNode struct {
+ Type string
+ name string
+ optional bool
+ group string
+}... | 12 | 12 | 0 | [{"id": "G0", "claim": "Rename the graphNode type to dotNode, since 'graph' is an overloaded term.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "Rename the graphEdge type to dotEdge, like the suggested dotNode rename.", "category": "design", "verdict": ... | null |
uber-go__dig__19 | uber-go/dig | 19 | defect | 354b31ad36fa0f5dc4af382765bc88dc1826c40a | 5baf3e9acd7a987885f344f1781141cb046f1c8f | Register constructors with multiple return pointers | Fixes #18
Constructors with multiple return objects are now registered and cached in the graph.
This PR does not resolve generic objects returned on constructor initialization such as `io.Closer` | diff --git a/container.go b/container.go
index 91d44121..33ba9d57 100644
--- a/container.go
+++ b/container.go
@@ -63,24 +63,23 @@ func (c *Container) Provide(t interface{}) error {
defer c.Unlock()
ctype := reflect.TypeOf(t)
-
switch ctype.Kind() {
case reflect.Func:
- switch ctype.NumOut() {
- case 2:
- ... | 9 | 8 | 2 | [{"id": "G0", "claim": "Provide should not force the last return value to be an error; it should check whether the last one is an error and treat all returned values as objects when it is not.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The count para... | null |
uber-go__dig__196 | uber-go/dig | 196 | defect | b0a10c2f341d4b8c5a102ab5f5f88738d39e6346 | 0d62253f11345c297f54bdb93c7f9846f43125b7 | VisualizeError: Move updates to graph into errors | Made `Visualize` and `VisualizeError` separate methods.
```go
Visualize(*Container, io.Writer, ...VisualizeOption) error
```
`Visualize` takes a container and parses the dependency graph in the container into a DOT format graph with no error detection/representation, and writes it to an `io.Writer`.
```go
Visual... | diff --git a/dig.go b/dig.go
index bfbecca0..086cb0ab 100644
--- a/dig.go
+++ b/dig.go
@@ -120,6 +120,9 @@ type Container struct {
// key.
providers map[key][]*node
+ // All nodes in the container.
+ nodes []*node
+
// Values that have already been generated in the container.
values map[key]reflect.Value
@@... | 7 | 6 | 1 | [{"id": "G0", "claim": "nit: If the error message carries enough context, Visualize could drop the intermediate variable and error formatting and just `return _graphTmpl.Execute(w, c.createGraph())`.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim":... | null |
uber-go__dig__202 | uber-go/dig | 202 | defect | 815dd3d41125e0b19d8486ce359f5bebdb43a8bd | 53dcc2ae80649cb4f5428790043035a6fd2f987e | CanVisualizeError: Determine if error is visualizable | `dig.CanVisualizeError(err)` returns true if err is visualizable. This is used in fx to determine if we want to output the graph given an error. | diff --git a/dig.go b/dig.go
index ba6609c4..e7720f61 100644
--- a/dig.go
+++ b/dig.go
@@ -253,6 +253,7 @@ func updateGraph(dg *dot.Graph, err error) error {
err = e.cause()
}
+ // If there are no errVisualizers included, we do not modify the graph.
if len(errors) == 0 {
return nil
}
@@ -320,6 +321,12 @@ ... | 5 | 5 | 1 | [{"id": "G0", "claim": "CanVisualizeError should also handle the case where the outer error is not visualizable but an error wrapped beneath it is, by walking the cause chain ('is this thing or anything wrapped by this an errVisualizer').", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "... | null |
uber-go__dig__225 | uber-go/dig | 225 | defect | 6251038696fd5fbacf114692dc3d8d89084bb79a | 64a80960c072c88c50c2672de2f29b7ae227c09f | Expose "Group" Provide option | The commits are mostly individually reviewable.
This is a step towards a solution for [#610 (fx)](https://github.com/uber-go/fx/issues/610) for both named values and value groups. This will allow fx to expose its own Group option, which will allow users to form value groups without needing fx.Out. | diff --git a/dig.go b/dig.go
index c4adee40..3f7ca49f 100644
--- a/dig.go
+++ b/dig.go
@@ -62,10 +62,16 @@ type optionFunc func(*Container)
func (f optionFunc) applyOption(c *Container) { f(c) }
type provideOptions struct {
- Name string
+ Name string
+ Group string
}
func (o *provideOptions) Validate() error ... | 3 | 3 | 2 | [{"id": "G0", "claim": "The pull request should include a test case early in review showing the intended usage and outcome of the new Group option.", "category": "testing", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The Group option's doc comment is incorrect: a group's mem... | null |
uber-go__dig__256 | uber-go/dig | 256 | defect | cfca627871180f3a5d7dab4453f7598e0c758013 | 836797958d7186eefa3ee9f6d27e68652d48d68d | errors: Add errf to support multi-line errors | *Commits are individually reviewable.*
Errors printed by dig are currently a massive wall of text. We've
received consistent feedback that these errors are difficult to read.
To help make these error messages more readable, we're going to split
them across multiple lines when printed with `%+v` instead of `%v`.
... | diff --git a/error.go b/error.go
index 6bf3d012..2f89e249 100644
--- a/error.go
+++ b/error.go
@@ -22,6 +22,7 @@ package dig
import (
"bytes"
+ "errors"
"fmt"
"reflect"
"sort"
@@ -54,6 +55,113 @@ func RootCause(err error) error {
}
}
+// errf is a version of fmt.Errorf with support for a chain of multip... | 6 | 3 | 0 | [{"id": "G0", "claim": "Prepend msg to args by building the array explicitly instead of append([]interface{}{msg}, args...), to avoid excessive allocations.", "category": "performance", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The comment saying the closure lets buildErrf... | null |
uber-go__dig__274 | uber-go/dig | 274 | defect | 4ea249947c78543420fc8c36620326fb811a0094 | 1063373310ccc45be2f7ce49f79d0b830c1d8199 | Add ability to allow unexported fields in dig.In structs | In order for unexported fields to be allowed, an
"allowUnexported=true" struct tag should be used on the embedded dig.In
field.
Resolves: https://github.com/uber-go/dig/issues/273 | diff --git a/dig.go b/dig.go
index 9e81923e..5cd46fb6 100644
--- a/dig.go
+++ b/dig.go
@@ -35,8 +35,9 @@ import (
)
const (
- _optionalTag = "optional"
- _nameTag = "name"
+ _optionalTag = "optional"
+ _nameTag = "name"
+ _allowUnexportedTag = "allowUnexported"
)
// Unique identification o... | 5 | 3 | 2 | [{"id": "G0", "claim": "The new `allowUnexported` tag name is not ideal - Go struct tags do not usually use camelCase, so a kebab-case name like `ignore-unexported:\"true\"` (or `unexported:\"ignore\"`) would be preferable.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id":... | null |
uber-go__dig__280 | uber-go/dig | 280 | defect | d3dbd1dfca531847f33d59b198b225865a19071c | 4797a9837f005669531ef9c2773997da44e38034 | Add ProvideInfo and FillProvideInfo | This adds FillProvideInfo and ProvideInfo, which allow users to get what Dig was able to extract out of the `Provide`d constructors.
Specifically, ConstructorInfo contains ID of the constructor (which is unique among all provided ctors), Inputs (parameters), and Outputs (results) types as Strings.
With these, use... | diff --git a/dig.go b/dig.go
index 8af25a86..e1c08caa 100644
--- a/dig.go
+++ b/dig.go
@@ -62,6 +62,7 @@ func (f optionFunc) applyOption(c *Container) { f(c) }
type provideOptions struct {
Name string
Group string
+ Info *ConstructorInfo
}
func (o *provideOptions) Validate() error {
@@ -128,6 +129,26 @@ func... | 11 | 11 | 1 | [{"id": "G0", "claim": "Exposing constructor inputs and outputs only as []string in the public API would make it hard to keep backwards compatibility when exposing more information later; prefer opaque types that leave room for expansion.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "intro... | null |
uber-go__dig__282 | uber-go/dig | 282 | defect | 931c2ba3078223df693d6f216aec5934766c278d | cbdddd240564d24232f74c76ef372e24eec72f58 | Add LocationForPC ProvideOption | Closes #281 | diff --git a/dig.go b/dig.go
index dc3c2363..3fde7bd4 100644
--- a/dig.go
+++ b/dig.go
@@ -60,9 +60,10 @@ type optionFunc func(*Container)
func (f optionFunc) applyOption(c *Container) { f(c) }
type provideOptions struct {
- Name string
- Group string
- Info *ProvideInfo
+ Name string
+ Group string
+ Info... | 2 | 2 | 1 | [{"id": "G0", "claim": "Add a check for `f` being nil in the new InspectFuncPC, since an invalid PC makes runtime.FuncForPC return nil and the next line would panic.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "Rename the LocationForPC argument fu... | null |
uber-go__dig__29 | uber-go/dig | 29 | defect | b5c8619bfbd7fdb089c3aa492665339e1457175c | 946bb0657db455d46a082b2535fdb6ab901c8ceb | Refactor dig to separate graph handling and calling API | access to the nodes map, duplicate code, and all the locking logic is getting difficult to work around. This refactor should help.
1. container.go -> user APIs to deal with `package dig` (`Provide`, `Resolve`, `Invoke`, etc)
pros - container doesn't know about nodes map.
2. `package graph` contains all the l... | diff --git a/container.go b/container.go
index cbfcc3b0..03edfd7e 100644
--- a/container.go
+++ b/container.go
@@ -21,36 +21,30 @@
package dig
import (
- "bytes"
"fmt"
"reflect"
- "sync"
"github.com/pkg/errors"
+ "go.uber.org/dig/graph"
)
var (
- errParamType = errors.New("registration must be done ... | 10 | 6 | 1 | [{"id": "G0", "claim": "Move the graph package to internal/ (or keep the Graph type private) so it is not part of the public API surface.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The team should start thinking and working through the upcoming optio... | null |
uber-go__dig__306 | uber-go/dig | 306 | defect | cd97524b94a958d57945c084416bd6ef49633b9b | 202408611712190e59de60f5651518f66e8d52a5 | Add Export option to Provide | This adds `Export` option to `Provide`, which specifies that the provided constructor should be made available to all the Scopes in the same scope tree.
For example:
```
c := New()
s1 := c.Scope("child 1")
s2 := c.Scope("child 2")
s2.Provide(func() *A { ... })
c.Invoke(func(a *A) { ... }) // errors
s1.Invoke(... | diff --git a/provide.go b/provide.go
index bcf28af5..dc7ecb52 100644
--- a/provide.go
+++ b/provide.go
@@ -43,6 +43,7 @@ type provideOptions struct {
Info *ProvideInfo
As []interface{}
Location *digreflect.Func
+ Exported bool
}
func (o *provideOptions) Validate() error {
@@ -301,6 +302,34 @@ func (... | 2 | 2 | 0 | [{"id": "G0", "claim": "The Export doc comment should read 'regardless of which Scope it was provided from' instead of 'regardless of from which Scope it was provided'.", "category": "documentation", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "In TestExportString, the Export... | null |
uber-go__dig__311 | uber-go/dig | 311 | defect | 5e5a20dfdf66d43a6237f7329fec99e96c55527e | cb8a42d64c0976aac30405a46cce0df5de0cfe60 | Misc. fixes from #305 | This contains some miscellaneous fixes from additional feedback
from #305. Notably:
- Make provider resolution for parameter building iterate the other way around (from self to root) and break once a provider is found.
- Rename appendLeafScopes to appendSubscopes.
- Rename getScopesFromRoot to ancestors
- Change... | diff --git a/param.go b/param.go
index bf9d4272..81d09b7b 100644
--- a/param.go
+++ b/param.go
@@ -146,36 +146,26 @@ func (pl paramList) Build(containerStore) (reflect.Value, error) {
// to the underlying constructor.
func (pl paramList) BuildList(c containerStore) ([]reflect.Value, error) {
args := make([]reflect.... | 2 | 2 | 0 | [{"id": "G0", "claim": "The allContainers loop in BuildList needs to break once a value has been built, otherwise the child scopes' constructors for that type are called as well.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "pre_existing"}, {"id": "G1", "claim": "If a child scope prov... | null |
uber-go__dig__312 | uber-go/dig | 312 | defect | 08ad0918769a31c74b704e64120359f59200c6d2 | a4d4e8319c6f80dcc4c1b48e12e7ba4c4c96176d | param: Search scopes during Build, support value groups | This significantly changes how we instantiate dependencies for a
constructor and adds support for value groups.
Previously, for each parameter of a constructor, we attempted to
instantiate the value in every scope until one succeeded without
dependency errors. Effectively:
for param in constructor
... | diff --git a/constructor.go b/constructor.go
index 00bba546..0111f932 100644
--- a/constructor.go
+++ b/constructor.go
@@ -148,7 +148,12 @@ func (n *constructorNode) Call(c containerStore) error {
if err := n.resultList.ExtractList(receiver, results); err != nil {
return errConstructorFailed{Func: n.location, Reas... | 2 | 1 | 0 | [{"id": "G0", "claim": "In the comment above receiver.Commit(n.s) in constructor.go, \"dependencies\" is misspelled as \"dependnecies\"; the reviewer proposed a one-line suggestion to fix it.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "In param... | null |
uber-go__dig__317 | uber-go/dig | 317 | defect | 1d9f0f1e9c0a34b7d95b3d7803941cf739ce0ab0 | 27af7c8a082c5842186c4b8bf65e7e9e3b200c22 | Fix decoration logic for paramSingle | When building paramSingle using decorators, there was a descrepancy when
the invoking Scope does not have a decorator for the type but one of its
parent Scopes does. This resulted in the parent Scope having to Invoke
a function that uses the decorated type for the child to start seeing it
too.
This fixes paramSi... | diff --git a/decorate_test.go b/decorate_test.go
index 67f319d6..a72eb42d 100644
--- a/decorate_test.go
+++ b/decorate_test.go
@@ -34,56 +34,95 @@ func TestDecorateSuccess(t *testing.T) {
t.Run("simple decorate without names or groups", func(t *testing.T) {
t.Parallel()
type A struct {
- name string
+ Name ... | 3 | 3 | 0 | [{"id": "G0", "claim": "The renaming of the test structs' unexported `name` fields to exported `Name` was not needed for this fix and should be undone.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "`dig.Export(true)` is not needed on providers ... | null |
uber-go__dig__322 | uber-go/dig | 322 | defect | a7e23e31e975ecc9e31818a04a2152845a920806 | 71546ac8985b0776a9739e37ec1a17557eda5452 | Fix Invoke order changing execution result in multiple decorations of same type | This fixes the multiple decoration logic for paramSingle where there
are more than one scopes that contain decorators for a type. The lookup
logic only looked up one-level for the decorator. For example, if Scope S
has a decorator and its parent Sp also has a decorator for the same type, it never
executed Sp's deco... | diff --git a/decorate.go b/decorate.go
index 2d96b755..2a57b7d1 100644
--- a/decorate.go
+++ b/decorate.go
@@ -98,7 +98,7 @@ func (n *decoratorNode) Call(s containerStore) error {
}
}
- args, err := n.params.BuildList(n.s, true /* decorating */)
+ args, err := n.params.BuildList(n.s, s == n.s /* decorating */)
... | 1 | 1 | 0 | [{"id": "G0", "claim": "Remove the unnecessary '// assert child sees 2, 3, 4' and '// assert parent sees 1, 2, 3' comments from the new multiple-decorates test.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}] | null |
uber-go__dig__325 | uber-go/dig | 325 | defect | 3a148a28d5453a4527f72b23dc44366ac39ca3db | 000f9204fe92b9401d51c575a4075ff503e99188 | Allow providing types that depend on decorated types from child modules | This fixes the case where a function that's Invoked depends on a type that's decorated.
Specifically, if a type has a decorator in a child Scope, and there's another exported constructor consuming that type within the same Scope, and a function is invoked outside of that Scope, we still should see the decorated typ... | diff --git a/constructor.go b/constructor.go
index bab711aa..04799438 100644
--- a/constructor.go
+++ b/constructor.go
@@ -57,8 +57,15 @@ type constructorNode struct {
// order of this node in each Scopes' graphHolders.
orders map[*Scope]int
- // scope this node was originally provided to.
+ // scope this node is... | 1 | 1 | 0 | [{"id": "G0", "claim": "The Exported()/OrigScope() branch in paramSingle.Build could be simplified to an unconditional `err := n.Call(n.OrigScope())`, since either Exported() is true or OrigScope() equals c, though this makes one unexported child-provider test fail unless those provides add dig.Export(true).", "categor... | null |
uber-go__dig__329 | uber-go/dig | 329 | defect | 3a148a28d5453a4527f72b23dc44366ac39ca3db | 6da99ed64bad27a81e4ee3c30df37d26f4acecaa | Fix issue with multiple decoration passes in same Scope | This fixes issue when there is a decorator that depends on a type
that is decorated by another decorator that lives in the same
Scope.
Previously, there is a "circuit-breaker" for the parameter building
logic specifically for the case when the decorator depends on the same
type as its output type; this basically... | diff --git a/decorate.go b/decorate.go
index 2a57b7d1..8753440b 100644
--- a/decorate.go
+++ b/decorate.go
@@ -28,9 +28,18 @@ import (
"go.uber.org/dig/internal/dot"
)
+type decoratorState int
+
+const (
+ decoratorReady decoratorState = iota
+ decoratorOnStack
+ decoratorCalled
+)
+
type decorator interface {
... | 5 | 4 | 1 | [{"id": "G0", "claim": "The nested decorator-search loop in paramSingle.buildWithDecorators could be shortened by using a labeled continue instead of the searchParentScope flag.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The decorating bool ... | null |
uber-go__dig__332 | uber-go/dig | 332 | defect | 1988af94c5751c46572a001fcb4cf9f4c4e04fda | d8735f514b910504af77c154b4ad6a7850ee2caa | Bubble location from LocationForPC's ProvideOption up to errors | Previously, if a location was passed to Provide via the
LocationForPC ProvideOption, the location would not be taken
into account in the case of an error where a constructor could
not be Provided.
This change updates the error returned, making it more readable by
basing the error message on alternate function pr... | diff --git a/provide.go b/provide.go
index a7066370..3f5937eb 100644
--- a/provide.go
+++ b/provide.go
@@ -417,8 +417,15 @@ func (s *Scope) Provide(constructor interface{}, opts ...ProvideOption) error {
}
if err := s.provide(constructor, options); err != nil {
+ var errFunc *digreflect.Func
+ if options.Locati... | 1 | 1 | 1 | [{"id": "G0", "claim": "The new error-location logic in Scope.Provide (the errFunc branch choosing options.Location over digreflect.InspectFunc in provide.go) should get tests added for it.", "category": "testing", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
uber-go__dig__344 | uber-go/dig | 344 | defect | dec73fade94bc3ba77d4f5def87f770d257071de | 192cd2f738d16b83707a91747888cbc2ac894fec | Fix issue with wrong invoke for multiple private providers | This fixes issue #343 - we check if the value can be provided in each scope from current to root, instead of first searching for pre built ones in all scopes. | diff --git a/.gitignore b/.gitignore
index d651c357..471c3f9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@
*.coverprofile
coverage.txt
*.pprof
+*.swp
diff --git a/param.go b/param.go
index 54c45be4..5e769b09 100644
--- a/param.go
+++ b/param.go
@@ -213,6 +213,11 @@ func (ps paramSingle) getValue(c cont... | 3 | 2 | 0 | [{"id": "G0", "claim": "The `*.swp` entry the pull request added to .gitignore should be removed.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "The container-level string provider should be registered after the child scope and its provider are ... | null |
uber-go__dig__348 | uber-go/dig | 348 | defect | a643346bed7207e9495f1028f486859d492de00a | c563e5341846e57c38d517950a7ac73b452d9601 | Add support for soft value groups | This adds the soft attribute to value parameter value groups. Types in
a soft value group won't call their providers if they are the only value
that it's provided by these constructors. This helps to avoid providing
unnecessary values to the dependency graph and also prevent calling
unnecessary constructors.
Exa... | diff --git a/dig_test.go b/dig_test.go
index 4761f83b..99aba064 100644
--- a/dig_test.go
+++ b/dig_test.go
@@ -53,7 +53,6 @@ func TestEndToEndSuccess(t *testing.T) {
require.NotNil(t, got, "invoke got nil buffer")
require.True(t, got == b, "invoke got wrong buffer")
})
-
})
t.Run("nil pointer construct... | 6 | 6 | 2 | [{"id": "G0", "claim": "Add a test covering the error case where soft is used with a result value group, including a case where a type is provided via dig.Group with soft such as dig.Provide(func() someType { ... }, dig.Group(`string,soft`)).", "category": "testing", "verdict": "supported", "priority": "P1", "scope": "... | null |
uber-go__dig__360 | uber-go/dig | 360 | defect | 601ea65abf18053c3a9f798cddd81de8749a841b | e9ae1c08de48876835f273e98a3559eebaa403f9 | Update Dig error types & reporting, more easily distinguish Dig errors vs. non-Dig errors | This update:
- Introduces the `dig.Error` interface, which is implemented by all errors returned by Dig, allowing users to use `errors.Is` and `errors.As` with Dig errors.
- Replaces the concept of errors causing other errors with Go's error wrapping conventions, so errors caused by other errors can now be unwrapped ... | diff --git a/cycle_error.go b/cycle_error.go
index 03b9434f..56a53036 100644
--- a/cycle_error.go
+++ b/cycle_error.go
@@ -22,6 +22,7 @@ package dig
import (
"bytes"
+ "errors"
"fmt"
"go.uber.org/dig/internal/digreflect"
@@ -37,6 +38,10 @@ type errCycleDetected struct {
scope *Scope
}
+var _ Error = err... | 16 | 15 | 2 | [{"id": "G0", "claim": "In IsCycleDetected the type assertion and the if should be combined into the single-statement form `if _, ok := err.(errCycleDetected); ok {`.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "A test case should be added tha... | null |
uber-go__dig__375 | uber-go/dig | 375 | defect | 5ae7b1f2652f264e42174773de26dbeea0cc8199 | 24e9c43dc8e740035fe475d0ad9a69de30a6f63d | Allow using dig.As with dig.Group | This PR adds the ability to use dig.As with dig.Group.
When dig.As is used with dig.Group, the value produced
by the constructor will be provided to the specified group
as the type specified by dig.As.
```
c.Provide(newBuffer, dig.As(new(io.Reader)), dig.Group("readers"))
```
For example, the above code is ... | diff --git a/decorate_test.go b/decorate_test.go
index 26bd86c0..1fb311ab 100644
--- a/decorate_test.go
+++ b/decorate_test.go
@@ -32,6 +32,25 @@ import (
"go.uber.org/dig/internal/digtest"
)
+type myInt interface {
+ String() string
+ Increment()
+}
+type someInt int
+
+func newSomeInt(i int) *someInt {
+ v := so... | 10 | 9 | 0 | [{"id": "G0", "claim": "The new test types should verify interface compliance at compile time (e.g. `var _ myInt = (*someInt)(nil)`) per the Uber Go style guide.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The test may not need to verify the ... | null |
uber-go__dig__38 | uber-go/dig | 38 | defect | 188fe2310b41dd64d51a7c86087ad00e2d2cf7dd | ca085eea3539315fdb5be43ca67c4cc0a014c79f | Introduce maps, slice and arrays to dig | #26
Dig to support non named typed maps slices and arrays.
We have constructors and providers to put `n` objects of type `x` into dig. This PR will allow users to add slices and maps of special types into dig and make objects ready for use. | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0d5b841a..61abc779 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
## v0.4 (unreleased)
+- Add support form `map`, `slice` and `array` to dig
## v0.3 (2 May 2017)
diff --git a/README.md b/README.md
index e264ae71..4e5a3f7b 100644
--- a/README.md
+++ ... | 3 | 2 | 0 | [{"id": "G0", "claim": "The doc comments on the functions (and potentially the readme) should also change to reflect the new maps/slices/arrays support.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The README should not say \"Dig is now able to ... | null |
uber-go__dig__383 | uber-go/dig | 383 | defect | 87cf89e9865ae340333b523007b0ecbeae6c6da2 | 5c3b4cbe600642123a6064fb589af50f7398e749 | Add support for getting info from Invoke statements | This commit exposes `InvokeInfo` and `FillInvokeInfo` to help users extract the types requested by an Invoke statement.
Example usage -
```
var info InvokeInfo
c.Invoke(func(typ1 type1, typ2 type2){}, FillInvokeInfo(&info))
// Will print the types requested by the Invoke statement
for _, typ := range info.R... | diff --git a/dig_test.go b/dig_test.go
index 69b10f9d..e4d5cd59 100644
--- a/dig_test.go
+++ b/dig_test.go
@@ -3741,6 +3741,119 @@ func TestProvideInfoOption(t *testing.T) {
})
}
+func TestInvokeInfoOption(t *testing.T) {
+ t.Parallel()
+
+ t.Run("one map type requested", func(t *testing.T) {
+ t.Parallel()
+
+ ... | 7 | 7 | 1 | [{"id": "G0", "claim": "InvokeInfo should expose its requested parameters as Inputs []*Input, matching ProvideInfo, instead of ReqTypes []*Output.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The FillInvokeInfo doc comment should include a real usage e... | null |
uber-go__dig__39 | uber-go/dig | 39 | defect | 043c7318b544fc0a539ee4a66be41b57d1d8c0a9 | f4dd78e95a5a17bcb96a032f51607e1ae5e88e99 | Added constructor details in error message | Fixes #25
error message now has details of the constructor and function signature. | diff --git a/container.go b/container.go
index 1838c150..5b0cbdf7 100644
--- a/container.go
+++ b/container.go
@@ -58,7 +58,7 @@ func (c *Container) Invoke(t interface{}) error {
case reflect.Func:
args, err := c.Graph.ConstructorArguments(ctype)
if err != nil {
- return err
+ return errors.Wrapf(err, "erro... | 4 | 2 | 1 | [{"id": "G0", "claim": "The error returned when ConstructorArguments fails may print the function's address (%v of the function value t) instead of the actual function signature.", "category": "design", "verdict": "opposed", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "A test should be added that ch... | null |
uber-go__dig__412 | uber-go/dig | 412 | defect | 11da7b7acf669539bea2b0d3c388dd5c9296f248 | 6075bd2bf4e4a314848564be5035b42e71519a09 | feat: add function runtime to dig.CallbackInfo | This change adds runtime of the associated constructor
or decorator to `dig.CallbackInfo`.
For example, users can access the runtime of a particular
constructor by:
```go
c := dig.New()
c.Provide(NewFoo, dig.WithProviderCallback(func(ci dig.CallbackInfo) {
if ci.Error == nil {
fmt.Printf("constru... | diff --git a/callback.go b/callback.go
index dfe47ea6..6abc57d8 100644
--- a/callback.go
+++ b/callback.go
@@ -20,6 +20,8 @@
package dig
+import "time"
+
// CallbackInfo contains information about a provided function or decorator
// called by Dig, and is passed to a [Callback] registered with
// [WithProviderCa... | 4 | 4 | 0 | [{"id": "G0", "claim": "The Runtime field's doc comment should drop 'of time' to read 'contains the duration it took for the associated function to run'.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The Clock interface's doc comment should drop ... | null |
uber-go__dig__42 | uber-go/dig | 42 | defect | 834e078a27b5faa8db131a316e26c6290fd01da8 | 5a427cebe9e3526d4efd749b02846ee2936b77e3 | Invoke to propagate error to caller | If called function returns an error, we are trying to insert it into the graph (which fails because error is not a pointer type). We should rather just return the error back to the caller. | diff --git a/container.go b/container.go
index af0a67c2..f77cad7f 100644
--- a/container.go
+++ b/container.go
@@ -67,6 +67,9 @@ func (c *Container) Invoke(t interface{}) error {
if len(values) > 0 {
err, _ := values[len(values)-1].Interface().(error)
+ if err != nil {
+ return errors.Wrapf(err, "Error ex... | 2 | 2 | 0 | [{"id": "G0", "claim": "Coalesce the error type assertion and the nil check in Invoke into a single one-line if statement.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "Add one more test covering the case where the invoked function's returned e... | null |
uber-go__dig__49 | uber-go/dig | 49 | defect | e794babd83db114fea1144768c239e1b56ccc5bb | 345ef7d62bad54d9ba8e278301a1469bfa6f4f16 | Updated Provide ctors with common returns types to return error | resolves #47
Providing constructors with common return types will now result in an error. For example-
```
ctor1(a *A, b *B) *X
ctor2() (a *A) (*X, error)
```
Provide(ctor1) - success
Provide(ctor2) - returns an error -> `"ctor: func() (*X, error), object type: *X: node already exist for the constructor"` | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9d9a127a..065d6bb9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@
- Remove `Must*` funcs to greatly reduce API surface area.
- Remove `*All` funcs to reduce API surface area. Available methods on
container are `Provide`, `Resolve` and `Invoke`
+- Providing... | 4 | 2 | 2 | [{"id": "G0", "claim": "A test providing the same constructor (oneObject) twice should be written, since this change turns that case from overriding into an error and it is currently untested.", "category": "testing", "verdict": "uncertain", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "TestConcurren... | null |
uber-go__dig__71 | uber-go/dig | 71 | defect | 68fb3970892a8895a696256c726bc6fd6a9629cf | 1a0b3269733804f11f5cd8422bcad27724056b80 | Support Parameter Objects | This adds support for parameter objects to Dig. Parameter objects are arguments
to a constructor which contain zero or more fields that are the actual
dependencies for the constructor. Users opt-in for a struct to be interpreted
as a parameter object by embedding the `dig.Param` type into it.
type Config struct {
... | diff --git a/README.md b/README.md
index 673fa1a4..ca732b7a 100644
--- a/README.md
+++ b/README.md
@@ -7,182 +7,6 @@
`package dig` provides an opinionated way of resolving object dependencies.
-For runnable examples, see the [examples directory](examples/).
-
-## Status
-
-BETA. Expect potential API changes.
-
-##... | 7 | 4 | 1 | [{"id": "G0", "claim": "Why is getParameterObject a free function rather than a method on Container?", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The comment in getParameterDependencies misspells 'The' as 'THe'.", "category": "documentation", "verdict"... | null |
uber-go__dig__77 | uber-go/dig | 77 | defect | 68fb3970892a8895a696256c726bc6fd6a9629cf | fc2c954aa6fff42321b83eef3fe01b1ba41c0282 | Add support for optional parameters | The refactor and Params made it quite trivial to add support and e2e
test for optional tags.
Reading the test explains the expected behavior quite well.
Stacked on #70, #72, #71 | diff --git a/README.md b/README.md
index 673fa1a4..ca732b7a 100644
--- a/README.md
+++ b/README.md
@@ -7,182 +7,6 @@
`package dig` provides an opinionated way of resolving object dependencies.
-For runnable examples, see the [examples directory](examples/).
-
-## Status
-
-BETA. Expect potential API changes.
-
-##... | 3 | 2 | 0 | [{"id": "G0", "claim": "Add a test case with the dig tag and a space after the comma.", "category": "testing", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "Whitespace around comma-separated tag values should be trimmed before comparison.", "category": "correctness", "verdict"... | null |
uber-go__dig__79 | uber-go/dig | 79 | defect | a2d20665e14c7e2d8a45bf25534412a71f1c2c26 | eb06e461de284dff494c2dccf2bcb577ed29389c | optional tag: Support "yes" | We may want a more sophisticated truthiness check in the future. | diff --git a/dig.go b/dig.go
index 05514d0d..b4ea3be3 100644
--- a/dig.go
+++ b/dig.go
@@ -34,6 +34,8 @@ var (
_paramType = reflect.TypeOf(Param{})
)
+const _optionalTag = "optional"
+
// A Container is a directed, acyclic graph of dependencies. Dependencies are
// constructed on-demand and returned fr... | 1 | 1 | 0 | [{"id": "G0", "claim": "The tests should probably also include an `optional:\"no\"` case.", "category": "testing", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
uber-go__dig__82 | uber-go/dig | 82 | defect | a2d20665e14c7e2d8a45bf25534412a71f1c2c26 | 80fab1356391a26995ed01d51592273fa7c5e9ad | Rename dig.Param to dig.In | Step 1 of #80
I'm ok to wait and change the base branch to master after we merge all of dev in. I will, however, get a few more PRs out to get more of the functionality in for the named instances.
Blocked on #73 and will need rebase afterwards | diff --git a/dig.go b/dig.go
index 05514d0d..3df598b9 100644
--- a/dig.go
+++ b/dig.go
@@ -30,8 +30,8 @@ import (
var (
_noValue reflect.Value
_errType = reflect.TypeOf((*error)(nil)).Elem()
- _parameterObjectType = reflect.TypeOf((*parameterObject)(nil)).Elem()
- _paramType = ref... | 5 | 5 | 0 | [{"id": "G0", "claim": "The example struct in the types.go doc comment is inconsistently indented.", "category": "documentation", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "The doc comment misspells StructTags as \"SturctTags\" and should say \"Tags\".", "category": "docume... | null |
uber-go__dig__90 | uber-go/dig | 90 | defect | 950f84ad7e9a98a995d8dea395b6540f1ae390bf | be3db6b83ef115823f19904834ad7ae5d58cf7b3 | Fix detectCyles duplicate dependencies bug | This refactors the cycle detection `seen` map to use a linear search over the path. There was previously an error when multiple dependencies depended on the same types, as reflected in the added unit test. | diff --git a/dig.go b/dig.go
index e7f021d2..0f81f615 100644
--- a/dig.go
+++ b/dig.go
@@ -173,7 +173,7 @@ func (c *Container) provideConstructor(ctor interface{}, ctype reflect.Type) err
}
func (c *Container) isAcyclic(n node) error {
- return detectCycles(n, c.nodes, nil, make(map[reflect.Type]struct{}))
+ return... | 1 | 1 | 0 | [{"id": "G0", "claim": "Use `_` rather than throwaway parameter names (dep0, dep1) in the nested-dependencies test's provider functions.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}] | null |
uber-go__fx__1002 | uber-go/fx | 1,002 | defect | 3a86277ab0e5d84cfee67a53b4a0f15c824a80a4 | e96b604d40b733a819d9e96a7bc03c51d5f75916 | Panic Recovery Option | Since https://github.com/uber-go/dig/pull/364 was merged into Dig, we can now built upon it to add the ability to recover from panics in user-provided code into Fx, by providing a `fx.RecoverFromPanics()` option into their application. This is disallowed on the module level, only on the application level.
```go
app... | diff --git a/app.go b/app.go
index 0ff5c10c0..ae34b0b54 100644
--- a/app.go
+++ b/app.go
@@ -165,6 +165,28 @@ func (t stopTimeoutOption) String() string {
return fmt.Sprintf("fx.StopTimeout(%v)", time.Duration(t))
}
+// RecoverFromPanics causes panics that occur in provided, decorated, and
+// invoked functions to... | 2 | 2 | 0 | [{"id": "G0", "claim": "The subtest name should be spelled \"CannotGiveToModule\" instead of \"CanNotGiveToModule\".", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The RecoverFromPanics doc comment should be reworded to refer to functions given ... | null |
uber-go__fx__1051 | uber-go/fx | 1,051 | defect | 1d726c7fe773533212e658563766c75bc68baa90 | 9dea8c4c04db015d797a0ef5ea134ec3aed98288 | [fx-annotate] Verify invalid tags passed to fx.Annotate #835 | Tags passed with fx.Annotate follow the struct format
```
fx.Annotate(f, fx.ParamTags(`group:”myGroup”`))
```
Where the tag is of the format `<tag_name>:”tag_value”` and tags are separated by space.
If a user accidentally passes an invalid tag such as mismatched quotes(#835), the issue is not identified and no e... | diff --git a/annotated.go b/annotated.go
index 20272268d..e5df501a8 100644
--- a/annotated.go
+++ b/annotated.go
@@ -159,11 +159,20 @@ var _ Annotation = paramTagsAnnotation{}
//
// If there has already been a ParamTag that was applied, this
// will return an error.
+//
+// If the tag is invalid and has mismatched q... | 5 | 5 | 1 | [{"id": "G0", "claim": "The new check treats any tag containing an apostrophe as invalid, which would reject legitimate tag values like `name:\"a'bc\"` that fx otherwise allows; borrow struct tag validation from go vet's structtag check instead.", "category": "correctness", "verdict": "supported", "priority": "P1", "sc... | null |
uber-go__fx__1068 | uber-go/fx | 1,068 | defect | 195960b96093001bd61dd16d341dee317f2be27d | f2a072f37dc2527c8ef7f83a597304a056c9e956 | Disallow using In/Out structs with From/As annotations | In https://github.com/uber-go/fx/pull/1053, we eased up the requirement for function signature for applying annotations to allow using In/Out structs with ResultTags/ParamTags. This had an unintended change in behavior where users are now able to use In/Out structs with From/As annotations. For example, the below code ... | diff --git a/annotated.go b/annotated.go
index 3c9ecf709..9881548ad 100644
--- a/annotated.go
+++ b/annotated.go
@@ -1137,6 +1137,9 @@ var _ Annotation = (*asAnnotation)(nil)
// w, r := a()
// return w, r
// }
+//
+// As annotation cannot be used in a function that takes an fx.In struct as a
+// parameter or re... | 3 | 3 | 1 | [{"id": "G0", "claim": "Banning fx.From with any function returning an fx.Out and fx.As with any function accepting an fx.In may be overly restrictive, since From applies only to inputs and As only to outputs, so the restrictions could be eased to allow those combinations.", "category": "design", "verdict": "supported"... | null |
uber-go__fx__1077 | uber-go/fx | 1,077 | defect | 9629787244457c74e600cd532e2963e5d200fe88 | ac5fbaa7cfc708100390b9a49341f8744db07f77 | Use Dig Callbacks to Emit Run Events | Folks have been asking for additional observability into what constructors/decorators they give to Fx actually get invoked. With https://github.com/uber-go/dig/pull/377 being merged, we can use Dig callbacks to provide this observability point. This PR does this by registering callbacks with Dig that generate a new [fx... | diff --git a/app.go b/app.go
index 14e050b6f..d524a5e98 100644
--- a/app.go
+++ b/app.go
@@ -482,7 +482,7 @@ func New(opts ...Option) *App {
// Run decorators before executing any Invokes -- including the one
// inside constructCustomLogger.
- app.err = multierr.Append(app.err, app.root.decorate())
+ app.err = mu... | 2 | 2 | 2 | [{"id": "G0", "claim": "StackTrace on the new fxevent types should be a []string (one element per stack frame) rather than a single string, since a single string forces users to parse it to recover the individual frames.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G... | null |
uber-go__fx__1089 | uber-go/fx | 1,089 | defect | 6a273c412c93da2d8e5ec187205116c9f696c347 | a4dd747a068814d2feafe0c7e3b665cf4edab49c | Make fx.Populate work with fx.Annotate | This PR makes fx.Populate work with fx.Annotate. Previously, to fx.Populate a
named dependency, users would have to create a struct that embeds fx.In and has
a field with a tag and pass a pointer to that struct. This could be cumbersome
in cases where the user is intersted in only one named value. With this PR,
users w... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index adc6371ad..c9af1b9f8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- No changes yet.
## [1.19.3](https://github.com/uber-go/fx/compare/v1.19.2...v1.19.3) - 2023-04-17
+
#... | 1 | 1 | 1 | [{"id": "G0", "claim": "Add a test case where the output is provided via fx.Annotate (an annotated provide) instead of an Out struct.", "category": "testing", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
uber-go__fx__1122 | uber-go/fx | 1,122 | defect | f59430671a18dc0a556ff3b4a11ebd4a8ed9bcca | 0008e021f091c423d8863f38da36aa32a4938817 | Include Module Traces in Events | Currently, the events that the [fxevent package](https://pkg.go.dev/go.uber.org/fx/fxevent) emits for [provides](https://pkg.go.dev/go.uber.org/fx/fxevent#Provided)/[decorates](https://pkg.go.dev/go.uber.org/fx/fxevent#Decorated)/[supplies](https://pkg.go.dev/go.uber.org/fx/fxevent#Supplied)/[replaces](https://pkg.go.d... | diff --git a/app.go b/app.go
index d524a5e98..2c5a3c41d 100644
--- a/app.go
+++ b/app.go
@@ -432,7 +432,8 @@ func New(opts ...Option) *App {
// user gave us. For the last case, however, we need to fall
// back to what was provided to fx.Logger if fx.WithLogger
// fails.
- log: logger,
+ log: logger,
+ ... | 2 | 2 | 1 | [{"id": "G0", "claim": "Module traces are ordered opposite to stack-trace convention (ancestor-first instead of latest-frame-first), which the reviewer thinks may confuse users, and the trace should also include the module's name.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"},... | null |
uber-go__fx__1154 | uber-go/fx | 1,154 | defect | 89f4a903330850299f4eee045aae7a98e224aa34 | eb1d91fae01f37163a1c5c050300015c926b6688 | test: add a custom mock clock implementation | benbjohnson/clock has been archived and no longer maintained.
Removing that dependency is desirable.
This change adds a mock clock adapted from Zap's mock clock
(uber-go/zap#1349), but with operations specific to Fx's needs.
There are two areas that require more scrutiny
because of divergence from Zap's mock clock:
... | diff --git a/app_test.go b/app_test.go
index c9b9000b0..a45b4cd37 100644
--- a/app_test.go
+++ b/app_test.go
@@ -35,13 +35,13 @@ import (
"testing"
"time"
- "github.com/benbjohnson/clock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
. "go.uber.org/fx"
"go.uber.org/fx/fxeven... | 6 | 5 | 1 | [{"id": "G0", "claim": "Use defer to unlock in deadlineCtx.Err instead of copying the error and unlocking manually before returning.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "Fix the 'Adbance' typo in the TestMock_Sleep comment.", "category... | null |
uber-go__fx__1160 | uber-go/fx | 1,160 | defect | fa4c9956633118db4d8bd88ed0f2b03c8ee392b4 | 8a6a0b8fca0b2aff694b2c0aff8636202269a274 | doc: Add FAQ page | Adds an FAQ page to the Fx documentation,
aiming to address frequently asked questions.
This includes two entries that came up at work recently.
Includes a test for the `fx.Supply` entry
because I couldn't find the test for it right away.
(I found it in annotated_test.go later but you won't hear me complain
about add... | diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js
index 430a0efb3..0fff1e7fe 100755
--- a/docs/.vuepress/config.js
+++ b/docs/.vuepress/config.js
@@ -106,6 +106,7 @@ module.exports = {
'modules.md',
],
},
+ ['faq.md', 'FAQ'],
{
title: 'Community',
... | 1 | 1 | 1 | [{"id": "G0", "claim": "The blanket statement that the order of fx.Options does not matter is wrong for the order in which fx.Invoke'd functions get run; consider exempting Invoke from the statement.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
uber-go__fx__1191 | uber-go/fx | 1,191 | defect | 9814dd34b23dbb6e1ab992f80d4fb388863cd200 | a7bed350d836421e85f73af17ba05573d3897f5f | Provide Fx types before user types | Consider the following example:
```go
func opts() fx.Option {
return fx.Options(
fx.WithLogger(func(fx.Lifecycle) fxevent.Logger {
return &fxevent.ConsoleLogger{ W: os.Stdout }
}),
fx.Provide(func() string { return "" }),
... | diff --git a/app.go b/app.go
index 8ede19eb5..244c402ce 100644
--- a/app.go
+++ b/app.go
@@ -480,10 +480,6 @@ func New(opts ...Option) *App {
m.build(app, app.container)
}
- for _, m := range app.modules {
- m.provideAll()
- }
-
frames := fxreflect.CallerStack(0, 0) // include New in the stack for default Pro... | 3 | 3 | 0 | [{"id": "G0", "claim": "A comment should be added in app.go describing why the Fx-provided dependencies are provided to the scope prior to the user-provided types.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The internal Fx types' OutputTypeNam... | null |
uber-go__fx__1198 | uber-go/fx | 1,198 | defect | 2379ac906bbf063deb99033c995584234388fc98 | 2ef134c1638c18b900d57de3205288ccd56ab9f9 | Call signal.Stop when signalReceivers is stopped | fixes #1197 | diff --git a/signal.go b/signal.go
index 71d2204a0..1b8456899 100644
--- a/signal.go
+++ b/signal.go
@@ -46,8 +46,9 @@ func (sig ShutdownSignal) String() string {
func newSignalReceivers() signalReceivers {
return signalReceivers{
- notify: signal.Notify,
- signals: make(chan os.Signal, 1),
+ notify: signa... | 1 | 1 | 0 | [{"id": "G0", "claim": "The test's stopCalledTimes counter does not need to be atomic since Stop should not return until stopNotify completes, so there is no concurrent access.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
uber-go__fx__1201 | uber-go/fx | 1,201 | defect | 696ed9a6457aed98e11e465738efb4989cfb33f1 | c2ff838fda5f146689d6aaab5ed8d201acbedc20 | fx.Self: a parameter to fx.As for providing a type as itself | We frequently see requests for folks who want to use `fx.As` to provide a type as another type, while also providing it as itself. To name a few:
* https://github.com/uber-go/fx/discussions/1196
* https://github.com/uber-go/fx/discussions/1148
* https://github.com/uber-go/fx/discussions/1079
This is currently not... | diff --git a/annotated.go b/annotated.go
index 4e0238661..adbc9e2d5 100644
--- a/annotated.go
+++ b/annotated.go
@@ -1097,7 +1097,19 @@ func OnStop(onStop interface{}) Annotation {
type asAnnotation struct {
targets []interface{}
- types []reflect.Type
+ types []asType
+}
+
+type asType struct {
+ self bool
+ ... | 2 | 2 | 0 | [{"id": "G0", "claim": "The AsSelf field added to the annotated struct is unused anywhere in this PR and should be removed.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "Add another test case with exactly fx.As(fx.Self(), new(io.Writer)) plus a... | null |
uber-go__fx__1203 | uber-go/fx | 1,203 | defect | abda254ddb674d9c3570441fb3c5369609392530 | 5054ff756f793729f2803fd914f240a3c36f0c70 | fxtest: Enforceable Timeouts on Lifecycle | In Fx, if starting/stopping the application takes longer than the context's timeout, the fx.App will bail early, regardless of the status of the currently running hooks.
This prevents stalling an application when hooks (accidentally) block forever.
In order to test hook behavior, Fx provides fxtest.Lifecycle to i... | diff --git a/fxtest/lifecycle.go b/fxtest/lifecycle.go
index 111840727..ef7a21070 100644
--- a/fxtest/lifecycle.go
+++ b/fxtest/lifecycle.go
@@ -66,18 +66,45 @@ func (t *panicT) FailNow() {
panic("test lifecycle failed")
}
+// LifecycleOption modifies the behavior of the [Lifecycle]
+// when passed to [NewLifecycl... | 7 | 6 | 0 | [{"id": "G0", "claim": "Changing NewLifecycle to take variadic options alters its signature and is a breaking change under Go compatibility guarantees (it breaks passing the function as a value, e.g. as fastest.NewLifecycle), so a non-breaking alternative such as NewLifecycleWith, NewLifecycleWithOptions or NewStrictLi... | null |
uber-go__fx__1207 | uber-go/fx | 1,207 | defect | 9e6f6c21af133f94ea22563f1f24bb3caa52e3f7 | 258fe125ad6fec5cc13f1a1743a8ce46db5389b2 | Support fx.Private w/ fx.Supply | `fx.Supply` is essentially an API that allows for conveniently `fx.Provide`ing an exact value, rather than a function that will return that value. For example, `fx.Provide(func() int { return 5 })` is equivalent to `fx.Supply(5)`.
`fx.Private` allows for usage of a provided constructor's results to be restricted to ... | diff --git a/app_test.go b/app_test.go
index 727828be8..fb3106467 100644
--- a/app_test.go
+++ b/app_test.go
@@ -391,134 +391,227 @@ func TestNewApp(t *testing.T) {
})
}
-func TestPrivateProvide(t *testing.T) {
+// TestPrivate tests Private when used with both fx.Provide and fx.Supply.
+func TestPrivate(t *testing... | 1 | 1 | 0 | [{"id": "G0", "claim": "The naked boolean parameters in the tt.provide test call sites hurt readability; add a comment such as /* private */ per the Uber Go style guide.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}] | null |
uber-go__fx__1215 | uber-go/fx | 1,215 | defect | d0d12e909cb11b142686311b1e6f1a0c0bbaa28c | f4451485e44f8c9b1ab1e27f6b7b2cddcea28eb0 | fix: Only register signal handlers if user intends to use them | closes #1212, and fixes a regression from #989. Previously we would only register signal handlers if the user intended to use them. #989 changed this behavior [here](https://github.com/uber-go/fx/pull/989/files#diff-6c4b6ed7dc8834cef100f50dae61c30ffe7775a3f3f6f5a557517cb740c44a2dR649).
This regression meant that if ... | diff --git a/app.go b/app.go
index 8189f9d71..510bbafb2 100644
--- a/app.go
+++ b/app.go
@@ -256,6 +256,23 @@ func (l loggerOption) String() string {
return fmt.Sprintf("fx.Logger(%v)", l.p)
}
+func DisableSignalHandler() Option {
+ return disableSignalHandler{}
+}
+
+type disableSignalHandler struct{}
+
+var _ Op... | 13 | 4 | 0 | [{"id": "G0", "claim": "TestDisableSignalHandler's final assertion could be a single assert.Equal(t, disableSignalHandler, !calledNotify) instead of the if/else.", "category": "testing", "verdict": "uncertain", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "If DisableSignalHandler would be used only f... | null |
uber-go__fx__1267 | uber-go/fx | 1,267 | defect | ca61c3dc78a6ac0a5991fafa86546e00b7fcb47a | e5d05c0d009cb084f3b4a1bed8edb4e519f2d917 | Adding a before-call-begins fxevent, to help with troubleshooting | # What
Adds a "BeforeRun" fxevent.Event, mirroring "Run" but it is called _before_ the provided func is called by Dig, rather than after.
This relies on https://github.com/uber-go/dig/pull/431 (released as v1.19.0).
# Motivation
A recent startup-issue debugging session included logs like this:
```
{"level... | diff --git a/app_test.go b/app_test.go
index 623acad47..5344389de 100644
--- a/app_test.go
+++ b/app_test.go
@@ -365,7 +365,7 @@ func TestNewApp(t *testing.T) {
defer app.RequireStart().RequireStop()
require.Equal(t,
- []string{"Provided", "Provided", "Provided", "Provided", "Decorated", "LoggerInitialized", ... | 1 | 1 | 1 | [{"id": "G0", "claim": "The temporary go.mod replace directive pointing go.uber.org/dig at the Groxx fork should be removed or updated before the pull request is merged.", "category": "maintainability", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
uber-go__fx__128 | uber-go/fx | 128 | defect | 8af54b1a294950a785751ee897aa85d37fcfbcee | fb8f3bf8a4d6fbddea3f9acfb44c16999f6abbac | Slim down Context and propogate through uhttp | GFM-248, GFM-256
Fixes #126 | diff --git a/context.go b/context.go
index 4c1554c5b..033627906 100644
--- a/context.go
+++ b/context.go
@@ -24,18 +24,51 @@ import (
gcontext "context"
"go.uber.org/fx/service"
+ "go.uber.org/fx/ulog"
)
+var _logger = "logger"
+
// Context embeds Host and Go stdlib context for use
type Context interface {
... | 7 | 4 | 3 | [{"id": "G0", "claim": "Asks whether Convert should type-assert for an existing fx.Context before wrapping, since the author is unsure whether the check is cheaper than the additional allocation.", "category": "performance", "verdict": "uncertain", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "The pu... | null |
uber-go__fx__295 | uber-go/fx | 295 | defect | 90408de2343bafa205ccf32f29087ea78cf67026 | 92c7a80f2614e7d8b74140ed144baeffbdb0478a | Prevent dig cycles | This is a must for beta, because it has the ability to overflow panic the stack if types are not registered correctly.
Fixes #282 | diff --git a/dig/dig.go b/dig/dig.go
index 5198eafcd..dcbdf4d88 100644
--- a/dig/dig.go
+++ b/dig/dig.go
@@ -29,6 +29,7 @@ var (
errReturnCount = errors.New("constructor function must return exactly one value")
errReturnKind = errors.New("constructor return type must be a pointer")
errArgKind = errors.New("c... | 6 | 2 | 0 | [{"id": "G0", "claim": "Register should panic on a detected cycle (or registration be restricted to initialization and not exported) instead of returning an error, since it seems it will only be used on initialization.", "category": "design", "verdict": "opposed", "priority": "P3", "scope": "introduced"}, {"id": "G1", ... | null |
uber-go__fx__375 | uber-go/fx | 375 | defect | 2470d0eb08dc8aa4aaeacb19189e91949380896c | be41bd1c16bc13de8e487d1b83b933379dd197fc | dig: Constructors can now return errors | This allows constructors to fail with an error.
func NewMyResult(...) (*MyResult, error) {
// ..
}
The error is wrapped for every layer so that you get,
unable to resolve Foo:
unable to resolve *MyResult:
root cause
This works by changing `funcNode`s to always be functi... | diff --git a/dig/dig.go b/dig/dig.go
index 0beecb9f2..c4f333e3e 100644
--- a/dig/dig.go
+++ b/dig/dig.go
@@ -30,12 +30,39 @@ import (
)
var (
- errParamType = errors.New("graph injection must be done through a pointer or a function")
- errReturnCount = errors.New("constructor function must return exactly one valu... | 4 | 2 | 1 | [{"id": "G0", "claim": "Consider wrapping the constructor's ($type, error) return under a dig.Object-style struct so the rule becomes 'dig constructors must return dig.Object', leaving the API room to maneuver in the future (named types, scopes).", "category": "design", "verdict": "uncertain", "priority": "P2", "scope"... | null |
uber-go__fx__522 | uber-go/fx | 522 | defect | 93832e5027ec4a789c98ed74ff967fe0d2cb9d26 | 2ab82a1e4df31496e54ce5921bf43672d70d8015 | Move TestLifecycle into an fxtest subpackage | This PR moves the testing spy for `fx.Lifecycle` into a separate
`fxtest` subpackage. This cleans up the documentation for the main
package and lets us (in the future) take dependencies on the `testing`
package in our test helpers.
Fixes #520. | diff --git a/app.go b/app.go
index 4636ee5567..a44bad1021 100644
--- a/app.go
+++ b/app.go
@@ -188,7 +188,7 @@ func (app *App) Start(ctx context.Context) error {
// called are executed. However, all those hooks are always executed, even if
// some fail.
func (app *App) Stop(ctx context.Context) error {
- return with... | 6 | 5 | 1 | [{"id": "G0", "claim": "The Fataler API should use Errorf plus FailNow instead of Fatalf so aborting the test is optional and testify's TestingT is satisfied.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "NewLifecycle creating a real app and starting an... | null |
uber-go__fx__536 | uber-go/fx | 536 | defect | 17f5df208e4cca4b1e090d90a6426fa615adf42a | 0c62b41ec37bc25f2ff04f5af622ab29261bce3b | Provide a testing harness for apps | Currently, it's irritating for module owners to integration test their code - they have to use the plain `fx.App` type, which is a bit verbose for common test assertions. More importantly, `fx.App` writes verbose logs to standard error. Since Go's testing library buffers all console output and displays it when tests fa... | diff --git a/app.go b/app.go
index bc595d563..4c0ab941f 100644
--- a/app.go
+++ b/app.go
@@ -113,6 +113,20 @@ func Options(opts ...Option) Option {
})
}
+// Printer is the interface required by fx's logging backend. It's implemented
+// by most loggers, including the standard library's.
+type Printer interface {
+... | 5 | 4 | 0 | [{"id": "G0", "claim": "Now that Printer is embedded in Logger, Println should call l.Printf instead of the explicit l.Printer.Printf.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "*zap.Logger has no Printf, so it does not satisfy the new Print... | null |
uber-go__fx__551 | uber-go/fx | 551 | defect | 23e5ae1ccc50f3ccb254a8ccb4c1e6e0762f9e90 | 718703e447f0b240cedbd531a519308b9cb2afc1 | Run Invokes during New, not during Start | This builds on top of a lot of previous work, most notably the refactor
of the top level API to no longer expose `Provide` and `Invoke` on the
app object. Now that all options have to atomically be provided on
`New`, it no longer makes sense to wait until the application start to
resolve.
All the heavy-weight wo... | diff --git a/app.go b/app.go
index 4c0ab941f..b7b062411 100644
--- a/app.go
+++ b/app.go
@@ -138,7 +138,13 @@ type App struct {
// New creates and initializes an App. All applications begin with the
// Lifecycle type available in their dependency injection container.
+//
+// It then executes all functions supplied ... | 7 | 6 | 3 | [{"id": "G0", "claim": "New should simply panic instead of returning an error, since there is nothing the user can do to recover.", "category": "design", "verdict": "opposed", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The invoke-execution block inside New should be moved into a private App functi... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.