func (t *T) Setenv(key, value string) { if t.isParallel { panic("testing: t.Setenv called after t.Parallel; cannot set environment variables in parallel tests") } // 以下略 } 5
{ isParallel := false for c := &t.common; c != nil; c = c.parent { if c.isParallel { isParallel = true break } } if isParallel { panic("testing: t.Setenv called after t.Parallel; (略") } // 以下略 } func (t *T) Setenv(key, value string) { if t.isParallel { panic("testing: t.Setenv called after t.Parallel; (略") } // 以下略 } Before After 19