code: func FindSlotByLabel(p *pkcs11.Ctx, slotLabel string) (slot uint, index int, err error) {
  
  	var slotFound bool
  
  	// Get list of slots
  	slots, err := p.GetSlotList(true)
  	if err == nil {
  
  		// Look for matching slot label
  		for i, s := range slots {
  			tInfo, errGt := p.GetTokenInfo(s)
  			if errGt != nil {
  				err = errGt
  				return
  			}
  			if slotLabel == tInfo.Label {
  				slotFound = true
  				slot = s
  				index = i
  				fmt.Printf("PKCS11 provider found specified slot label: %s (slot: %d, index: %d)\n", slotLabel, slot, i)
  				break
  			}
  		}
  	}
  
  	// set error if slot not found
  	if !slotFound {
  		err = errors.New(fmt.Sprintf("Could not find slot with label: %s", slotLabel))
  	}
  
  	return
  }
docs: /* Return the slotID of token label */