MCPcopy Index your code
hub / github.com/pterm/pterm / errCheck

Method errCheck

heatmap_printer.go:684–726  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

682}
683
684func (p HeatmapPrinter) errCheck() error {
685 if p.HasHeader {
686 if p.Axis.XAxis == nil {
687 return errors.New("x axis is nil")
688 }
689 if p.Axis.YAxis == nil {
690 return errors.New("y axis is nil")
691 }
692
693 if len(p.Axis.XAxis) == 0 {
694 return errors.New("x axis is empty")
695 }
696 if len(p.Axis.YAxis) == 0 {
697 return errors.New("y axis is empty")
698 }
699
700 for i := 1; i < len(p.Data); i++ {
701 if len(p.Data[i]) != len(p.Axis.XAxis) {
702 return errors.New("x axis length does not match data")
703 }
704 }
705 if len(p.Axis.YAxis) != len(p.Data) {
706 return errors.New("y axis length does not match data")
707 }
708 }
709
710 if p.Data == nil {
711 return errors.New("data is nil")
712 }
713
714 if len(p.Data) == 0 {
715 return errors.New("data is empty")
716 }
717
718 // check if p.Data[n] has the same length
719 for i := 1; i < len(p.Data); i++ {
720 if len(p.Data[i]) != len(p.Data[0]) {
721 return errors.New("data is not rectangular")
722 }
723 }
724
725 return nil
726}
727
728// return min and max value of a slice
729func minMaxFloat32(s [][]float32) (float32, float32) {

Callers 1

SrenderMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected