• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2016 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
5package depBase
6
7import (
8	"os"
9	"reflect"
10
11	"testshared/depBaseInternal"
12)
13
14// Issue 61973: indirect dependencies are not initialized.
15func init() {
16	if !depBaseInternal.Initialized {
17		panic("depBaseInternal not initialized")
18	}
19	if os.Stdout == nil {
20		panic("os.Stdout is nil")
21	}
22
23	Initialized = true
24}
25
26var Initialized bool
27
28var SlicePtr interface{} = &[]int{}
29
30var V int = 1
31
32var HasMask []string = []string{"hi"}
33
34type HasProg struct {
35	array [1024]*byte
36}
37
38type Dep struct {
39	X int
40}
41
42func (d *Dep) Method() int {
43	// This code below causes various go.itab.* symbols to be generated in
44	// the shared library. Similar code in ../exe/exe.go results in
45	// exercising https://golang.org/issues/17594
46	reflect.TypeOf(os.Stdout).Elem()
47	return 10
48}
49
50func F() int {
51	defer func() {}()
52	return V
53}
54
55func H() {
56	// Issue 67635: deadcoded closures causes linker crash.
57	func() { F() }()
58}
59