INNER CODE UNIT · Go
chooseSource
inspektor-gadget/inspektor-gadget · cmd/gpu-ebpf-bridge/main.go:135
func chooseSource(mode, libraryPath string, logger *slog.Logger) (nvml.Poller, string, error) {
tryReal := func() (nvml.Poller, error) {
// SA4023: in the default (non-nvml) stub build newRealPoller always
// returns a non-nil error, so staticcheck flags both the call (as
// related information) and the comparison as statically "always true".
// With -tags nvml the real backend can succeed and return nil, so this
// is a false positive for the shipping build; suppress it on both lines.
p, err := newRealPoller(libraryPath) //nolint:staticcheck
if err != nil { //nolint:staticcheck
return nil, err
}
if err := p.Init(); err != nil {
_ = p.Close()
return nil, err
}
return p, nil
}