1:: Copyright 2012 The Go Authors. All rights reserved.
2:: Use of this source code is governed by a BSD-style
3:: license that can be found in the LICENSE file.
4@echo off
5
6:: Keep environment variables within this script
7:: unless invoked with --no-local.
8if x%1==x--no-local goto nolocal
9if x%2==x--no-local goto nolocal
10setlocal
11:nolocal
12
13set GOBUILDFAIL=0
14
15:: we disallow local import for non-local packages, if %GOROOT% happens
16:: to be under %GOPATH%, then some tests below will fail
17set GOPATH=
18:: Issue 14340: ignore GOBIN during all.bat.
19set GOBIN=
20
21rem TODO avoid rebuild if possible
22
23if x%1==x--no-rebuild goto norebuild
24echo ##### Building packages and commands.
25go install -a -v std cmd
26if errorlevel 1 goto fail
27echo.
28:norebuild
29
30:: we must unset GOROOT_FINAL before tests, because runtime/debug requires
31:: correct access to source code, so if we have GOROOT_FINAL in effect,
32:: at least runtime/debug test will fail.
33set GOROOT_FINAL=
34
35:: get CGO_ENABLED
36go env > env.bat
37if errorlevel 1 goto fail
38call env.bat
39del env.bat
40echo.
41
42go tool dist test
43if errorlevel 1 goto fail
44echo.
45
46goto end
47
48:fail
49set GOBUILDFAIL=1
50
51:end
52