github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/go/internal/base/limit.go (about) 1 // Copyright 2023 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 5 package base 6 7 import ( 8 "github.com/shogo82148/std/internal/godebug" 9 ) 10 11 var NetLimitGodebug = godebug.New("#cmdgonetlimit") 12 13 // NetLimit returns the limit on concurrent network operations 14 // configured by GODEBUG=cmdgonetlimit, if any. 15 // 16 // A limit of 0 (indicated by 0, true) means that network operations should not 17 // be allowed. 18 func NetLimit() (int, bool) 19 20 // AcquireNet acquires a semaphore token for a network operation. 21 func AcquireNet() (release func(), err error)