Add pre-commit check for format&lint
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..11e24bd
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,15 @@
+repos:
+  - repo: https://github.com/syntaqx/git-hooks 
+    rev: v0.0.17
+    hooks:
+    - id: shellcheck
+    - id: go-fmt
+  - repo: https://github.com/keith/pre-commit-buildifier
+    rev: 4.0.1.1
+    hooks:
+      - id: buildifier
+        args: &args
+          # Keep this argument in sync with .bazelci/presubmit.yaml
+          - --warnings=all
+      - id: buildifier-lint
+        args: *args
\ No newline at end of file
diff --git a/BUILD.bazel b/BUILD.bazel
index 630b56a..a1ede4e 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -1,5 +1,5 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
 load("@bazel_gazelle//:def.bzl", "gazelle")
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
 
 # TODO: follow https://sagikazarmark.hu/blog/vanity-import-paths-in-go/
 # so we have savvy go imports for users
diff --git a/WORKSPACE b/WORKSPACE
index fb59e45..bcf7812 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -20,8 +20,8 @@
     ],
 )
 
-load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
 load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
+load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
 load("//:go.bzl", _go_repositories = "deps")
 
 # gazelle:repository_macro go.bzl%deps
diff --git a/bazel/spawn.go b/bazel/spawn.go
index b4a93d5..10a7c7a 100644
--- a/bazel/spawn.go
+++ b/bazel/spawn.go
@@ -2,8 +2,8 @@
 
 import (
 	"fmt"
-	"log"
 	"io"
+	"log"
 	"os"
 	"os/exec"
 )
@@ -50,4 +50,4 @@
 	if err := cmd.Wait(); err != nil {
 		log.Fatal(err)
 	}
-}
\ No newline at end of file
+}
diff --git a/buildinfo/BUILD.bazel b/buildinfo/BUILD.bazel
index faa8763..0e988e2 100644
--- a/buildinfo/BUILD.bazel
+++ b/buildinfo/BUILD.bazel
@@ -1,13 +1,12 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
 
-
 # Under --stamp, the Go linker will fill in these placeholders with VCS info
 # see https://github.com/bazelbuild/rules_go/blob/master/go/core.rst#stamping-with-the-workspace-status-script
 _GO_STAMP_X_DEFS = {
     "BuildTime": "{BUILD_TIME}",
     "GitCommit": "{STABLE_BUILD_SCM_SHA}",
-    "HostName": "{BUILD_HOST}",
     "GitStatus": "{STABLE_BUILD_SCM_LOCAL_CHANGES}",
+    "HostName": "{BUILD_HOST}",
     "Release": "{STABLE_BUILD_SCM_TAG}",
 }
 
diff --git a/buildinfo/bazel_stamp_info.sh b/buildinfo/bazel_stamp_info.sh
index 141d11b..04ff898 100755
--- a/buildinfo/bazel_stamp_info.sh
+++ b/buildinfo/bazel_stamp_info.sh
@@ -19,6 +19,6 @@
 # "stable" keys, should remain constant over rebuilds, therefore changed values will cause a
 # rebuild of any stamped action that uses ctx.info_file or genrule with stamp = True
 # Note, BUILD_USER is automatically available in the stable-status.txt, it matches $USER
-echo STABLE_BUILD_SCM_SHA $(git rev-parse HEAD)
-echo STABLE_BUILD_SCM_LOCAL_CHANGES $(has_local_changes)
-echo STABLE_BUILD_SCM_TAG $(git describe --tags)
+echo "STABLE_BUILD_SCM_SHA $(git rev-parse HEAD)"
+echo "STABLE_BUILD_SCM_LOCAL_CHANGES $(has_local_changes)"
+echo "STABLE_BUILD_SCM_TAG $(git describe --tags)"
diff --git a/cmd/aspect/BUILD.bazel b/cmd/aspect/BUILD.bazel
index 65c58e0..ce6196f 100644
--- a/cmd/aspect/BUILD.bazel
+++ b/cmd/aspect/BUILD.bazel
@@ -14,7 +14,6 @@
     visibility = ["//visibility:public"],
 )
 
-
 go_binary(
     name = "aspect-darwin-amd64",
     out = "aspect-darwin_amd64",
@@ -93,4 +92,4 @@
     goos = "windows",
     pure = "on",
     visibility = ["//visibility:public"],
-)
\ No newline at end of file
+)
diff --git a/cmd/aspect/main.go b/cmd/aspect/main.go
index 421e5a4..837f711 100644
--- a/cmd/aspect/main.go
+++ b/cmd/aspect/main.go
@@ -5,14 +5,14 @@
 func main() {
 	// Detect whether we are being run as a tools/bazel wrapper (look for BAZEL_REAL in the environment)
 	// If so,
-    //     Is this a bazel-native command? just call through to bazel without touching the arguments for now
+	//     Is this a bazel-native command? just call through to bazel without touching the arguments for now
 	//     Is this an aspect-custom command? (like `outputs`) then write an implementation
 	// otherwise,
 	//     we are installing ourselves. Check with the user they intended to do that.
-	//     then create 
+	//     then create
 	//         - a WORKSPACE file, ask the user for the repository name if interactive
 	//     ask the user if they want to install for all users of the workspace, if so
 	//         - tools/bazel file and put our bootstrap code in there
-	//     
+	//
 	cmd.Execute()
-}
\ No newline at end of file
+}
diff --git a/cmd/root.go b/cmd/root.go
index 93f3e5f..9935bcb 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -7,8 +7,8 @@
 
 import (
 	"fmt"
-	"os"
 	"github.com/spf13/cobra"
+	"os"
 
 	homedir "github.com/mitchellh/go-homedir"
 	"github.com/spf13/viper"
@@ -20,7 +20,7 @@
 var rootCmd = &cobra.Command{
 	Use:   "aspect",
 	Short: "Aspect.build bazel wrapper",
-	Long: `Aspect CLI is a better frontend for running bazel`,
+	Long:  `Aspect CLI is a better frontend for running bazel`,
 	// Uncomment the following line if your bare application
 	// has an action associated with it:
 	// Run: func(cmd *cobra.Command, args []string) { },
diff --git a/cmd/version.go b/cmd/version.go
index 83133e5..6950c42 100644
--- a/cmd/version.go
+++ b/cmd/version.go
@@ -6,9 +6,9 @@
 package cmd
 
 import (
-	"fmt"
 	"aspect.build/cli/bazel"
 	"aspect.build/cli/buildinfo"
+	"fmt"
 	"github.com/spf13/cobra"
 )
 
@@ -16,13 +16,13 @@
 var versionCmd = &cobra.Command{
 	Use:   "version",
 	Short: "Print the version of aspect CLI as well as tools it invokes",
-	Long: `Prints version info on colon-separated lines, just like bazel does`,
+	Long:  `Prints version info on colon-separated lines, just like bazel does`,
 	Run: func(cmd *cobra.Command, args []string) {
 		if !buildinfo.IsStamped() {
 			fmt.Println("Aspect was not built with --stamp")
 		} else {
 			version := buildinfo.Release
-			if (buildinfo.GitStatus != "clean") {
+			if buildinfo.GitStatus != "clean" {
 				version += " (in a dirty clone)"
 			}
 			fmt.Printf("Aspect version: %s\n", version)
diff --git a/go.bzl b/go.bzl
index dfb6dbe..08c87fe 100644
--- a/go.bzl
+++ b/go.bzl
@@ -1,4 +1,5 @@
 "This file managed by `bazel run //:update_go_deps`"
+
 load("@bazel_gazelle//:deps.bzl", "go_repository")
 
 def deps():
diff --git a/scripts/release.sh b/scripts/release.sh
index 289fc9e..320ee88 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -29,5 +29,5 @@
 echo "== Aspect version output =="
 echo "Did you update the tag? git tag -a"
 echo "Before releasing, make sure that this is the correct version string:"
-"bin/aspect-$(uname -s | tr [:upper:] [:lower:])-amd64" version
+"bin/aspect-$(uname -s | tr "[:upper:]" "[:lower:]")-amd64" version
 echo