Skip to content

Commit 839118d

Browse files
committed
features: fix documentation
Exporting feature tests as variables means that they can't be navigated to in online documentation. Fix this by exporting functions instead. Signed-off-by: Lorenz Bauer <[email protected]>
1 parent 394be60 commit 839118d

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

features/misc.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ import (
1212
// Upstream commit c04c0d2b968a ("bpf: increase complexity limit and maximum program size").
1313
//
1414
// See the package documentation for the meaning of the error return value.
15-
var HaveLargeInstructions = internal.NewFeatureTest(">4096 instructions", "5.2", func() error {
15+
func HaveLargeInstructions() error {
16+
return haveLargeInstructions()
17+
}
18+
19+
var haveLargeInstructions = internal.NewFeatureTest(">4096 instructions", "5.2", func() error {
1620
const maxInsns = 4096
1721

1822
insns := make(asm.Instructions, maxInsns, maxInsns+1)
@@ -32,7 +36,11 @@ var HaveLargeInstructions = internal.NewFeatureTest(">4096 instructions", "5.2",
3236
// Upstream commit 2589726d12a1 ("bpf: introduce bounded loops").
3337
//
3438
// See the package documentation for the meaning of the error return value.
35-
var HaveBoundedLoops = internal.NewFeatureTest("bounded loops", "5.3", func() error {
39+
func HaveBoundedLoops() error {
40+
return haveBoundedLoops()
41+
}
42+
43+
var haveBoundedLoops = internal.NewFeatureTest("bounded loops", "5.3", func() error {
3644
return probeProgram(&ebpf.ProgramSpec{
3745
Type: ebpf.SocketFilter,
3846
Instructions: asm.Instructions{
@@ -49,7 +57,11 @@ var HaveBoundedLoops = internal.NewFeatureTest("bounded loops", "5.3", func() er
4957
// Upstream commit 92b31a9af73b ("bpf: add BPF_J{LT,LE,SLT,SLE} instructions").
5058
//
5159
// See the package documentation for the meaning of the error return value.
52-
var HaveV2ISA = internal.NewFeatureTest("v2 ISA", "4.14", func() error {
60+
func HaveV2ISA() error {
61+
return haveV2ISA()
62+
}
63+
64+
var haveV2ISA = internal.NewFeatureTest("v2 ISA", "4.14", func() error {
5365
return probeProgram(&ebpf.ProgramSpec{
5466
Type: ebpf.SocketFilter,
5567
Instructions: asm.Instructions{
@@ -66,7 +78,11 @@ var HaveV2ISA = internal.NewFeatureTest("v2 ISA", "4.14", func() error {
6678
// Upstream commit 092ed0968bb6 ("bpf: verifier support JMP32").
6779
//
6880
// See the package documentation for the meaning of the error return value.
69-
var HaveV3ISA = internal.NewFeatureTest("v3 ISA", "5.1", func() error {
81+
func HaveV3ISA() error {
82+
return haveV3ISA()
83+
}
84+
85+
var haveV3ISA = internal.NewFeatureTest("v3 ISA", "5.1", func() error {
7086
return probeProgram(&ebpf.ProgramSpec{
7187
Type: ebpf.SocketFilter,
7288
Instructions: asm.Instructions{

0 commit comments

Comments
 (0)