github.com/x04/go/src@v0.0.0-20200202162449-3d481ceb3525/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  :: Issue 14340: ignore GOBIN during all.bat.
    19  set GOBIN=
    20  set GOFLAGS=
    21  set GO111MODULE=
    22  
    23  rem TODO avoid rebuild if possible
    24  
    25  if x%1==x--no-rebuild goto norebuild
    26  echo ##### Building packages and commands.
    27  go install -a -v std cmd
    28  if errorlevel 1 goto fail
    29  echo.
    30  :norebuild
    31  
    32  :: we must unset GOROOT_FINAL before tests, because runtime/debug requires
    33  :: correct access to source code, so if we have GOROOT_FINAL in effect,
    34  :: at least runtime/debug test will fail.
    35  set GOROOT_FINAL=
    36  
    37  :: get CGO_ENABLED
    38  go env > env.bat
    39  if errorlevel 1 goto fail
    40  call env.bat
    41  del env.bat
    42  echo.
    43  
    44  go tool dist test
    45  if errorlevel 1 goto fail
    46  echo.
    47  
    48  goto end
    49  
    50  :fail
    51  set GOBUILDFAIL=1
    52  
    53  :end