Skip to content

fix(CubeNet): Remove dead code - #1583

Merged
zhouxianping merged 1 commit into
TencentCloud:masterfrom
FakeLearne:remove-dead-code
Sep 1, 2026
Merged

zhouxianping merged 1 commit into
TencentCloud:masterfrom
FakeLearne:remove-dead-code

Conversation

@FakeLearne

Copy link
Copy Markdown
Collaborator

Remove dead code in /CubeNet

Signed-off-by: yarrischen <yarrischen@tencent.com>
Comment thread CubeNet/cubevs/cubevs.go
// Errors that will be returned to upper layer.
var (
// ErrProgNotExist is returned when there is no specified BPF program in BPF object.
ErrProgNotExist = errors.New("BPF program not exists")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, non-blocking: ErrProgNotExist is an exported error in a library package (// Package cubevs is a library to manage CubeVS.). It has no in-repo references, so removal is fine, but it's technically a public API surface change — any external consumer of this package referencing the symbol would break. Acceptable for a dead-code cleanup; just worth being aware of. The two unexported removals (reapDNSLearnedPoliciesForInnerMap, ingressSession) are unambiguously safe, and keeping the ingressSessionValue struct (still used by the size assert in cubevs.go:327 and dump.go:466) is correct.

@cubesandboxbot

Copy link
Copy Markdown

Review: fix(CubeNet): Remove dead code (#1583)

This review was AI-generated.

Verdict: Approve. The PR deletes three symbols that are genuinely unreferenced across the entire repository, and the removals leave no orphaned imports or types. Clean, safe dead-code removal.

Verification

I searched the full base tree for each removed symbol:

Removed symbol References outside definition Verdict
ErrProgNotExist (cubevs.go) None (definition + comment only) Dead ✓
reapDNSLearnedPoliciesForInnerMap (dns_reaper.go) None Dead ✓
ingressSession (reaper.go) None (already carried //nolint:unused) Dead ✓

Import safety — no import becomes unused after the deletions:

  • dns_reaper.go: fmt, errors, and ebpf all still have live call sites (reapDNSLearnedPoliciesForIfindex, reapDNSQueryTrack, etc.).
  • reaper.go: fmt, uint32ToIP, ntohs remain used by egressSession (reaper.go:204-219).
  • cubevs.go: errors remains used by ErrTooLong.

Type retention is correct — the PR keeps ingressSessionValue (reaper.go:221), which is the right call: the struct is still consumed by the static size assert at cubevs.go:327 and by the dump path at dump.go:466. Only the formatting helper was dead.

Minor note (non-blocking)

ErrProgNotExist is an exported identifier in a library package (// Package cubevs is a library to manage CubeVS.). Within the repo it has zero references, so this is fine to remove, but it is technically a public API surface change — external consumers compiling against this package would break. Given it's unused in-tree and the commit is framed as dead-code cleanup, this is acceptable; just flagging in case any downstream vendoring depends on it.

Suggested follow-up (optional)

Nothing blocking. If you want to keep the "dead code" cleanup complete, consider a quick go vet / build check on the CubeNet module — though static analysis shows no issues.

@zhouxianping
zhouxianping merged commit 1448df1 into TencentCloud:master Sep 1, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants