func()

in tpgtools/resource.go [754:792]


func (r Resource) getSamples(docs bool) []Sample {
	out := []Sample{}
	if len(r.Samples) < 1 {
		return out
	}
	var hideList []string
	if docs {
		hideList = r.Samples[0].DocHide
		if len(r.Samples[0].DocHideConditional) > 0 {
			for _, dochidec := range r.Samples[0].DocHideConditional {
				if r.location == dochidec.Location {
					hideList = append(hideList, dochidec.Name)
				}
			}
		}
	} else {
		hideList = r.Samples[0].Testhide
		if len(r.Samples[0].TestHideConditional) > 0 {
			for _, testhidec := range r.Samples[0].TestHideConditional {
				if r.location == testhidec.Location {
					hideList = append(hideList, testhidec.Name)
				}
			}
		}
	}
	for _, sample := range r.Samples {
		shouldhide := false
		for _, hideName := range hideList {
			if sample.FileName == hideName {
				shouldhide = true
			}
		}
		if !shouldhide {
			out = append(out, sample)
		}
	}

	return out
}