Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ If you've never contributed to a Go project before, here is an example workflow.
1. `git push -u origin development` (setup where you push to, check it works)

Before opening a pull request, run `make test` and `make lint` (which needs
[golangci-lint](https://golangci-lint.run/)). If you change an enum or
`interface.go`, run `make generate` and commit the regenerated files.
[golangci-lint](https://golangci-lint.run/)). If you change an enum, run
`make generate` and commit the regenerated files.

# Packet Captures

Expand Down Expand Up @@ -201,8 +201,8 @@ protocol pair). By default it replays the recordings in `netsnmp/testdata`. With
installed (`libsnmp-dev`), `make -C netsnmp test_netsnmp` compares with the library
directly, and `go test -tags netsnmp -rec ./...` in `netsnmp/` re-records them.

The `*_string.go` files and the `go.uber.org/mock` mocks in `mocks/` are generated by
`go generate ./...`, which runs the `stringer` and `mockgen` versions pinned in `tools/go.mod`.
The `*_string.go` files are generated by `go generate ./...`, which runs the `stringer`
version pinned in `tools/go.mod`.

To profile cpu usage:

Expand Down
5 changes: 3 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
//
// # Lifecycle
//
// A client is a [Client] whose exported fields configure it: a literal, or
// [NewHandler] for code that takes the [Handler] interface. [Client.Connect]
// A client is a [Client] whose exported fields configure it. The package
// declares no interface of the client for tests to mock: code that mocks it
// declares one of its own with the methods it calls. [Client.Connect]
// fills in defaults ([MaxOids], a background Context), checks the SNMPv3
// configuration and opens the connection, a UDP socket connected to Target and
// Port, which replaces the client's (a failed Connect keeps it); a client may
Expand Down
7 changes: 6 additions & 1 deletion engine_walk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package gosnmp
import (
"fmt"
"maps"
"math"
"reflect"
"slices"
"strings"
Expand Down Expand Up @@ -213,7 +214,11 @@ func walkScenarios() map[string]walkScenario {
"empty-subtree/bulk": {root: ".1.3.6.1.2.1.1.4", bulk: true},
"max-repetitions/two": {root: walkIfDescr, bulk: true, setup: func(x *Client) { x.MaxRepetitions = 2 }},
"max-repetitions/one": {root: walkSystem, bulk: true, setup: func(x *Client) { x.MaxRepetitions = 1 }},
"v1-bulk": {root: walkSystem, bulk: true, v1: true},
// The request carries max-repetitions with its top bit cleared; the
// default replaces only a zero field, so the top bit alone sends 0.
"max-repetitions/max-uint32": {root: walkIfDescr, bulk: true, setup: func(x *Client) { x.MaxRepetitions = math.MaxUint32 }},
"max-repetitions/top-bit": {root: walkIfDescr, bulk: true, setup: func(x *Client) { x.MaxRepetitions = 1 << 31 }},
"v1-bulk": {root: walkSystem, bulk: true, v1: true},
// A root the codec cannot encode fails the walk before any request,
// naming the root as given.
"root-invalid": {root: "1.3.6.x"},
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ module github.com/netdata/gosnmp

go 1.27.0

require (
github.com/stretchr/testify v1.12.1
go.uber.org/mock v0.6.0
)
require github.com/stretchr/testify v1.12.1

require go.yaml.in/yaml/v3 v3.0.5 // indirect
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
217 changes: 0 additions & 217 deletions interface.go

This file was deleted.

Loading
Loading