github.com/mdempsky/go@v0.0.0-20151201204031-5dd372bd1e70/src/run.bat (about)

     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.
     8  if x%1==x--no-local goto nolocal
     9  if x%2==x--no-local goto nolocal
    10  setlocal
    11  :nolocal
    12  
    13  set 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
    17  set GOPATH=
    18  
    19  rem TODO avoid rebuild if possible
    20  
    21  if x%1==x--no-rebuild goto norebuild
    22  echo ##### Building packages and commands.
    23  go install -a -v std cmd
    24  if errorlevel 1 goto fail
    25  echo.
    26  :norebuild
    27  
    28  :: we must unset GOROOT_FINAL before tests, because runtime/debug requires
    29  :: correct access to source code, so if we have GOROOT_FINAL in effect,
    30  :: at least runtime/debug test will fail.
    31  set GOROOT_FINAL=
    32  
    33  :: get CGO_ENABLED
    34  go env > env.bat
    35  if errorlevel 1 goto fail
    36  call env.bat
    37  del env.bat
    38  echo.
    39  
    40  go tool dist test --no-rebuild
    41  if errorlevel 1 goto fail
    42  echo.
    43  
    44  goto end
    45  
    46  :fail
    47  set GOBUILDFAIL=1
    48  
    49  :end