Fully use skylark version of http_{archive, file}. (#215)

#66.
diff --git a/WORKSPACE b/WORKSPACE
index 59d7f20..f3d8f44 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -13,6 +13,7 @@
 # limitations under the License.
 workspace(name = "bazel_toolchains")
 
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
 load(
     "//rules/skylib:package_names.bzl",
     "jessie_package_names",
@@ -131,6 +132,7 @@
 # https://github.com/bazelbuild/bazel-toolchains/releases/tag/acffd62
 http_file(
     name = "bazel_toolchains_test",
+    downloaded_file_path = "44200e0c026d86c53470d107b3697a3e46469c43.tar.gz",
     sha256 = "699b55a6916c687f4b7dc092dbbf5f64672cde0dc965f79717735ec4e5416556",
     urls = [
         "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/44200e0c026d86c53470d107b3697a3e46469c43.tar.gz",
diff --git a/repositories/repositories.bzl b/repositories/repositories.bzl
index 046e5b1..5658951 100644
--- a/repositories/repositories.bzl
+++ b/repositories/repositories.bzl
@@ -15,7 +15,11 @@
 # Once recursive workspace is implemented in Bazel, this file should cease
 # to exist.
 
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+load(
+    "@bazel_tools//tools/build_defs/repo:http.bzl",
+    "http_archive",
+    "http_file",
+)
 load(
     "//third_party/golang:revision.bzl",
     "GOLANG_REVISION",
@@ -63,7 +67,7 @@
     if "io_bazel_rules_go" not in excludes:
         http_archive(
             name = "io_bazel_rules_go",
-            url = "https://github.com/bazelbuild/rules_go/releases/download/0.16.0/rules_go-0.16.0.tar.gz",
+            urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.16.0/rules_go-0.16.0.tar.gz"],
             sha256 = "ee5fe78fe417c685ecb77a0a725dc9f6040ae5beb44a0ba4ddb55453aad23a8a",
         )
 
@@ -86,7 +90,7 @@
     # ================================ GPG Keys ================================
     # Bazel gpg key necessary to install Bazel in the containers.
     if "bazel_gpg" not in excludes:
-        native.http_file(
+        http_file(
             name = "bazel_gpg",
             sha256 = "30af2ca7abfb65987cd61802ca6e352aadc6129dfb5bfc9c81f16617bc3a4416",
             urls = ["https://bazel.build/bazel-release.pub.gpg"],
@@ -94,7 +98,7 @@
 
     # Docker gpg key necessary to install Docker in the containers.
     if "debian_docker_gpg" not in excludes:
-        native.http_file(
+        http_file(
             name = "debian_docker_gpg",
             sha256 = "1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570",
             urls = ["https://download.docker.com/linux/debian/gpg"],
@@ -102,7 +106,7 @@
 
     # Docker gpg key necessary to install Docker in the containers.
     if "xenial_docker_gpg" not in excludes:
-        native.http_file(
+        http_file(
             name = "xenial_docker_gpg",
             sha256 = "1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570",
             urls = ["https://download.docker.com/linux/ubuntu/gpg"],
@@ -110,7 +114,7 @@
 
     # GCloud gpg key necessary to install GCloud in the containers.
     if "gcloud_gpg" not in excludes:
-        native.http_file(
+        http_file(
             name = "gcloud_gpg",
             sha256 = "226ba1072f20e4ff97ee4f94e87bf45538a900a6d9b25399a7ac3dc5a2f3af87",
             urls = ["https://packages.cloud.google.com/apt/doc/apt-key.gpg"],
@@ -118,61 +122,68 @@
 
     # Launchpad OpenJDK key used when install java in trusty.
     if "launchpad_openjdk_gpg" not in excludes:
-        native.http_file(
+        http_file(
             name = "launchpad_openjdk_gpg",
             sha256 = "54b6274820df34a936ccc6f5cb725a9b7bb46075db7faf0ef7e2d86452fa09fd",
-            url = "http://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0xEB9B1D8886F44E2A",
+            urls = ["http://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0xEB9B1D8886F44E2A"],
         )
 
     # =============================== Toolchains ===============================
     # Golang
     if "golang_release" not in excludes:
-        native.http_file(
+        http_file(
             name = "golang_release",
+            downloaded_file_path = "go" + GOLANG_REVISION + ".linux-amd64.tar.gz",
             sha256 = GOLANG_SHA256,
             urls = ["https://storage.googleapis.com/golang/go" + GOLANG_REVISION + ".linux-amd64.tar.gz"],
         )
 
     # Clang
     if "debian8_clang_release" not in excludes:
-        native.http_file(
+        http_file(
             name = "debian8_clang_release",
+            downloaded_file_path = "clang_" + CLANG_REVISION + ".tar.gz",
             sha256 = DEBIAN8_CLANG_SHA256,
             urls = ["https://storage.googleapis.com/clang-builds-stable/clang-debian8/clang_" + CLANG_REVISION + ".tar.gz"],
         )
 
     if "debian9_clang_release" not in excludes:
-        native.http_file(
+        http_file(
             name = "debian9_clang_release",
+            downloaded_file_path = "clang_" + CLANG_REVISION + ".tar.gz",
             sha256 = DEBIAN9_CLANG_SHA256,
             urls = ["https://storage.googleapis.com/clang-builds-stable/clang-debian9/clang_" + CLANG_REVISION + ".tar.gz"],
         )
 
     if "ubuntu16_04_clang_release" not in excludes:
-        native.http_file(
+        http_file(
             name = "ubuntu16_04_clang_release",
+            downloaded_file_path = "clang_" + CLANG_REVISION + ".tar.gz",
             sha256 = UBUNTU16_04_CLANG_SHA256,
             urls = ["https://storage.googleapis.com/clang-builds-stable/clang-ubuntu16_04/clang_" + CLANG_REVISION + ".tar.gz"],
         )
 
     # libcxx
     if "debian8_libcxx_release" not in excludes:
-        native.http_file(
+        http_file(
             name = "debian8_libcxx_release",
+            downloaded_file_path = "libcxx-msan_" + LIBCXX_REVISION + ".tar.gz",
             sha256 = DEBIAN8_LIBCXX_SHA256,
             urls = ["https://storage.googleapis.com/clang-builds-stable/clang-debian8/libcxx-msan_" + LIBCXX_REVISION + ".tar.gz"],
         )
 
     if "debian9_libcxx_release" not in excludes:
-        native.http_file(
+        http_file(
             name = "debian9_libcxx_release",
+            downloaded_file_path = "libcxx-msan_" + LIBCXX_REVISION + ".tar.gz",
             sha256 = DEBIAN9_LIBCXX_SHA256,
             urls = ["https://storage.googleapis.com/clang-builds-stable/clang-debian9/libcxx-msan_" + LIBCXX_REVISION + ".tar.gz"],
         )
 
     if "ubuntu16_04_libcxx_release" not in excludes:
-        native.http_file(
+        http_file(
             name = "ubuntu16_04_libcxx_release",
+            downloaded_file_path = "libcxx-msan_" + LIBCXX_REVISION + ".tar.gz",
             sha256 = UBUNTU16_04_LIBCXX_SHA256,
             urls = ["https://storage.googleapis.com/clang-builds-stable/clang-ubuntu16_04/libcxx-msan_" + LIBCXX_REVISION + ".tar.gz"],
         )
@@ -182,8 +193,9 @@
     for bazel_version, bazel_sha256 in BAZEL_VERSION_SHA256S.items():
         name = "bazel_%s_installer" % (bazel_version.replace(".", ""))
         if name not in excludes:
-            native.http_file(
+            http_file(
                 name = name,
+                downloaded_file_path = "bazel-" + bazel_version + "-installer-linux-x86_64.sh",
                 sha256 = bazel_sha256,
                 urls = [
                     "https://releases.bazel.build/" + bazel_version + "/release/bazel-" + bazel_version + "-installer-linux-x86_64.sh",
@@ -193,15 +205,17 @@
 
     # ============================ Azul OpenJDK packages ============================
     if "azul_open_jdk" not in excludes:
-        native.http_file(
+        http_file(
             name = "azul_open_jdk",
+            downloaded_file_path = "zulu" + JDK_VERSION + "-linux_x64-allmodules.tar.gz",
             sha256 = OPENJDK_SHA256,
             urls = ["https://mirror.bazel.build/openjdk/azul-zulu" + JDK_VERSION + "/zulu" + JDK_VERSION + "-linux_x64-allmodules.tar.gz"],
         )
 
     if "azul_open_jdk_src" not in excludes:
-        native.http_file(
+        http_file(
             name = "azul_open_jdk_src",
+            downloaded_file_path = "zsrc" + JDK_VERSION + ".zip",
             sha256 = OPENJDK_SRC_SHA256,
             urls = ["https://mirror.bazel.build/openjdk/azul-zulu" + JDK_VERSION + "/zsrc" + JDK_VERSION + ".zip"],
         )
diff --git a/rules/docker_config.bzl b/rules/docker_config.bzl
index 90489f5..13bfd80 100644
--- a/rules/docker_config.bzl
+++ b/rules/docker_config.bzl
@@ -55,6 +55,8 @@
 
 Add to your WORKSPACE file the following:
 
+  load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
+
   http_archive(
     name = "bazel_toolchains",
     urls = [
diff --git a/third_party/golang/BUILD b/third_party/golang/BUILD
index 4715a4e..b9b956f 100644
--- a/third_party/golang/BUILD
+++ b/third_party/golang/BUILD
@@ -12,11 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# This BUILD file is used for installing golang into /usr/local/go/
-# of debian8-clang-fully-loaded container. It uses the official golang
-# release tarball downloaded by new_http_archive rule in WORKSPACE file:
-# https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz
-
 licenses(["notice"])  # Apache 2.0
 
 package(default_visibility = ["//visibility:public"])