// loadDUTInfos loads available DUT test infos from the json file, it
// must be called after flag.Parse().
loadDUTInfos loads available DUT test infos from the json file, it
must be called after flag.Parse().
// loadDUTInfos loads available DUT test infos from the json file it // must be called after flag . Parse () .
func loadDUTInfos() error {
	var dutInfos []DUTInfo
	if err := json.Unmarshal([]byte(dutInfosJSON), &dutInfos); err != nil {
		return fmt.Errorf("failed to unmarshal JSON: %w", err)
	}
	if got, want := len(dutInfos), 1; got < want {
		return fmt.Errorf("got %d DUTs, the test requires at least %d DUTs", got, want)
	}
	dutInfo = make(chan *DUTInfo, len(dutInfos))
	for i := range dutInfos {
		dutInfos[i].Net.LocalIPv4 = dutInfos[i].Net.LocalIPv4.To4()
		dutInfos[i].Net.RemoteIPv4 = dutInfos[i].Net.RemoteIPv4.To4()
		dutInfo <- &dutInfos[i]
	}
	return nil
}
func loadDUTInfos ( ) error { var dutInfos [ ] DUTInfo if err := json . Unmarshal ( [ ] byte ( dutInfosJSON ) , & dutInfos ) ; err != nil { return fmt . Errorf ( " " , err ) } if got , want := len ( dutInfos ) , 1 ; got < want { return fmt . Errorf ( " " , got , want ) } dutInfo = make ( chan * DUTInfo , len ( dutInfos ) ) for i := range dutInfos { dutInfos [ i ] . Net . LocalIPv4 = dutInfos [ i ] . Net . LocalIPv4 . To4 ( ) dutInfos [ i ] . Net . RemoteIPv4 = dutInfos [ i ] . Net . RemoteIPv4 . To4 ( ) dutInfo <- & dutInfos [ i ] } return nil }
loadDUTInfos loads available DUT test infos from the json file, it
must be called after flag.Parse().
loadDUTInfos loads available DUT test infos from the json file it must be called after flag . Parse () .
// Using a buffered channel as semaphore