Update by running buildifier (#764)

diff --git a/BUILD b/BUILD
index c09243e..0d6586f 100644
--- a/BUILD
+++ b/BUILD
@@ -32,24 +32,24 @@
 
 go_path(
     name = "all_srcs",
+    tags = ["manual"],
     deps = [
         "//go/tools/builders:asm",
+        "//go/tools/builders:cgo",
         "//go/tools/builders:compile",
         "//go/tools/builders:embed",
         "//go/tools/builders:generate_test_main",
         "//go/tools/builders:link",
-        "//go/tools/builders:cgo",
         "//go/tools/builders:md5sum",
-        "//go/tools/gazelle/gazelle:gazelle",
-        "//go/tools/fetch_repo:fetch_repo",
-        "//go/tools/wtool:wtool",
+        "//go/tools/fetch_repo",
+        "//go/tools/gazelle/gazelle",
+        "//go/tools/wtool",
     ],
-    tags = ["manual"],
 )
 
 go_vet_test(
     name = "vet",
-    data = [":all_srcs"]
+    data = [":all_srcs"],
 )
 
 go_info()
diff --git a/examples/bindata/BUILD.bazel b/examples/bindata/BUILD.bazel
index 500b028..4a8c60e 100644
--- a/examples/bindata/BUILD.bazel
+++ b/examples/bindata/BUILD.bazel
@@ -2,19 +2,19 @@
 load("@io_bazel_rules_go//examples/bindata:bindata.bzl", "bindata")
 
 bindata(
-  name = "data",
-  package = "bindata",
-  srcs = glob(["data/*"]),
+    name = "data",
+    srcs = glob(["data/*"]),
+    package = "bindata",
 )
 
 go_library(
-  name = "go_default_library",
-  srcs = [":data"],
+    name = "go_default_library",
+    srcs = [":data"],
 )
 
 go_test(
-  name = "go_default_test",
-  srcs = ["bindata_test.go"],
-  library = ":go_default_library",
-  size = "small"
-)
\ No newline at end of file
+    name = "go_default_test",
+    size = "small",
+    srcs = ["bindata_test.go"],
+    library = ":go_default_library",
+)
diff --git a/examples/cgo/BUILD b/examples/cgo/BUILD
index ec86887..dc02603 100644
--- a/examples/cgo/BUILD
+++ b/examples/cgo/BUILD
@@ -10,12 +10,12 @@
         "export_example.go",
         "generated.go",
         "import_example.go",
+        "pure_go.go",
         "use_exported.c",
         "use_exported.h",
-        "pure_go.go",
     ],
-    cgo = True,
     cdeps = ["//examples/cgo/cc_dependency:version"],
+    cgo = True,
     clinkopts = ["-lm"],
     copts = ["-DDEFINED_IN_COPTS=1"],
     visibility = ["//visibility:public"],
@@ -35,9 +35,9 @@
 
 go_test(
     name = "cgo_lib_test",
+    size = "small",
     srcs = ["cgo_lib_test.go"],
     library = ":go_default_library",
-    size = "small",
 )
 
 genrule(
diff --git a/examples/cgo/skip_go_library/BUILD b/examples/cgo/skip_go_library/BUILD
index 9e6d9ab..2f60c63 100644
--- a/examples/cgo/skip_go_library/BUILD
+++ b/examples/cgo/skip_go_library/BUILD
@@ -5,8 +5,8 @@
 go_library(
     name = "go_default_library",
     srcs = [
-        "types.go",
         "cgo_foo.go",
+        "types.go",
     ],
     cgo = True,
 )
diff --git a/examples/lib/BUILD b/examples/lib/BUILD
index 338985f..d154391 100644
--- a/examples/lib/BUILD
+++ b/examples/lib/BUILD
@@ -17,15 +17,16 @@
 
 go_test(
     name = "lib_test",
+    size = "small",
     srcs = [
         "lib_test.go",
     ],
     library = ":go_default_library",
-    size = "small",
 )
 
 go_test(
     name = "lib_external_test",
+    size = "small",
     srcs = [
         "lib_x_test.go",
     ],
@@ -39,5 +40,4 @@
     deps = [
         ":go_default_library",
     ],
-    size = "small",
 )
diff --git a/examples/proto/BUILD b/examples/proto/BUILD
index f170443..ae193c5 100644
--- a/examples/proto/BUILD
+++ b/examples/proto/BUILD
@@ -12,7 +12,7 @@
 
 go_test(
     name = "proto_test",
+    size = "small",
     srcs = ["proto_test.go"],
     deps = ["//examples/proto/lib:lib_proto"],
-    size = "small",
 )
diff --git a/examples/stamped_bin/BUILD b/examples/stamped_bin/BUILD
index 3348609..5d04328 100644
--- a/examples/stamped_bin/BUILD
+++ b/examples/stamped_bin/BUILD
@@ -2,6 +2,7 @@
 
 go_test(
     name = "stamp_with_linkstamp",
+    size = "small",
     srcs = ["stamped_bin_test.go"],
     linkstamp = "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp",
     x_defs = {
@@ -10,11 +11,11 @@
         "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp.XdefInvalid": "{Undefined_Var}",  # undefined should leave the var alone
     },
     deps = ["//examples/stamped_bin/stamp:go_default_library"],
-    size = "small",
 )
 
 go_test(
     name = "stamp_with_x_defs",
+    size = "small",
     srcs = ["stamped_bin_test.go"],
     x_defs = {
         "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp.BUILD_TIMESTAMP": "{BUILD_TIMESTAMP}",
@@ -23,11 +24,11 @@
         "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp.XdefInvalid": "{Undefined_Var}",  # undefined should leave the var alone
     },
     deps = ["//examples/stamped_bin/stamp:go_default_library"],
-    size = "small",
 )
 
 go_test(
     name = "stamp_with_linkstamp_and_x_defs",
+    size = "small",
     srcs = ["stamped_bin_test.go"],
     linkstamp = "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp",
     x_defs = {
@@ -36,5 +37,4 @@
         "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp.XdefInvalid": "{Undefined_Var}",  # undefined should leave the var alone
     },
     deps = ["//examples/stamped_bin/stamp:go_default_library"],
-    size = "small",
 )
diff --git a/go/private/BUILD b/go/private/BUILD
index 919ff30..17b1fb4 100644
--- a/go/private/BUILD
+++ b/go/private/BUILD
@@ -8,24 +8,27 @@
 
 config_setting(
     name = "fastbuild",
-    values = {"compilation_mode": "fastbuild"}
+    values = {"compilation_mode": "fastbuild"},
 )
 
 config_setting(
     name = "debug",
-    values = {"compilation_mode": "dbg"}
+    values = {"compilation_mode": "dbg"},
 )
 
 config_setting(
     name = "optimized",
-    values = {"compilation_mode": "opt"}
+    values = {"compilation_mode": "opt"},
 )
 
 go_toolchain_flags(
     name = "go_toolchain_flags",
     compile_flags = select({
         "@io_bazel_rules_go//go/private:fastbuild": [],
-        "@io_bazel_rules_go//go/private:debug": ["-N", "-l"],
+        "@io_bazel_rules_go//go/private:debug": [
+            "-N",
+            "-l",
+        ],
         "@io_bazel_rules_go//go/private:optimized": [],
     }),
     visibility = ["@io_bazel_rules_go//go/toolchain:__subpackages__"],
diff --git a/go/toolchain/BUILD b/go/toolchain/BUILD
index 1190420..45ca2d3 100644
--- a/go/toolchain/BUILD
+++ b/go/toolchain/BUILD
@@ -1,80 +1,423 @@
 package(default_visibility = ["//visibility:public"])
 
-load(':toolchains.bzl', 'declare_toolchains')
+load(":toolchains.bzl", "declare_toolchains")
 
-alias(name="darwin", actual="@bazel_tools//platforms:osx")
-alias(name="linux", actual="@bazel_tools//platforms:linux")
-alias(name="freebsd", actual="@bazel_tools//platforms:freebsd")
-alias(name="windows", actual="@bazel_tools//platforms:windows")
-constraint_value(name = "android", constraint_setting = "@bazel_tools//platforms:os")
-constraint_value(name = "dragonfly", constraint_setting = "@bazel_tools//platforms:os")
-constraint_value(name = "netbsd", constraint_setting = "@bazel_tools//platforms:os")
-constraint_value(name = "openbsd", constraint_setting = "@bazel_tools//platforms:os")
-constraint_value(name = "plan9", constraint_setting = "@bazel_tools//platforms:os")
-constraint_value(name = "solaris", constraint_setting = "@bazel_tools//platforms:os")
+alias(
+    name = "darwin",
+    actual = "@bazel_tools//platforms:osx",
+)
 
-alias(name="arm", actual="@bazel_tools//platforms:arm")
-alias(name="386", actual="@bazel_tools//platforms:x86_32")
-alias(name="amd64", actual="@bazel_tools//platforms:x86_64")
-alias(name="ppc64", actual="@bazel_tools//platforms:ppc")
-constraint_value(name = "arm64", constraint_setting = "@bazel_tools//platforms:cpu")
-constraint_value(name = "ppc64le", constraint_setting = "@bazel_tools//platforms:cpu")
-constraint_value(name = "mips", constraint_setting = "@bazel_tools//platforms:cpu")
-constraint_value(name = "mipsle", constraint_setting = "@bazel_tools//platforms:cpu")
-constraint_value(name = "mips64", constraint_setting = "@bazel_tools//platforms:cpu")
-constraint_value(name = "mips64le", constraint_setting = "@bazel_tools//platforms:cpu")
+alias(
+    name = "linux",
+    actual = "@bazel_tools//platforms:linux",
+)
+
+alias(
+    name = "freebsd",
+    actual = "@bazel_tools//platforms:freebsd",
+)
+
+alias(
+    name = "windows",
+    actual = "@bazel_tools//platforms:windows",
+)
+
+constraint_value(
+    name = "android",
+    constraint_setting = "@bazel_tools//platforms:os",
+)
+
+constraint_value(
+    name = "dragonfly",
+    constraint_setting = "@bazel_tools//platforms:os",
+)
+
+constraint_value(
+    name = "netbsd",
+    constraint_setting = "@bazel_tools//platforms:os",
+)
+
+constraint_value(
+    name = "openbsd",
+    constraint_setting = "@bazel_tools//platforms:os",
+)
+
+constraint_value(
+    name = "plan9",
+    constraint_setting = "@bazel_tools//platforms:os",
+)
+
+constraint_value(
+    name = "solaris",
+    constraint_setting = "@bazel_tools//platforms:os",
+)
+
+alias(
+    name = "arm",
+    actual = "@bazel_tools//platforms:arm",
+)
+
+alias(
+    name = "386",
+    actual = "@bazel_tools//platforms:x86_32",
+)
+
+alias(
+    name = "amd64",
+    actual = "@bazel_tools//platforms:x86_64",
+)
+
+alias(
+    name = "ppc64",
+    actual = "@bazel_tools//platforms:ppc",
+)
+
+constraint_value(
+    name = "arm64",
+    constraint_setting = "@bazel_tools//platforms:cpu",
+)
+
+constraint_value(
+    name = "ppc64le",
+    constraint_setting = "@bazel_tools//platforms:cpu",
+)
+
+constraint_value(
+    name = "mips",
+    constraint_setting = "@bazel_tools//platforms:cpu",
+)
+
+constraint_value(
+    name = "mipsle",
+    constraint_setting = "@bazel_tools//platforms:cpu",
+)
+
+constraint_value(
+    name = "mips64",
+    constraint_setting = "@bazel_tools//platforms:cpu",
+)
+
+constraint_value(
+    name = "mips64le",
+    constraint_setting = "@bazel_tools//platforms:cpu",
+)
 
 # Version constraints
 constraint_setting(name = "go_version")
+
 constraint_setting(name = "go_minor_version")
+
 constraint_setting(name = "go_point_version")
 
-constraint_value(name = "go1", constraint_setting = ":go_version")
-constraint_value(name = "go1.9", constraint_setting = ":go_minor_version")
-constraint_value(name = "go1.9.0", constraint_setting = ":go_point_version")
-constraint_value(name = "go1.8", constraint_setting = ":go_minor_version")
-constraint_value(name = "go1.8.3", constraint_setting = ":go_point_version")
-constraint_value(name = "go1.8.2", constraint_setting = ":go_point_version")
-constraint_value(name = "go1.8.1", constraint_setting = ":go_point_version")
-constraint_value(name = "go1.8.0", constraint_setting = ":go_point_version")
-constraint_value(name = "go1.7", constraint_setting = ":go_minor_version")
-constraint_value(name = "go1.7.6", constraint_setting = ":go_point_version")
-constraint_value(name = "go1.7.5", constraint_setting = ":go_version")
-constraint_value(name = "gohost", constraint_setting = ":go_version")
+constraint_value(
+    name = "go1",
+    constraint_setting = ":go_version",
+)
+
+constraint_value(
+    name = "go1.9",
+    constraint_setting = ":go_minor_version",
+)
+
+constraint_value(
+    name = "go1.9.0",
+    constraint_setting = ":go_point_version",
+)
+
+constraint_value(
+    name = "go1.8",
+    constraint_setting = ":go_minor_version",
+)
+
+constraint_value(
+    name = "go1.8.3",
+    constraint_setting = ":go_point_version",
+)
+
+constraint_value(
+    name = "go1.8.2",
+    constraint_setting = ":go_point_version",
+)
+
+constraint_value(
+    name = "go1.8.1",
+    constraint_setting = ":go_point_version",
+)
+
+constraint_value(
+    name = "go1.8.0",
+    constraint_setting = ":go_point_version",
+)
+
+constraint_value(
+    name = "go1.7",
+    constraint_setting = ":go_minor_version",
+)
+
+constraint_value(
+    name = "go1.7.6",
+    constraint_setting = ":go_point_version",
+)
+
+constraint_value(
+    name = "go1.7.5",
+    constraint_setting = ":go_version",
+)
+
+constraint_value(
+    name = "gohost",
+    constraint_setting = ":go_version",
+)
 
 declare_toolchains()
 
-
 # We declare these platform values just for convienence and reference
 # Most projects should declare their own valid platform values with any additional constraints
-platform(name="android_arm", constraint_values = [ ":android", ":arm"])
-platform(name="darwin_386", constraint_values = [ ":darwin", ":386"])
-platform(name="darwin_amd64", constraint_values = [ ":darwin", ":amd64"])
-platform(name="darwin_arm", constraint_values = [ ":darwin", ":arm"])
-platform(name="darwin_arm64", constraint_values = [ ":darwin", ":arm64"])
-platform(name="dragonfly_amd64", constraint_values = [ ":dragonfly", ":amd64"])
-platform(name="freebsd_386", constraint_values = [ ":freebsd", ":386"])
-platform(name="freebsd_amd64", constraint_values = [ ":freebsd", ":amd64"])
-platform(name="freebsd_arm", constraint_values = [ ":freebsd", ":arm"])
-platform(name="linux_386", constraint_values = [ ":linux", ":386"])
-platform(name="linux_amd64", constraint_values = [ ":linux", ":amd64"])
-platform(name="linux_arm", constraint_values = [ ":linux", ":arm"])
-platform(name="linux_arm64", constraint_values = [ ":linux", ":arm64"])
-platform(name="linux_ppc64", constraint_values = [ ":linux", ":ppc64"])
-platform(name="linux_ppc64le", constraint_values = [ ":linux", ":ppc64le"])
-platform(name="linux_mips", constraint_values = [ ":linux", ":mips"])
-platform(name="linux_mipsle", constraint_values = [ ":linux", ":mipsle"])
-platform(name="linux_mips64", constraint_values = [ ":linux", ":mips64"])
-platform(name="linux_mips64le", constraint_values = [ ":linux", ":mips64le"])
-platform(name="netbsd_386", constraint_values = [ ":netbsd", ":386"])
-platform(name="netbsd_amd64", constraint_values = [ ":netbsd", ":amd64"])
-platform(name="netbsd_arm", constraint_values = [ ":netbsd", ":arm"])
-platform(name="openbsd_386", constraint_values = [ ":openbsd", ":386"])
-platform(name="openbsd_amd64", constraint_values = [ ":openbsd", ":amd64"])
-platform(name="openbsd_arm", constraint_values = [ ":openbsd", ":arm"])
-platform(name="plan9_386", constraint_values = [ ":plan9", ":386"])
-platform(name="plan9_amd64", constraint_values = [ ":plan9", ":amd64"])
-platform(name="solaris_amd64", constraint_values = [ ":solaris", ":amd64"])
-platform(name="windows_386", constraint_values = [ ":windows", ":386"])
-platform(name="windows_amd64", constraint_values = [ ":windows", ":amd64"])
-platform(name="host", constraint_values = [":linux", ":amd64", ":gohost"])
+platform(
+    name = "android_arm",
+    constraint_values = [
+        ":android",
+        ":arm",
+    ],
+)
+
+platform(
+    name = "darwin_386",
+    constraint_values = [
+        ":darwin",
+        ":386",
+    ],
+)
+
+platform(
+    name = "darwin_amd64",
+    constraint_values = [
+        ":darwin",
+        ":amd64",
+    ],
+)
+
+platform(
+    name = "darwin_arm",
+    constraint_values = [
+        ":darwin",
+        ":arm",
+    ],
+)
+
+platform(
+    name = "darwin_arm64",
+    constraint_values = [
+        ":darwin",
+        ":arm64",
+    ],
+)
+
+platform(
+    name = "dragonfly_amd64",
+    constraint_values = [
+        ":dragonfly",
+        ":amd64",
+    ],
+)
+
+platform(
+    name = "freebsd_386",
+    constraint_values = [
+        ":freebsd",
+        ":386",
+    ],
+)
+
+platform(
+    name = "freebsd_amd64",
+    constraint_values = [
+        ":freebsd",
+        ":amd64",
+    ],
+)
+
+platform(
+    name = "freebsd_arm",
+    constraint_values = [
+        ":freebsd",
+        ":arm",
+    ],
+)
+
+platform(
+    name = "linux_386",
+    constraint_values = [
+        ":linux",
+        ":386",
+    ],
+)
+
+platform(
+    name = "linux_amd64",
+    constraint_values = [
+        ":linux",
+        ":amd64",
+    ],
+)
+
+platform(
+    name = "linux_arm",
+    constraint_values = [
+        ":linux",
+        ":arm",
+    ],
+)
+
+platform(
+    name = "linux_arm64",
+    constraint_values = [
+        ":linux",
+        ":arm64",
+    ],
+)
+
+platform(
+    name = "linux_ppc64",
+    constraint_values = [
+        ":linux",
+        ":ppc64",
+    ],
+)
+
+platform(
+    name = "linux_ppc64le",
+    constraint_values = [
+        ":linux",
+        ":ppc64le",
+    ],
+)
+
+platform(
+    name = "linux_mips",
+    constraint_values = [
+        ":linux",
+        ":mips",
+    ],
+)
+
+platform(
+    name = "linux_mipsle",
+    constraint_values = [
+        ":linux",
+        ":mipsle",
+    ],
+)
+
+platform(
+    name = "linux_mips64",
+    constraint_values = [
+        ":linux",
+        ":mips64",
+    ],
+)
+
+platform(
+    name = "linux_mips64le",
+    constraint_values = [
+        ":linux",
+        ":mips64le",
+    ],
+)
+
+platform(
+    name = "netbsd_386",
+    constraint_values = [
+        ":netbsd",
+        ":386",
+    ],
+)
+
+platform(
+    name = "netbsd_amd64",
+    constraint_values = [
+        ":netbsd",
+        ":amd64",
+    ],
+)
+
+platform(
+    name = "netbsd_arm",
+    constraint_values = [
+        ":netbsd",
+        ":arm",
+    ],
+)
+
+platform(
+    name = "openbsd_386",
+    constraint_values = [
+        ":openbsd",
+        ":386",
+    ],
+)
+
+platform(
+    name = "openbsd_amd64",
+    constraint_values = [
+        ":openbsd",
+        ":amd64",
+    ],
+)
+
+platform(
+    name = "openbsd_arm",
+    constraint_values = [
+        ":openbsd",
+        ":arm",
+    ],
+)
+
+platform(
+    name = "plan9_386",
+    constraint_values = [
+        ":plan9",
+        ":386",
+    ],
+)
+
+platform(
+    name = "plan9_amd64",
+    constraint_values = [
+        ":plan9",
+        ":amd64",
+    ],
+)
+
+platform(
+    name = "solaris_amd64",
+    constraint_values = [
+        ":solaris",
+        ":amd64",
+    ],
+)
+
+platform(
+    name = "windows_386",
+    constraint_values = [
+        ":windows",
+        ":386",
+    ],
+)
+
+platform(
+    name = "windows_amd64",
+    constraint_values = [
+        ":windows",
+        ":amd64",
+    ],
+)
+
+platform(
+    name = "host",
+    constraint_values = [
+        ":linux",
+        ":amd64",
+        ":gohost",
+    ],
+)
diff --git a/go/tools/bazel/BUILD b/go/tools/bazel/BUILD
index 32316c3..46d41b0 100644
--- a/go/tools/bazel/BUILD
+++ b/go/tools/bazel/BUILD
@@ -8,10 +8,10 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["bazel_test.go"],
     data = [
         "README.md",
     ],
     library = ":go_default_library",
-    size = "small",
 )
diff --git a/go/tools/builders/BUILD b/go/tools/builders/BUILD
index 46918e5..185b7b4 100644
--- a/go/tools/builders/BUILD
+++ b/go/tools/builders/BUILD
@@ -3,11 +3,11 @@
 
 go_test(
     name = "filter_test",
+    size = "small",
     srcs = [
         "filter.go",
         "filter_test.go",
     ],
-    size = "small",
 )
 
 go_tool_binary(
@@ -23,8 +23,8 @@
     name = "compile",
     srcs = [
         "compile.go",
-        "flags.go",
         "filter.go",
+        "flags.go",
     ],
     visibility = ["//visibility:public"],
 )
@@ -57,9 +57,9 @@
 go_tool_binary(
     name = "cgo",
     srcs = [
-        "flags.go",
-        "filter.go",
         "cgo.go",
+        "filter.go",
+        "flags.go",
     ],
     visibility = ["//visibility:public"],
 )
@@ -71,4 +71,3 @@
     ],
     visibility = ["//visibility:public"],
 )
-
diff --git a/go/tools/extract_package/BUILD b/go/tools/extract_package/BUILD
index 15ac34c..e0372da 100644
--- a/go/tools/extract_package/BUILD
+++ b/go/tools/extract_package/BUILD
@@ -9,9 +9,9 @@
 
 go_test(
     name = "extract_package_test",
+    size = "small",
     srcs = [
         "extract.go",
         "extract_test.go",
     ],
-    size = "small",
 )
diff --git a/go/tools/fetch_repo/BUILD b/go/tools/fetch_repo/BUILD
index 551ee6d..311227e 100644
--- a/go/tools/fetch_repo/BUILD
+++ b/go/tools/fetch_repo/BUILD
@@ -15,8 +15,8 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["fetch_repo_test.go"],
     library = ":go_default_library",
     deps = ["@org_golang_x_tools//go/vcs:go_default_library"],
-    size = "small",
 )
diff --git a/go/tools/gazelle/config/BUILD b/go/tools/gazelle/config/BUILD
index a4d66bd..940c296 100644
--- a/go/tools/gazelle/config/BUILD
+++ b/go/tools/gazelle/config/BUILD
@@ -11,7 +11,7 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["config_test.go"],
     library = ":go_default_library",
-    size = "small",
 )
diff --git a/go/tools/gazelle/merger/BUILD b/go/tools/gazelle/merger/BUILD
index be90eb5..64e9ed7 100644
--- a/go/tools/gazelle/merger/BUILD
+++ b/go/tools/gazelle/merger/BUILD
@@ -4,22 +4,22 @@
     name = "go_default_library",
     srcs = [
         "fix.go",
-        "merger.go"
+        "merger.go",
     ],
     visibility = ["//visibility:public"],
     deps = [
-        "@io_bazel_rules_go//go/tools/gazelle/config:go_default_library",
         "@com_github_bazelbuild_buildtools//build:go_default_library",
+        "@io_bazel_rules_go//go/tools/gazelle/config:go_default_library",
     ],
 )
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = [
         "fix_test.go",
-        "merger_test.go"
+        "merger_test.go",
     ],
     library = ":go_default_library",
     deps = ["@com_github_bazelbuild_buildtools//build:go_default_library"],
-    size = "small",
 )
diff --git a/go/tools/gazelle/packages/BUILD b/go/tools/gazelle/packages/BUILD
index 691fb52..80f93b1 100644
--- a/go/tools/gazelle/packages/BUILD
+++ b/go/tools/gazelle/packages/BUILD
@@ -8,30 +8,30 @@
         "package.go",
         "walk.go",
     ],
+    visibility = ["//visibility:public"],
     deps = [
         "//go/tools/gazelle/config:go_default_library",
         "@com_github_bazelbuild_buildtools//build:go_default_library",
     ],
-    visibility = ["//visibility:public"],
 )
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = [
         "fileinfo_test.go",
         "package_test.go",
     ],
     library = ":go_default_library",
-    size = "small",
 )
 
 go_test(
     name = "go_default_xtest",
+    size = "small",
     srcs = ["walk_test.go"],
     deps = [
         ":go_default_library",
         "//go/tools/gazelle/config:go_default_library",
         "@com_github_bazelbuild_buildtools//build:go_default_library",
     ],
-    size = "small",
 )
diff --git a/go/tools/gazelle/resolve/BUILD b/go/tools/gazelle/resolve/BUILD
index a4c2a56..0d05668 100644
--- a/go/tools/gazelle/resolve/BUILD
+++ b/go/tools/gazelle/resolve/BUILD
@@ -9,25 +9,25 @@
         "resolve_structured.go",
         "resolve_vendored.go",
     ],
+    visibility = ["//visibility:public"],
     deps = [
         "@io_bazel_rules_go//go/tools/gazelle/config:go_default_library",
         "@org_golang_x_tools//go/vcs:go_default_library",
     ],
-    visibility = ["//visibility:public"],
 )
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = [
         "labeler_test.go",
         "resolve_external_test.go",
         "resolve_structured_test.go",
         "resolve_test.go",
     ],
+    library = ":go_default_library",
     deps = [
         "@io_bazel_rules_go//go/tools/gazelle/config:go_default_library",
         "@org_golang_x_tools//go/vcs:go_default_library",
     ],
-    library = ":go_default_library",
-    size = "small",
 )
diff --git a/go/tools/gazelle/rules/BUILD b/go/tools/gazelle/rules/BUILD
index 83686ff..3e5cc6f 100644
--- a/go/tools/gazelle/rules/BUILD
+++ b/go/tools/gazelle/rules/BUILD
@@ -21,6 +21,7 @@
 
 go_test(
     name = "go_default_xtest",
+    size = "small",
     srcs = ["generator_test.go"],
     deps = [
         ":go_default_library",
@@ -30,5 +31,4 @@
         "//go/tools/gazelle/testdata:go_default_library",
         "@com_github_bazelbuild_buildtools//build:go_default_library",
     ],
-    size = "small",
 )
diff --git a/go/tools/gazelle/wspace/BUILD b/go/tools/gazelle/wspace/BUILD
index 0031f96..648e164 100644
--- a/go/tools/gazelle/wspace/BUILD
+++ b/go/tools/gazelle/wspace/BUILD
@@ -8,7 +8,7 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["finder_test.go"],
     library = ":go_default_library",
-    size = "small",
 )
diff --git a/tests/asm_include/BUILD b/tests/asm_include/BUILD
index 719529f..f0112f6 100644
--- a/tests/asm_include/BUILD
+++ b/tests/asm_include/BUILD
@@ -29,7 +29,7 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["foo_test.go"],
     library = ":go_default_library",
-    size = "small",
 )
diff --git a/tests/binary_test_outputs/BUILD b/tests/binary_test_outputs/BUILD
index b309a74..d27928f 100644
--- a/tests/binary_test_outputs/BUILD
+++ b/tests/binary_test_outputs/BUILD
@@ -6,8 +6,8 @@
 
 single_output_test(
     name = "binary_single_output_test",
-    dep = ":bin",
     size = "small",
+    dep = ":bin",
 )
 
 go_binary(
@@ -18,13 +18,13 @@
 
 single_output_test(
     name = "test_single_output_test",
-    dep = ":test",
     size = "small",
+    dep = ":test",
 )
 
 go_test(
     name = "test",
+    size = "small",
     srcs = ["test.go"],
     tags = ["manual"],
-    size = "small",
 )
diff --git a/tests/cgo_select/BUILD b/tests/cgo_select/BUILD
index 83184bc..8f26fe2 100644
--- a/tests/cgo_select/BUILD
+++ b/tests/cgo_select/BUILD
@@ -44,7 +44,7 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["cgo_select_test.go"],
     library = ":go_default_library",
-    size = "small",
 )
diff --git a/tests/cgo_sys_hdr/BUILD b/tests/cgo_sys_hdr/BUILD
index 64d9355..24f1506 100644
--- a/tests/cgo_sys_hdr/BUILD
+++ b/tests/cgo_sys_hdr/BUILD
@@ -11,7 +11,7 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["foo_test.go"],
     library = ":go_default_library",
-    size = "small",
 )
diff --git a/tests/cgo_trans_deps/BUILD b/tests/cgo_trans_deps/BUILD
index ee17d26..6f3a130 100644
--- a/tests/cgo_trans_deps/BUILD
+++ b/tests/cgo_trans_deps/BUILD
@@ -3,13 +3,13 @@
 go_library(
     name = "go_default_library",
     srcs = ["cgo_lib.go"],
-    deps = ["//tests/cgo_trans_deps/dep:go_default_library"],
     cgo = True,
+    deps = ["//tests/cgo_trans_deps/dep:go_default_library"],
 )
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["cgo_test.go"],
     library = ":go_default_library",
-    size = "small",
 )
diff --git a/tests/coverage/BUILD b/tests/coverage/BUILD
index 1d3c49d..3ace6b3 100644
--- a/tests/coverage/BUILD
+++ b/tests/coverage/BUILD
@@ -18,14 +18,14 @@
 
 bazel_test(
     name = "coverage",
-    command = "coverage",
-    target = "//:go_default_test",
     check = """
 if ! grep -q '^coverage: 50.0% of statements' "bazel-testlogs/go_default_test/test.log"; then
   echo "error: no coverage output found in test log file" >&2
   exit 1
 fi
-    """
+    """,
+    command = "coverage",
+    target = "//:go_default_test",
 )
 
 go_binary(
@@ -41,8 +41,6 @@
 
 bazel_test(
     name = "bin_coverage",
-    command = "coverage",
-    target = "//:bin",
     check = """
 no_tests_found=4
 if [ "$result" -ne "$no_tests_found" ]; then
@@ -51,5 +49,6 @@
 fi
 result=0
 """,
+    command = "coverage",
+    target = "//:bin",
 )
-
diff --git a/tests/extldflags_rpath/BUILD b/tests/extldflags_rpath/BUILD
index 91dc339..13e21c2 100644
--- a/tests/extldflags_rpath/BUILD
+++ b/tests/extldflags_rpath/BUILD
@@ -15,8 +15,8 @@
 
 sh_test(
     name = "extldflags_rpath_test",
+    size = "small",
     srcs = ["extldflags_rpath_test.sh"],
     args = ["$(location :extldflags_rpath)"],
     data = [":extldflags_rpath"],
-    size = "small",
 )
diff --git a/tests/gc_opts_unsafe/BUILD b/tests/gc_opts_unsafe/BUILD
index 4ea08ff..f346d63 100644
--- a/tests/gc_opts_unsafe/BUILD
+++ b/tests/gc_opts_unsafe/BUILD
@@ -32,28 +32,28 @@
 
 go_test(
     name = "unsafe_srcs_test",
+    size = "small",
     srcs = [
         "empty_test.go",
         "unsafe.go",
     ],
     gc_goopts = ["-u"],
     tags = ["manual"],
-    size = "small",
 )
 
 go_test(
     name = "unsafe_library_test",
+    size = "small",
     library = ":unsafe_srcs_lib",
     tags = ["manual"],
-    size = "small",
 )
 
 go_library(
     name = "unsafe_cgo_lib",
     srcs = ["unsafe_cgo.go"],
+    cgo = True,
     gc_goopts = ["-u"],
     tags = ["manual"],
-    cgo = True,
 )
 
 go_library(
@@ -74,11 +74,11 @@
 
 go_test(
     name = "unsafe_link_test",
+    size = "small",
     srcs = [
         "empty_test.go",
         "unsafe.go",
     ],
     gc_linkopts = ["-u"],
     tags = ["manual"],
-    size = "small",
 )
diff --git a/tests/no_prefix/BUILD b/tests/no_prefix/BUILD
index 336dba9..7e6c630 100644
--- a/tests/no_prefix/BUILD
+++ b/tests/no_prefix/BUILD
@@ -16,13 +16,13 @@
 go_test(
     name = "go_default_xtest",
     srcs = ["no_prefix_test.go"],
-    deps = [":go_default_library"],
     importpath = "github.com/bazelbuild/rules_go/tests/no_prefix_test",
+    deps = [":go_default_library"],
 )
 
 go_binary(
     name = "cmd",
     srcs = ["cmd.go"],
-    deps = [":go_default_library"],
     importpath = "github.com/bazelbuild/rules_go/tests/no_prefix/cmd",
+    deps = [":go_default_library"],
 )
diff --git a/tests/package_named_build/BUILD b/tests/package_named_build/BUILD
index a829174..869b64e 100644
--- a/tests/package_named_build/BUILD
+++ b/tests/package_named_build/BUILD
@@ -7,16 +7,16 @@
 bazel_test(
     name = "package_named_build",
     command = "test",
-    target = "//:go_default_test",
+    prepare = """
+cd $PACKAGE/remote
+$BASE/go/tools/gazelle/gazelle/gazelle --go_prefix remote --mode fix --repo_root $PACKAGE/remote
+""",
     subdir = "local",
+    target = "//:go_default_test",
     workspace = """
 local_repository(
     name = "remote",
     path = "../remote",
 )
 """,
-    prepare = """
-cd $PACKAGE/remote
-$BASE/go/tools/gazelle/gazelle/gazelle --go_prefix remote --mode fix --repo_root $PACKAGE/remote
-""",
 )
diff --git a/tests/proto_ignore_go_package_option/BUILD b/tests/proto_ignore_go_package_option/BUILD
index e745059..9658db6 100644
--- a/tests/proto_ignore_go_package_option/BUILD
+++ b/tests/proto_ignore_go_package_option/BUILD
@@ -3,18 +3,18 @@
 go_proto_library(
     name = "a_proto",
     srcs = ["a.proto"],
+    ignore_go_package_option = 1,
     deps = [
         "@com_github_golang_protobuf//ptypes/struct:go_default_library",
     ],
-    ignore_go_package_option = 1,
 )
 
 go_proto_library(
     name = "b_proto",
     srcs = ["b.proto"],
+    ignore_go_package_option = 1,
     deps = [
         ":a_proto",
         "@com_github_golang_protobuf//ptypes/any:go_default_library",
     ],
-    ignore_go_package_option = 1,
 )
diff --git a/tests/race/BUILD.bazel b/tests/race/BUILD.bazel
index aec9849..dd9f751 100644
--- a/tests/race/BUILD.bazel
+++ b/tests/race/BUILD.bazel
@@ -1,7 +1,7 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", "go_binary")
 
 go_library(
-    name="go_default_library",
+    name = "go_default_library",
     srcs = ["race.go"],
     deps = ["//tests/race/racy:go_default_library"],
 )
@@ -14,8 +14,8 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["race_test.go"],
     library = ":go_default_library",
-    size = "small",
     tags = ["manual"],
 )
diff --git a/tests/race/racy/BUILD.bazel b/tests/race/racy/BUILD.bazel
index ade0d55..a47ef30 100644
--- a/tests/race/racy/BUILD.bazel
+++ b/tests/race/racy/BUILD.bazel
@@ -1,7 +1,7 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
 
 go_library(
-    name="go_default_library",
+    name = "go_default_library",
     srcs = ["racy.go"],
     visibility = ["//visibility:public"],
 )
diff --git a/tests/slash_names/BUILD b/tests/slash_names/BUILD
index 22e4672..4270d50 100644
--- a/tests/slash_names/BUILD
+++ b/tests/slash_names/BUILD
@@ -5,18 +5,21 @@
 # gazelle:exclude b
 
 go_library(
-    name="a/pkg",
+    name = "a/pkg",
     srcs = ["a/pkg/pkg.go"],
 )
 
 go_library(
-    name="b/pkg",
+    name = "b/pkg",
     srcs = ["b/pkg/pkg.go"],
 )
 
 go_test(
     name = "go_default_test",
-    srcs = ["slash_test.go"],
-    deps = [":a/pkg", ":b/pkg"],
     size = "small",
+    srcs = ["slash_test.go"],
+    deps = [
+        ":a/pkg",
+        ":b/pkg",
+    ],
 )
diff --git a/tests/test_build_constraints/BUILD b/tests/test_build_constraints/BUILD
index 0823d6c..6927827 100644
--- a/tests/test_build_constraints/BUILD
+++ b/tests/test_build_constraints/BUILD
@@ -2,6 +2,7 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = [
         # Filtered by filename suffix
         "foo_linux_test.go",
@@ -10,7 +11,6 @@
         "bar_unknown_test.go",
     ],
     library = ":go_default_library",
-    size = "small",
 )
 
 # Contains more test cases. Checks that build constraints are applied to
diff --git a/tests/test_chdir/local/sub/BUILD b/tests/test_chdir/local/sub/BUILD
index 775ce58..c858b64 100644
--- a/tests/test_chdir/local/sub/BUILD
+++ b/tests/test_chdir/local/sub/BUILD
@@ -2,7 +2,7 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["local_test.go"],
     data = ["local.txt"],
-    size = "small",
 )
diff --git a/tests/test_chdir/remote/sub/BUILD b/tests/test_chdir/remote/sub/BUILD
index 7176e1e..85f7393 100644
--- a/tests/test_chdir/remote/sub/BUILD
+++ b/tests/test_chdir/remote/sub/BUILD
@@ -2,7 +2,7 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["remote_test.go"],
     data = ["remote.txt"],
-    size = "small",
 )
diff --git a/tests/test_filter_test/BUILD b/tests/test_filter_test/BUILD
index de526c1..6f70fb4 100644
--- a/tests/test_filter_test/BUILD
+++ b/tests/test_filter_test/BUILD
@@ -12,7 +12,7 @@
 
 bazel_test(
     name = "test_filter_test",
-    command = "test",
     args = ["--test_filter=Pass"],
+    command = "test",
     target = "//:go_default_test",
 )
diff --git a/tests/test_filter_test_1.7.5/BUILD b/tests/test_filter_test_1.7.5/BUILD
index cd10628..de2a276 100644
--- a/tests/test_filter_test_1.7.5/BUILD
+++ b/tests/test_filter_test_1.7.5/BUILD
@@ -12,9 +12,9 @@
 
 bazel_test(
     name = "test_filter_test_1.7.5",
-    command = "test",
     args = ["--test_filter=Pass"],
-    target = "//:go_default_test",
+    command = "test",
     go_version = "1.7.5",
     tags = ["dev"],
+    target = "//:go_default_test",
 )
diff --git a/tests/trans_dep_error/BUILD b/tests/trans_dep_error/BUILD
index 52f125a..7ae7fbf 100644
--- a/tests/trans_dep_error/BUILD
+++ b/tests/trans_dep_error/BUILD
@@ -3,8 +3,6 @@
 
 bazel_test(
     name = "trans_dep_error",
-    command = "build",
-    target = "//:go_default_library",
     check = """
 if [ "$result" -eq 0 ]; then
   echo "error: build succeeded unexpectedly" >&2
@@ -13,6 +11,8 @@
   result=0
 fi
 """,
+    command = "build",
+    target = "//:go_default_library",
 )
 
 go_prefix("github.com/bazelbuild/rules_go/tests/trans_dep_error")
@@ -20,8 +20,8 @@
 go_library(
     name = "go_default_library",
     srcs = ["lib.go"],
-    deps = [":a"],
     tags = ["manual"],
+    deps = [":a"],
 )
 
 go_library(
diff --git a/tests/transitive_data/BUILD b/tests/transitive_data/BUILD
index e3b5412..9f96226 100644
--- a/tests/transitive_data/BUILD
+++ b/tests/transitive_data/BUILD
@@ -2,6 +2,7 @@
 
 go_test(
     name = "go_default_test",
+    size = "small",
     srcs = ["transitive_data_test.go"],
     args = [
         "go_data.txt",
@@ -9,21 +10,20 @@
         "c_data.txt",
     ],
     deps = [":go_lib"],
-    size = "small",
 )
 
 go_library(
     name = "go_lib",
     srcs = [
         "empty.go",
-        "empty_cgo.go"
-    ],
-    data = [
-        "go_data.txt",
-        "cgo_data.txt",
+        "empty_cgo.go",
     ],
     cdeps = [":c_lib"],
     cgo = True,
+    data = [
+        "cgo_data.txt",
+        "go_data.txt",
+    ],
 )
 
 cc_library(