Skip to content

Commit 6cd5a78

Browse files
committed
Fixed minor bugs reported by 'go vet'; teach build to support 'go vet'
1 parent 66bc8c4 commit 6cd5a78

File tree

3 files changed

+36
-21
lines changed

3 files changed

+36
-21
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ tools/vagrant/redis-cluster-conf/7778/nodes.conf
4444
tools/vagrant/redis-cluster-conf/7779/nodes.conf
4545
*.aof
4646
*.rdb
47+
*.deb

build

+34-20
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#
1414
# License: GPLv2
1515
#
16-
Progs="gotun"
16+
Progs="godnsd"
1717

1818
# Relative path to protobuf sources
1919
# e.g. src/foo/a.proto
@@ -28,7 +28,6 @@ PWD=`pwd`
2828
Static=0
2929
Dryrun=0
3030
Prodver=0.1
31-
[ -f $PWD/version ] && Prodver=$(cat $PWD/version)
3231

3332
hostos=$(go env GOHOSTOS) || exit 1
3433
hostcpu=$(go env GOHOSTARCH) || exit 1
@@ -107,6 +106,7 @@ Options:
107106
-a X, --arch=X Cross compile for OS-CPU 'X' [$hostos-$hostcpu]
108107
-n, --dry-run Dry-run, don't actually build anything [False]
109108
-t, --test Run "go test" on modules named on the command line [False]
109+
--vet Run "go vet" on modules named on the command line [False]
110110
-x Run in debug/trace mode [False]
111111
EOF
112112

@@ -144,7 +144,7 @@ for c in $cpulist; do
144144
done
145145

146146

147-
Runtests=0
147+
Tool=
148148
doinit=0
149149
args=
150150

@@ -182,7 +182,11 @@ do
182182
Prodver=$ac_optarg
183183
;;
184184
--test|-t)
185-
Runtests=1
185+
Tool=test
186+
;;
187+
188+
--vet)
189+
Tool=vet
186190
;;
187191

188192
-V|--version)
@@ -321,23 +325,33 @@ date="main.Buildtime=`date -u '+%Y-%m-%dT%H:%M.%SZ'`"
321325
ldflags="-ldflags \"-X $repover -X $prodver -X $date $ldflags\""
322326

323327

324-
if [ $Runtests -gt 0 ]; then
325-
set -- $args
326-
$e go test "$@"
327-
else
328-
set -- $args
329-
if [ -z "$1" ]; then
330-
all=$Progs
331-
else
332-
all="$@"
333-
fi
328+
case $Tool in
329+
test)
330+
set -- $args
331+
$e go test "$@"
332+
;;
334333

335-
echo "Building $rev, $cross $msg .."
334+
vet)
335+
set -- $args
336+
$e go vet -x -v "$@"
337+
;;
336338

337-
for p in $all; do
338-
echo " $Bindir/$p .."
339-
$e eval go build -o $Bindir/$p $isuffix "$ldflags" $p || exit 1
340-
done
341-
fi
339+
*) # Default is to build programs
340+
set -- $args
341+
if [ -z "$1" ]; then
342+
all=$Progs
343+
else
344+
all="$@"
345+
fi
346+
347+
echo "Building $rev, $cross $msg .."
348+
349+
for p in $all; do
350+
echo " $p .."
351+
$e eval go build -o $Bindir/$p $isuffix "$ldflags" $p || exit 1
352+
done
353+
;;
354+
355+
esac
342356

343357
# vim: ft=sh:expandtab:ts=4:sw=4:tw=84:

src/gotun/conf.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func validate(c *Conf) error {
185185
case "v1":
186186
default:
187187
if len(c.ProxyProtocol) > 0 {
188-
return fmt.Errorf("%s: no support for proxy-protocol %s", c.ProxyProtocol)
188+
return fmt.Errorf("%s: no support for proxy-protocol %s", l.Addr, c.ProxyProtocol)
189189
}
190190
}
191191
if t := c.Tls; t != nil {

0 commit comments

Comments
 (0)