-
Notifications
You must be signed in to change notification settings - Fork 0
produce fix, view and apply fix
$ bazel build –keep_going //src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher:go_default_test –override_repository=io_bazel_rules_go=~/rules_go
with –keep_going, it dumps fixes for all dependent targets even if one fails the linter. without it, it dumps fixes and stops on the first failed target.
see the output for –keep_going below: … ERROR: /home/user/go-code/src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher/BUILD.bazel:5:11: Validating nogo output for //src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher:go_default_library failed: (Exit 1): builder failed: error executing ValidateNogo command (from target //src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher:go_default_library) bazel-out/k8-opt-exec-ST-a828a81199fe/bin/external/go_sdk/builder_reset/builder nogovalidation … (remaining 4 arguments skipped)
Use –sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
nogo: errors found by nogo during build-time code analysis: src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher/patcher.go:17:2: self-assignment of y to y (assign)
To view the nogo fix, run the following command: $ jq -r ‘to_entries[] | .value | @text’ bazel-out/k8-fastbuild/bin/src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher/go_default_library.nogo.fix | tee
To apply the nogo fix, run the following command: $ jq -r ‘to_entries[] | .value | @text’ bazel-out/k8-fastbuild/bin/src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher/go_default_library.nogo.fix | patch -p1
~/go-code main <15226 !3 > jq -r ‘to_entries[] | .value | @text’ bazel-out/k8-fastbuild/bin/src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher/go_default_test.internal.nogo.fix | tee — a/src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher/patcher.go +++ b/src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher/patcher.go @@ -14,7 +14,7 @@ // ToPatches converts diagnostics to patches. func ToPatches(fileToEdits map[string][]changelib.Edit) (map[string]string, error) { var y int
- y = y
+ patches := make(map[string]string) for relativeFilePath, edits := range fileToEdits { // path is already relative to the workspace root, see NewChangeFromDiagnostics() in change.go
— a/src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher/patcher_test.go +++ b/src/code.uber.internal/infra/progsys/renovate/change-patcher/cmd/patcher/patcher_test.go @@ -11,7 +11,7 @@
func TestTrimLines(t *testing.T) { var z int
- z = z
+ t.Parallel()
tests := []struct {