github.com/megatontech/mynoteforgo@v0.0.0-20200507084910-5d0c6ea6e890/源码/run.bash (about)

     1  #!/usr/bin/env bash
     2  # Copyright 2009 The Go Authors. All rights reserved.
     3  # Use of this source code is governed by a BSD-style
     4  # license that can be found in the LICENSE file.
     5  
     6  set -e
     7  
     8  eval $(go env)
     9  export GOROOT   # the api test requires GOROOT to be set.
    10  
    11  # We disallow local import for non-local packages, if $GOROOT happens
    12  # to be under $GOPATH, then some tests below will fail.  $GOPATH needs
    13  # to be set to a non-empty string, else Go will set a default value
    14  # that may also conflict with $GOROOT.  The $GOPATH value doesn't need
    15  # to point to an actual directory, it just needs to pass the semantic
    16  # checks performed by Go.  Use $GOROOT to define $GOPATH so that we
    17  # don't blunder into a user-defined symbolic link.
    18  GOPATH=$GOROOT/nonexistentpath
    19  export GOPATH
    20  
    21  unset CDPATH	# in case user has it set
    22  unset GOBIN     # Issue 14340
    23  unset GOFLAGS
    24  unset GO111MODULE
    25  
    26  export GOHOSTOS
    27  export CC
    28  
    29  # no core files, please
    30  ulimit -c 0
    31  
    32  # Raise soft limits to hard limits for NetBSD/OpenBSD.
    33  # We need at least 256 files and ~300 MB of bss.
    34  # On OS X ulimit -S -n rejects 'unlimited'.
    35  #
    36  # Note that ulimit -S -n may fail if ulimit -H -n is set higher than a
    37  # non-root process is allowed to set the high limit.
    38  # This is a system misconfiguration and should be fixed on the
    39  # broken system, not "fixed" by ignoring the failure here.
    40  # See longer discussion on golang.org/issue/7381.
    41  [ "$(ulimit -H -n)" = "unlimited" ] || ulimit -S -n $(ulimit -H -n)
    42  [ "$(ulimit -H -d)" = "unlimited" ] || ulimit -S -d $(ulimit -H -d)
    43  
    44  # Thread count limit on NetBSD 7.
    45  if ulimit -T &> /dev/null; then
    46  	[ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T)
    47  fi
    48  
    49  exec go tool dist test -rebuild "$@"