Always include debug symbols with -c dbg (#3029)

Previously, debugging a go_test target was only possible with an
explicit --@io_bazel_rules_go//go/config:debug.

Fixes https://github.com/bazelbuild/intellij/issues/2313.
diff --git a/BUILD.bazel b/BUILD.bazel
index 1c92682..fca662c 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -107,7 +107,11 @@
 # to depend on all build settings directly.
 go_config(
     name = "go_config",
-    debug = "//go/config:debug",
+    # Always include debug symbols with -c dbg.
+    debug = select({
+        "//go/private:is_compilation_mode_dbg": "//go/private:always_true",
+        "//conditions:default": "//go/config:debug",
+    }),
     gotags = "//go/config:tags",
     linkmode = "//go/config:linkmode",
     msan = "//go/config:msan",
diff --git a/go/modes.rst b/go/modes.rst
index 0bbfb1e..4ad783d 100644
--- a/go/modes.rst
+++ b/go/modes.rst
@@ -78,7 +78,7 @@
 | :param:`debug`    | :type:`bool`        | :value:`false`                     |
 +-------------------+---------------------+------------------------------------+
 | Includes debugging information in compiled packages (using the ``-N`` and    |
-| ``-l`` flags).                                                               |
+| ``-l`` flags). This is always true with ``-c dbg``.                          |
 +-------------------+---------------------+------------------------------------+
 | :param:`gotags`   | :type:`string_list` | :value:`[]`                        |
 +-------------------+---------------------+------------------------------------+
diff --git a/go/private/BUILD.bazel b/go/private/BUILD.bazel
index efe2db7..47602d9 100644
--- a/go/private/BUILD.bazel
+++ b/go/private/BUILD.bazel
@@ -180,3 +180,18 @@
         ":request_nogo": "True",
     },
 )
+
+bool_setting(
+    name = "always_true",
+    build_setting_default = True,
+    visibility = ["//visibility:public"],
+)
+
+# Only used by //:go_config.
+config_setting(
+    name = "is_compilation_mode_dbg",
+    values = {
+        "compilation_mode": "dbg",
+    },
+    visibility = ["//:__pkg__"],
+)