chore: Fix linter findings for nolintlint (part2) (#12430)

Co-authored-by: Pawel Zak <Pawel Zak>
This commit is contained in:
Paweł Żak 2023-01-26 11:27:32 +01:00 committed by GitHub
parent d3809956a4
commit 00347033ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 112 additions and 189 deletions

View File

@ -204,9 +204,7 @@ func (k *KafkaConsumer) Start(acc telegraf.Accumulator) error {
err := k.consumer.Consume(ctx, k.Topics, handler)
if err != nil {
acc.AddError(fmt.Errorf("consume: %w", err))
// Ignore returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
internal.SleepContext(ctx, reconnectDelay)
internal.SleepContext(ctx, reconnectDelay) //nolint:errcheck // ignore returned error as we cannot do anything about it anyway
}
}
err = k.consumer.Close()

View File

@ -203,12 +203,10 @@ func (l *LeoFS) gatherServer(
if err := cmd.Start(); err != nil {
return err
}
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
defer internal.WaitTimeout(cmd, time.Second*5)
defer internal.WaitTimeout(cmd, time.Second*5) //nolint:errcheck // ignore the returned error as we cannot do anything about it anyway
scanner := bufio.NewScanner(stdout)
if !scanner.Scan() {
return fmt.Errorf("Unable to retrieve the node name")
return fmt.Errorf("unable to retrieve the node name")
}
nodeName, err := retrieveTokenAfterColon(scanner.Text())
if err != nil {

View File

@ -514,9 +514,7 @@ func (m *Mesos) gatherMainMetrics(u *url.URL, role Role, acc telegraf.Accumulato
}
data, err := io.ReadAll(resp.Body)
// Ignore the returned error to not shadow the initial one
//nolint:errcheck,revive
resp.Body.Close()
resp.Body.Close() //nolint:revive // ignore the returned error to not shadow the initial one
if err != nil {
return err
}

View File

@ -288,9 +288,7 @@ func TestMain(m *testing.M) {
masterRouter.HandleFunc("/metrics/snapshot", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
json.NewEncoder(w).Encode(masterMetrics)
json.NewEncoder(w).Encode(masterMetrics) //nolint:errcheck,revive // ignore the returned error as we cannot do anything about it anyway
})
masterTestServer = httptest.NewServer(masterRouter)
@ -298,9 +296,7 @@ func TestMain(m *testing.M) {
slaveRouter.HandleFunc("/metrics/snapshot", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
json.NewEncoder(w).Encode(slaveMetrics)
json.NewEncoder(w).Encode(slaveMetrics) //nolint:errcheck,revive // ignore the returned error as we cannot do anything about it anyway
})
slaveTestServer = httptest.NewServer(slaveRouter)

View File

@ -96,54 +96,61 @@ func (m *MongoDB) Init() error {
// Start runs after init and setup mongodb connections
func (m *MongoDB) Start(telegraf.Accumulator) error {
for _, connURL := range m.Servers {
if !strings.HasPrefix(connURL, "mongodb://") && !strings.HasPrefix(connURL, "mongodb+srv://") {
// Preserve backwards compatibility for hostnames without a
// scheme, broken in go 1.8. Remove in Telegraf 2.0
connURL = "mongodb://" + connURL
m.Log.Warnf("Using %q as connection URL; please update your configuration to use an URL", connURL)
if err := m.setupConnection(connURL); err != nil {
return err
}
u, err := url.Parse(connURL)
if err != nil {
return fmt.Errorf("unable to parse connection URL: %w", err)
}
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel() //nolint:revive
opts := options.Client().ApplyURI(connURL)
if m.tlsConfig != nil {
opts.TLSConfig = m.tlsConfig
}
if opts.ReadPreference == nil {
opts.ReadPreference = readpref.Nearest()
}
client, err := mongo.Connect(ctx, opts)
if err != nil {
return fmt.Errorf("unable to connect to MongoDB: %w", err)
}
err = client.Ping(ctx, opts.ReadPreference)
if err != nil {
if m.DisconnectedServersBehavior == "error" {
return fmt.Errorf("unable to ping MongoDB: %w", err)
}
m.Log.Errorf("unable to ping MongoDB: %w", err)
}
server := &Server{
client: client,
hostname: u.Host,
Log: m.Log,
}
m.clients = append(m.clients, server)
}
return nil
}
func (m *MongoDB) setupConnection(connURL string) error {
if !strings.HasPrefix(connURL, "mongodb://") && !strings.HasPrefix(connURL, "mongodb+srv://") {
// Preserve backwards compatibility for hostnames without a
// scheme, broken in go 1.8. Remove in Telegraf 2.0
connURL = "mongodb://" + connURL
m.Log.Warnf("Using %q as connection URL; please update your configuration to use an URL", connURL)
}
u, err := url.Parse(connURL)
if err != nil {
return fmt.Errorf("unable to parse connection URL: %w", err)
}
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
opts := options.Client().ApplyURI(connURL)
if m.tlsConfig != nil {
opts.TLSConfig = m.tlsConfig
}
if opts.ReadPreference == nil {
opts.ReadPreference = readpref.Nearest()
}
client, err := mongo.Connect(ctx, opts)
if err != nil {
return fmt.Errorf("unable to connect to MongoDB: %w", err)
}
err = client.Ping(ctx, opts.ReadPreference)
if err != nil {
if m.DisconnectedServersBehavior == "error" {
return fmt.Errorf("unable to ping MongoDB: %w", err)
}
m.Log.Errorf("unable to ping MongoDB: %w", err)
}
server := &Server{
client: client,
hostname: u.Host,
Log: m.Log,
}
m.clients = append(m.clients, server)
return nil
}
// Stop disconnect mongo connections when stop or reload
func (m *MongoDB) Stop() {
for _, server := range m.clients {

View File

@ -119,18 +119,14 @@ func (n *NetResponse) UDPGather() (map[string]string, map[string]interface{}, er
// Handle error
if err != nil {
setResult(ConnectionFailed, fields, tags, n.Expect)
// Error encoded in result
//nolint:nilerr
return tags, fields, nil
return tags, fields, nil //nolint:nilerr // error encoded in result
}
// Connecting
conn, err := net.DialUDP("udp", nil, udpAddr)
// Handle error
if err != nil {
setResult(ConnectionFailed, fields, tags, n.Expect)
// Error encoded in result
//nolint:nilerr
return tags, fields, nil
return tags, fields, nil //nolint:nilerr // error encoded in result
}
defer conn.Close()
// Send string
@ -151,9 +147,7 @@ func (n *NetResponse) UDPGather() (map[string]string, map[string]interface{}, er
// Handle error
if err != nil {
setResult(ReadFailed, fields, tags, n.Expect)
// Error encoded in result
//nolint:nilerr
return tags, fields, nil
return tags, fields, nil //nolint:nilerr // error encoded in result
}
// Looking for string in answer

View File

@ -220,11 +220,8 @@ func (n *mockNSQD) handle(conn net.Conn) {
}
exit:
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
n.tcpListener.Close()
//nolint:errcheck,revive
conn.Close()
n.tcpListener.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
conn.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
}
func framedResponse(frameType int32, data []byte) ([]byte, error) {

View File

@ -34,9 +34,7 @@ func fakePassengerStatus(stat string) (string, error) {
}
func teardown(tempFilePath string) {
// Ignore the returned error as we want to remove the file and ignore missing file errors
//nolint:errcheck,revive
os.Remove(tempFilePath)
os.Remove(tempFilePath) //nolint:revive // ignore the returned error as we want to remove the file and ignore missing file errors
}
func Test_Invalid_Passenger_Status_Cli(t *testing.T) {

View File

@ -276,9 +276,7 @@ func (c *child) serveRequest(req *request, body io.ReadCloser) {
httpReq.Body = body
c.handler.ServeHTTP(r, httpReq)
}
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
r.Close()
r.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
c.mu.Lock()
delete(c.requests, req.reqID)
c.mu.Unlock()
@ -293,15 +291,11 @@ func (c *child) serveRequest(req *request, body io.ReadCloser) {
// some sort of abort request to the host, so the host
// can properly cut off the client sending all the data.
// For now just bound it a little and
//nolint:errcheck,revive
io.CopyN(io.Discard, body, 100<<20)
//nolint:errcheck,revive
body.Close()
io.CopyN(io.Discard, body, 100<<20) //nolint:errcheck,revive // ignore the returned error as we cannot do anything about it anyway
body.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
if !req.keepConn {
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
c.conn.Close()
c.conn.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
}
}
@ -312,9 +306,7 @@ func (c *child) cleanUp() {
if req.pw != nil {
// race with call to Close in c.serveRequest doesn't matter because
// Pipe(Reader|Writer).Close are idempotent
// Ignore the returned error as we continue in the loop anyway
//nolint:errcheck,revive
req.pw.CloseWithError(ErrConnClosed)
req.pw.CloseWithError(ErrConnClosed) //nolint:revive // Ignore the returned error as we continue in the loop anyway
}
}
}

View File

@ -229,9 +229,7 @@ type bufWriter struct {
func (w *bufWriter) Close() error {
if err := w.Writer.Flush(); err != nil {
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
w.closer.Close()
w.closer.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
return err
}
return w.closer.Close()

View File

@ -79,8 +79,7 @@ func TestPhpFpmGeneratesMetrics_From_Fcgi(t *testing.T) {
defer tcp.Close()
s := statServer{}
//nolint:errcheck,revive
go fcgi.Serve(tcp, s)
go fcgi.Serve(tcp, s) //nolint:errcheck // ignore the returned error as we cannot do anything about it anyway
//Now we tested again above server
r := &phpfpm{
@ -125,8 +124,7 @@ func TestPhpFpmGeneratesMetrics_From_Socket(t *testing.T) {
defer tcp.Close()
s := statServer{}
//nolint:errcheck,revive
go fcgi.Serve(tcp, s)
go fcgi.Serve(tcp, s) //nolint:errcheck // ignore the returned error as we cannot do anything about it anyway
r := &phpfpm{
Urls: []string{tcp.Addr().String()},
@ -178,10 +176,8 @@ func TestPhpFpmGeneratesMetrics_From_Multiple_Sockets_With_Glob(t *testing.T) {
defer tcp2.Close()
s := statServer{}
//nolint:errcheck,revive
go fcgi.Serve(tcp1, s)
//nolint:errcheck,revive
go fcgi.Serve(tcp2, s)
go fcgi.Serve(tcp1, s) //nolint:errcheck // ignore the returned error as we cannot do anything about it anyway
go fcgi.Serve(tcp2, s) //nolint:errcheck // ignore the returned error as we cannot do anything about it anyway
r := &phpfpm{
Urls: []string{"/tmp/test-fpm[\\-0-9]*.sock"},
@ -234,8 +230,7 @@ func TestPhpFpmGeneratesMetrics_From_Socket_Custom_Status_Path(t *testing.T) {
defer tcp.Close()
s := statServer{}
//nolint:errcheck,revive
go fcgi.Serve(tcp, s)
go fcgi.Serve(tcp, s) //nolint:errcheck // ignore the returned error as we cannot do anything about it anyway
r := &phpfpm{
Urls: []string{tcp.Addr().String() + ":custom-status-path"},

View File

@ -143,9 +143,7 @@ func (p *Service) Start(telegraf.Accumulator) (err error) {
// Stop stops the services and closes any necessary channels and connections
func (p *Service) Stop() {
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
p.DB.Close()
p.DB.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
}
var kvMatcher, _ = regexp.Compile(`(password|sslcert|sslkey|sslmode|sslrootcert)=\S+ ?`)

View File

@ -57,12 +57,8 @@ func (s statServer) serverSocket(l net.Listener) {
data := buf[:n]
if string(data) == "show * \n" {
// Ignore the returned error as we need to close the socket anyway
//nolint:errcheck,revive
c.Write([]byte(metrics))
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
c.Close()
c.Write([]byte(metrics)) //nolint:errcheck,revive // ignore the returned error as we need to close the socket anyway
c.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
}
}(conn)
}

View File

@ -112,13 +112,8 @@ func TestV1PowerdnsRecursorGeneratesMetrics(t *testing.T) {
wg.Add(1)
go func() {
defer func() {
// Ignore the returned error as we need to remove the socket file anyway
//nolint:errcheck,revive
socket.Close()
// Ignore the returned error as we want to remove the file and ignore
// no-such-file errors
//nolint:errcheck,revive
os.Remove(controlSocket)
socket.Close() //nolint:revive // ignore the returned error as we need to remove the socket file anyway
os.Remove(controlSocket) //nolint:revive // ignore the returned error as we want to remove the file and ignore no-such-file errors
wg.Done()
}()
@ -126,20 +121,14 @@ func TestV1PowerdnsRecursorGeneratesMetrics(t *testing.T) {
buf := make([]byte, 1024)
n, remote, err := socket.ReadFromUnix(buf)
if err != nil {
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
socket.Close()
socket.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
return
}
data := buf[:n]
if string(data) == "get-all\n" {
// Ignore the returned error as we need to close the socket anyway
//nolint:errcheck,revive
socket.WriteToUnix([]byte(metrics), remote)
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
socket.Close()
socket.WriteToUnix([]byte(metrics), remote) //nolint:errcheck,revive // ignore the returned error as we need to close the socket anyway
socket.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
}
time.Sleep(100 * time.Millisecond)
@ -178,13 +167,8 @@ func TestV2PowerdnsRecursorGeneratesMetrics(t *testing.T) {
wg.Add(1)
go func() {
defer func() {
// Ignore the returned error as we need to remove the socket file anyway
//nolint:errcheck,revive
socket.Close()
// Ignore the returned error as we want to remove the file and ignore
// no-such-file errors
//nolint:errcheck,revive
os.Remove(controlSocket)
socket.Close() //nolint:revive // ignore the returned error as we need to remove the socket file anyway
os.Remove(controlSocket) //nolint:revive // ignore the returned error as we want to remove the file and ignore no-such-file errors
wg.Done()
}()
@ -192,31 +176,22 @@ func TestV2PowerdnsRecursorGeneratesMetrics(t *testing.T) {
status := make([]byte, 4)
n, _, err := socket.ReadFromUnix(status)
if err != nil || n != 4 {
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
socket.Close()
socket.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
return
}
buf := make([]byte, 1024)
n, remote, err := socket.ReadFromUnix(buf)
if err != nil {
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
socket.Close()
socket.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
return
}
data := buf[:n]
if string(data) == "get-all" {
// Ignore the returned error as we need to close the socket anyway
//nolint:errcheck,revive
socket.WriteToUnix([]byte{0, 0, 0, 0}, remote)
//nolint:errcheck,revive
socket.WriteToUnix([]byte(metrics), remote)
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
socket.Close()
socket.WriteToUnix([]byte{0, 0, 0, 0}, remote) //nolint:errcheck,revive // ignore the returned error as we need to close the socket anyway
socket.WriteToUnix([]byte(metrics), remote) //nolint:errcheck,revive // ignore the returned error as we need to close the socket anyway
socket.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
}
time.Sleep(100 * time.Millisecond)
@ -254,13 +229,8 @@ func TestV3PowerdnsRecursorGeneratesMetrics(t *testing.T) {
wg.Add(1)
go func() {
defer func() {
// Ignore the returned error as we need to remove the socket file anyway
//nolint:errcheck,revive
socket.Close()
// Ignore the returned error as we want to remove the file and ignore
// no-such-file errors
//nolint:errcheck,revive
os.Remove(controlSocket)
socket.Close() //nolint:revive // ignore the returned error as we need to remove the socket file anyway
os.Remove(controlSocket) //nolint:revive // ignore the returned error as we want to remove the file and ignore no-such-file errors
wg.Done()
}()
@ -288,21 +258,11 @@ func TestV3PowerdnsRecursorGeneratesMetrics(t *testing.T) {
}
if string(buf) == "get-all" {
// Ignore the returned error as we need to close the socket anyway
//nolint:errcheck,revive
conn.Write([]byte{0, 0, 0, 0})
conn.Write([]byte{0, 0, 0, 0}) //nolint:errcheck,revive // ignore the returned error as we need to close the socket anyway
metrics := []byte(metrics)
//nolint:errcheck,revive
writeNativeUIntToConn(conn, uint(len(metrics)))
//nolint:errcheck,revive
conn.Write(metrics)
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
socket.Close()
writeNativeUIntToConn(conn, uint(len(metrics))) //nolint:errcheck,revive // ignore the returned error as we cannot do anything about it anyway
conn.Write(metrics) //nolint:errcheck,revive // ignore the returned error as we cannot do anything about it anyway
socket.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
}
time.Sleep(100 * time.Millisecond)

View File

@ -8,7 +8,7 @@ import (
"github.com/shirou/gopsutil/v3/process"
)
// nolint:interfacebloat // conditionally allow to contain more methods
//nolint:interfacebloat // conditionally allow to contain more methods
type Process interface {
PID() PID
Tags() map[string]string

View File

@ -90,9 +90,7 @@ func (s *SFlow) Gather(_ telegraf.Accumulator) error {
func (s *SFlow) Stop() {
if s.closer != nil {
// Ignore the returned error as we cannot do anything about it anyway
//nolint:errcheck,revive
s.closer.Close()
s.closer.Close() //nolint:revive // ignore the returned error as we cannot do anything about it anyway
}
s.wg.Wait()
}

View File

@ -567,7 +567,7 @@ func (m *Smart) getVendorNVMeAttributes(acc telegraf.Accumulator, devices []stri
for _, device := range nvmeDevices {
if contains(m.EnableExtensions, "auto-on") {
// nolint:revive // one case switch on purpose to demonstrate potential extensions
//nolint:revive // one case switch on purpose to demonstrate potential extensions
switch device.vendorID {
case intelVID:
wg.Add(1)

View File

@ -34,13 +34,13 @@ type gosmiSnmpTranslateCache struct {
var gosmiSnmpTranslateCachesLock sync.Mutex
var gosmiSnmpTranslateCaches map[string]gosmiSnmpTranslateCache
//nolint:revive
func (g *gosmiTranslator) SnmpTranslate(oid string) (string, string, string, string, error) {
a, b, c, d, _, e := g.SnmpTranslateFull(oid)
return a, b, c, d, e
//nolint:revive //function-result-limit conditionally 5 return results allowed
func (g *gosmiTranslator) SnmpTranslate(oid string) (mibName string, oidNum string, oidText string, conversion string, err error) {
mibName, oidNum, oidText, conversion, _, err = g.SnmpTranslateFull(oid)
return mibName, oidNum, oidText, conversion, err
}
//nolint:revive
//nolint:revive //function-result-limit conditionally 6 return results allowed
func (g *gosmiTranslator) SnmpTranslateFull(oid string) (
mibName string, oidNum string, oidText string,
conversion string,

View File

@ -60,7 +60,7 @@ var snmpTableCachesLock sync.Mutex
// snmpTable resolves the given OID as a table, providing information about the
// table and fields within.
//
//nolint:revive
//nolint:revive //function-result-limit conditionally 5 return results allowed
func (n *netsnmpTranslator) SnmpTable(oid string) (
mibName string, oidNum string, oidText string,
fields []Field,
@ -81,7 +81,7 @@ func (n *netsnmpTranslator) SnmpTable(oid string) (
return stc.mibName, stc.oidNum, stc.oidText, stc.fields, stc.err
}
//nolint:revive
//nolint:revive //function-result-limit conditionally 5 return results allowed
func (n *netsnmpTranslator) snmpTableCall(oid string) (
mibName string, oidNum string, oidText string,
fields []Field,
@ -157,7 +157,7 @@ var snmpTranslateCaches map[string]snmpTranslateCache
// snmpTranslate resolves the given OID.
//
//nolint:revive
//nolint:revive //function-result-limit conditionally 5 return results allowed
func (n *netsnmpTranslator) SnmpTranslate(oid string) (
mibName string, oidNum string, oidText string,
conversion string,
@ -187,7 +187,7 @@ func (n *netsnmpTranslator) SnmpTranslate(oid string) (
return stc.mibName, stc.oidNum, stc.oidText, stc.conversion, stc.err
}
//nolint:revive
//nolint:revive //function-result-limit conditionally 5 return results allowed
func snmpTranslateCall(oid string) (mibName string, oidNum string, oidText string, conversion string, err error) {
var out []byte
if strings.ContainsAny(oid, ":abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") {

View File

@ -53,7 +53,7 @@ type SnmpTrap struct {
Log telegraf.Logger `toml:"-"`
translator translator //nolint:revive
transl translator
}
func (*SnmpTrap) SampleConfig() string {
@ -84,12 +84,12 @@ func (s *SnmpTrap) Init() error {
var err error
switch s.Translator {
case "gosmi":
s.translator, err = newGosmiTranslator(s.Path, s.Log)
s.transl, err = newGosmiTranslator(s.Path, s.Log)
if err != nil {
return err
}
case "netsnmp":
s.translator = newNetsnmpTranslator(s.Timeout)
s.transl = newNetsnmpTranslator(s.Timeout)
default:
return fmt.Errorf("invalid translator value")
}
@ -268,7 +268,7 @@ func makeTrapHandler(s *SnmpTrap) gosnmp.TrapHandlerFunc {
}
if trapOid != "" {
e, err := s.translator.lookup(trapOid)
e, err := s.transl.lookup(trapOid)
if err != nil {
s.Log.Errorf("Error resolving V1 OID, oid=%s, source=%s: %v", trapOid, tags["source"], err)
return
@ -306,7 +306,7 @@ func makeTrapHandler(s *SnmpTrap) gosnmp.TrapHandlerFunc {
var e snmp.MibEntry
var err error
e, err = s.translator.lookup(val)
e, err = s.transl.lookup(val)
if nil != err {
s.Log.Errorf("Error resolving value OID, oid=%s, source=%s: %v", val, tags["source"], err)
return
@ -324,7 +324,7 @@ func makeTrapHandler(s *SnmpTrap) gosnmp.TrapHandlerFunc {
value = v.Value
}
e, err := s.translator.lookup(v.Name)
e, err := s.transl.lookup(v.Name)
if nil != err {
s.Log.Errorf("Error resolving OID oid=%s, source=%s: %v", v.Name, tags["source"], err)
return

View File

@ -1287,7 +1287,7 @@ func TestReceiveTrap(t *testing.T) {
require.NoError(t, s.Init())
//inject test translator
s.translator = newTestTranslator(tt.entries)
s.transl = newTestTranslator(tt.entries)
var acc testutil.Accumulator
require.NoError(t, s.Start(&acc))