blob: 09cc1c89d4e4a60d73b17d9400b82751ceb0e42a [file] [log] [blame]
#!/bin/bash
# This script generates a version of tls.go that can be built with Go compilers
# prior to version 1.4.
source "$(go list -f {{.Dir}} veyron.io/veyron/shell/lib)/shell_test.sh"
main() {
local -r DIR="$(dirname "$0")"
local -r INFILE="${DIR}/tls.go"
local OUTFILE="${DIR}/tls_old.go"
[[ "$#" -gt 0 ]] && OUTFILE="$1"
readonly OUTFILE
cat <<EOF >$OUTFILE
// THIS IS NOT THE FILE YOU WANT.
// DO NOT EDIT THIS FILE.
//
// This file has been generated using the tls_generate_old.sh script.
// Please do NOT make edits to this file. Instead edit tls.go and
// use the script to regenerate this file
EOF
cat "${INFILE}" |
sed -e 's|// +build go1.4|// +build !go1.4|' |
sed -e 's|"crypto/tls"|tls "veyron.io/veyron/veyron/runtimes/google/ipc/stream/crypto/tlsfork"|' >>$OUTFILE
veyron go fmt "${OUTFILE}"
}
main "$@"