Skip to content

Instantly share code, notes, and snippets.

@or-shachar
Last active October 29, 2017 13:50
Show Gist options
  • Save or-shachar/a482a338a482314c01d3202ecbb325ef to your computer and use it in GitHub Desktop.
Save or-shachar/a482a338a482314c01d3202ecbb325ef to your computer and use it in GitHub Desktop.
#!/bin/bash
BUILDTOOLS_REVISION=1a7c0ec10697afcb87af8a09f12c3f9b9ca56fb2
gopath=$(go env GOPATH)
github_go_fetch() {
cd /tmp
org=$1
repo=$2
revision=$3
wget "https://github.com/${org}/${repo}/archive/${revision}.tar.gz"
tar -xzf ${revision}.tar.gz
mkdir -p $gopath/src/github.com/${org}
mv ${repo}-${revision} $gopath/src/github.com/${org}/${repo}
cd $cwd_backup
}
github_go_fetch bazelbuild buildtools $BUILDTOOLS_REVISION
cd $gopath/src/github.com/bazelbuild/buildtools
bazel build //buildozer/...
bazel build //buildifier/...
ln -s ~/go/src/github.com/bazelbuild/buildtools/bazel-bin/buildifier/buildifier /usr/local/bin/buildifier
ln -s ~/go/src/github.com/bazelbuild/buildtools/bazel-bin/buildozer/buildozer /usr/local/bin/buildozer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment