How to install patch? in windows

when you execute a command on the cmd command line, / usr/bin/bash: patch: command not found appears. How do you install patch in windows? The specific errors are as follows:

D:\workspace\www\go_work\src\golang_learning>bazel run //:gazelle
Starting local Bazel server and connecting to it...
... still trying to connect to local Bazel server after 10 seconds ...
INFO: SHA256 (https://codeload.github.com/golang/tools/zip/3e7aa9e59977626dc60433e9aeadf1bb63d28295) = 2384fa91351a7414b643c5230422ce45f5aa2be8a82727609afd4e64e6973a30
ERROR: Analysis of target "//:gazelle" failed; build aborted: no such package "@org_golang_x_tools//go/gcexportdata": Traceback (most recent call last):
        File "C:/users/dell/_bazel_dell/4tmnaczu/external/bazel_tools/tools/build_defs/repo/http.bzl", line 55
                patch(ctx)
        File "C:/users/dell/_bazel_dell/4tmnaczu/external/bazel_tools/tools/build_defs/repo/utils.bzl", line 80, in patch
                fail(("Error applying patch %s:\n%s%s...)))
Error applying patch @io_bazel_rules_go//third_party:org_golang_x_tools-gazelle.patch:
/usr/bin/bash: patch: command not found
INFO: Elapsed time: 689.731s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (42 packages loaded)
FAILED: Build did NOT complete successfully (42 packages loaded)



Cmd
Oct.25,2021

https://docs.bazel.build/vers.

As mentioned in the

official documentation, there are MSYS2 pre-installed dependencies, which is actually a posix simulation environment, similar to mingw32 and Cygwin, with patch commands.

https://docs.bazel.build/vers.

The

document also mentions that you should configure environment variables if you are not running under MSYS2 shell.

the problems of the subject are all caused by not reading the official documents carefully. It is recommended to read through the official documents first.

Menu