1// run 2 3// Copyright 2011 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7// Test that println can be the target of a go statement. 8 9package main 10 11import ( 12 "log" 13 "runtime" 14 "time" 15) 16 17func main() { 18 numg0 := runtime.NumGoroutine() 19 deadline := time.Now().Add(10 * time.Second) 20 go println(42, true, false, true, 1.5, "world", (chan int)(nil), []int(nil), (map[string]int)(nil), (func())(nil), byte(255)) 21 for { 22 numg := runtime.NumGoroutine() 23 if numg > numg0 { 24 if time.Now().After(deadline) { 25 log.Fatalf("%d goroutines > initial %d after deadline", numg, numg0) 26 } 27 runtime.Gosched() 28 continue 29 } 30 break 31 } 32} 33