github.com/billybanfield/evergreen@v0.0.0-20170525200750-eeee692790f7/service/testutil/ports.go (about) 1 package testutil 2 3 import "sync" 4 5 var ( 6 lastPort = 8179 7 lastPortMutex *sync.Mutex 8 ) 9 10 func init() { 11 lastPortMutex = &sync.Mutex{} 12 } 13 14 func NextPort() int { 15 lastPortMutex.Lock() 16 defer lastPortMutex.Unlock() 17 18 lastPort += 2 19 20 return lastPort 21 }