2012-02-16 21:48:24 -07:00
|
|
|
# Copyright 2012 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
# These function names are also known to
|
|
|
|
# (and are the plan for transitioning to) run.go.
|
|
|
|
|
|
|
|
compile() {
|
|
|
|
$G $D/$F.go
|
|
|
|
}
|
|
|
|
|
2012-07-30 13:12:05 -06:00
|
|
|
compiledir() {
|
|
|
|
for gofile in $D/$F.dir/*.go
|
|
|
|
do
|
2012-09-23 22:06:31 -06:00
|
|
|
$G -I. "$gofile" || return 1
|
2012-07-30 13:12:05 -06:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2012-10-06 01:23:31 -06:00
|
|
|
errorcheckdir() {
|
|
|
|
lastzero=""
|
|
|
|
if [ "$1" = "-0" ]; then
|
|
|
|
lastzero="-0"
|
|
|
|
fi
|
|
|
|
files=($D/$F.dir/*.go)
|
|
|
|
for gofile in ${files[@]}
|
|
|
|
do
|
|
|
|
zero="-0"
|
|
|
|
if [ ${files[${#files[@]}-1]} = $gofile ]; then
|
|
|
|
zero=$lastzero
|
|
|
|
fi
|
|
|
|
errchk $zero $G -D. -I. -e $gofile
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
rundir() {
|
|
|
|
lastfile=""
|
|
|
|
for gofile in $D/$F.dir/*.go
|
|
|
|
do
|
|
|
|
name=$(basename ${gofile/\.go/} )
|
|
|
|
$G -D. -I. -e "$gofile" || return 1
|
|
|
|
lastfile=$name
|
|
|
|
done
|
|
|
|
$L -o $A.out -L. $lastfile.$A
|
|
|
|
./$A.out
|
|
|
|
}
|
|
|
|
|
|
|
|
rundircmpout() {
|
|
|
|
lastfile=""
|
|
|
|
for gofile in $D/$F.dir/*.go
|
|
|
|
do
|
|
|
|
name=$(basename ${gofile/\.go/} )
|
|
|
|
$G -D. -I. -e "$gofile" || return 1
|
|
|
|
lastfile=$name
|
|
|
|
done
|
|
|
|
$L -o $A.out -L. $lastfile.$A
|
|
|
|
./$A.out | cmp - $D/$F.out
|
|
|
|
}
|
|
|
|
|
2012-02-16 21:48:24 -07:00
|
|
|
build() {
|
|
|
|
$G $D/$F.go && $L $F.$A
|
|
|
|
}
|
|
|
|
|
2012-04-20 09:45:43 -06:00
|
|
|
runoutput() {
|
|
|
|
go run "$D/$F.go" > tmp.go
|
|
|
|
go run tmp.go
|
|
|
|
}
|
|
|
|
|
2012-02-16 21:48:24 -07:00
|
|
|
run() {
|
2012-03-06 23:54:39 -07:00
|
|
|
gofiles=""
|
|
|
|
ingo=true
|
|
|
|
while $ingo; do
|
|
|
|
case "$1" in
|
|
|
|
*.go)
|
|
|
|
gofiles="$gofiles $1"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ingo=false
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2012-03-07 12:16:58 -07:00
|
|
|
$G $D/$F.go $gofiles && $L $F.$A && ./$A.out "$@"
|
2012-02-16 21:48:24 -07:00
|
|
|
}
|
|
|
|
|
2012-02-23 19:17:26 -07:00
|
|
|
cmpout() {
|
|
|
|
$G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
|
|
|
|
}
|
|
|
|
|
2012-02-16 21:48:24 -07:00
|
|
|
errorcheck() {
|
2012-09-23 11:16:14 -06:00
|
|
|
zero=""
|
|
|
|
if [ "$1" = "-0" ]; then
|
|
|
|
zero="-0"
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
errchk $zero $G -e $* $D/$F.go
|
2012-02-16 21:48:24 -07:00
|
|
|
}
|
2012-03-21 12:14:44 -06:00
|
|
|
|
|
|
|
skip() {
|
|
|
|
true
|
|
|
|
}
|