Skip to content

Commit 6660b7a

Browse files
committed
*: gofmt with 1.19
Format output docstrings according to 1.19 convention in bpf2go. Signed-off-by: Timo Beckers <[email protected]>
1 parent 15acac1 commit 6660b7a

37 files changed

+159
-159
lines changed

asm/alu.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ package asm
44

55
// Source of ALU / ALU64 / Branch operations
66
//
7-
// msb lsb
8-
// +----+-+---+
9-
// |op |S|cls|
10-
// +----+-+---+
7+
// msb lsb
8+
// +----+-+---+
9+
// |op |S|cls|
10+
// +----+-+---+
1111
type Source uint8
1212

1313
const sourceMask OpCode = 0x08
@@ -39,10 +39,10 @@ const (
3939

4040
// ALUOp are ALU / ALU64 operations
4141
//
42-
// msb lsb
43-
// +----+-+---+
44-
// |OP |s|cls|
45-
// +----+-+---+
42+
// msb lsb
43+
// +----+-+---+
44+
// |OP |s|cls|
45+
// +----+-+---+
4646
type ALUOp uint8
4747

4848
const aluMask OpCode = 0xf0

asm/func.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ func (_ BuiltinFunc) Max() BuiltinFunc {
1313
//
1414
// You can regenerate this list using the following gawk script:
1515
//
16-
// /FN\(.+\),/ {
17-
// match($1, /\((.+)\)/, r)
18-
// split(r[1], p, "_")
19-
// printf "Fn"
20-
// for (i in p) {
21-
// printf "%s%s", toupper(substr(p[i], 1, 1)), substr(p[i], 2)
22-
// }
23-
// print ""
24-
// }
16+
// /FN\(.+\),/ {
17+
// match($1, /\((.+)\)/, r)
18+
// split(r[1], p, "_")
19+
// printf "Fn"
20+
// for (i in p) {
21+
// printf "%s%s", toupper(substr(p[i], 1, 1)), substr(p[i], 2)
22+
// }
23+
// print ""
24+
// }
2525
//
2626
// The script expects include/uapi/linux/bpf.h as it's input.
2727
const (

asm/jump.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ package asm
44

55
// JumpOp affect control flow.
66
//
7-
// msb lsb
8-
// +----+-+---+
9-
// |OP |s|cls|
10-
// +----+-+---+
7+
// msb lsb
8+
// +----+-+---+
9+
// |OP |s|cls|
10+
// +----+-+---+
1111
type JumpOp uint8
1212

1313
const jumpMask OpCode = aluMask

asm/load_store.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ package asm
44

55
// Mode for load and store operations
66
//
7-
// msb lsb
8-
// +---+--+---+
9-
// |MDE|sz|cls|
10-
// +---+--+---+
7+
// msb lsb
8+
// +---+--+---+
9+
// |MDE|sz|cls|
10+
// +---+--+---+
1111
type Mode uint8
1212

1313
const modeMask OpCode = 0xe0
@@ -30,10 +30,10 @@ const (
3030

3131
// Size of load and store operations
3232
//
33-
// msb lsb
34-
// +---+--+---+
35-
// |mde|SZ|cls|
36-
// +---+--+---+
33+
// msb lsb
34+
// +---+--+---+
35+
// |mde|SZ|cls|
36+
// +---+--+---+
3737
type Size uint8
3838

3939
const sizeMask OpCode = 0x18

asm/opcode.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99

1010
// Class of operations
1111
//
12-
// msb lsb
13-
// +---+--+---+
14-
// | ?? |CLS|
15-
// +---+--+---+
12+
// msb lsb
13+
// +---+--+---+
14+
// | ?? |CLS|
15+
// +---+--+---+
1616
type Class uint8
1717

1818
const classMask OpCode = 0x07
@@ -70,10 +70,10 @@ func (cls Class) isJumpOrALU() bool {
7070
//
7171
// Its encoding is defined by a Class value:
7272
//
73-
// msb lsb
74-
// +----+-+---+
75-
// | ???? |CLS|
76-
// +----+-+---+
73+
// msb lsb
74+
// +----+-+---+
75+
// | ???? |CLS|
76+
// +----+-+---+
7777
type OpCode uint8
7878

7979
// InvalidOpCode is returned by setters on OpCode

btf/core.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,9 @@ func (ca coreAccessor) enumValue(t Type) (*EnumValue, error) {
536536
// coreField represents the position of a "child" of a composite type from the
537537
// start of that type.
538538
//
539-
// /- start of composite
540-
// | offset * 8 | bitfieldOffset | bitfieldSize | ... |
541-
// \- start of field end of field -/
539+
// /- start of composite
540+
// | offset * 8 | bitfieldOffset | bitfieldSize | ... |
541+
// \- start of field end of field -/
542542
type coreField struct {
543543
Type Type
544544

btf/format.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ func (gf *GoFormatter) enumIdentifier(name, element string) string {
5656
//
5757
// It encodes https://golang.org/ref/spec#Type_declarations:
5858
//
59-
// type foo struct { bar uint32; }
60-
// type bar int32
59+
// type foo struct { bar uint32; }
60+
// type bar int32
6161
func (gf *GoFormatter) writeTypeDecl(name string, typ Type) error {
6262
if name == "" {
6363
return fmt.Errorf("need a name for type %s", typ)
@@ -102,8 +102,8 @@ func (gf *GoFormatter) writeTypeDecl(name string, typ Type) error {
102102
//
103103
// It encodes https://golang.org/ref/spec#Types.
104104
//
105-
// foo (if foo is a named type)
106-
// uint32
105+
// foo (if foo is a named type)
106+
// uint32
107107
func (gf *GoFormatter) writeType(typ Type, depth int) error {
108108
typ = skipQualifiers(typ)
109109

@@ -122,8 +122,8 @@ func (gf *GoFormatter) writeType(typ Type, depth int) error {
122122
//
123123
// It encodes https://golang.org/ref/spec#TypeLit.
124124
//
125-
// struct { bar uint32; }
126-
// uint32
125+
// struct { bar uint32; }
126+
// uint32
127127
func (gf *GoFormatter) writeTypeLit(typ Type, depth int) error {
128128
depth++
129129
if depth > maxTypeDepth {

cmd/bpf2go/output.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ func {{ .Name.Load }}() (*ebpf.CollectionSpec, error) {
5656
//
5757
// The following types are suitable as obj argument:
5858
//
59-
// *{{ .Name.Objects }}
60-
// *{{ .Name.Programs }}
61-
// *{{ .Name.Maps }}
59+
// *{{ .Name.Objects }}
60+
// *{{ .Name.Programs }}
61+
// *{{ .Name.Maps }}
6262
//
6363
// See ebpf.CollectionSpec.LoadAndAssign documentation for details.
6464
func {{ .Name.LoadObjects }}(obj interface{}, opts *ebpf.CollectionOptions) (error) {

cmd/bpf2go/test/test_bpfeb.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/bpf2go/test/test_bpfel.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

collection.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ func (cs *CollectionSpec) RewriteMaps(maps map[string]*Map) error {
111111
//
112112
// The constant must be defined like so in the C program:
113113
//
114-
// volatile const type foobar;
115-
// volatile const type foobar = default;
114+
// volatile const type foobar;
115+
// volatile const type foobar = default;
116116
//
117117
// Replacement values must be of the same length as the C sizeof(type).
118118
// If necessary, they are marshalled according to the same rules as
@@ -198,11 +198,11 @@ func (cs *CollectionSpec) RewriteConstants(consts map[string]interface{}) error
198198
// The tag's value specifies the name of the program or map as
199199
// found in the CollectionSpec.
200200
//
201-
// struct {
202-
// Foo *ebpf.ProgramSpec `ebpf:"xdp_foo"`
203-
// Bar *ebpf.MapSpec `ebpf:"bar_map"`
204-
// Ignored int
205-
// }
201+
// struct {
202+
// Foo *ebpf.ProgramSpec `ebpf:"xdp_foo"`
203+
// Bar *ebpf.MapSpec `ebpf:"bar_map"`
204+
// Ignored int
205+
// }
206206
//
207207
// Returns an error if any of the eBPF objects can't be found, or
208208
// if the same MapSpec or ProgramSpec is assigned multiple times.
@@ -249,11 +249,11 @@ func (cs *CollectionSpec) Assign(to interface{}) error {
249249
// dependent resources are loaded into the kernel and populated with values if
250250
// specified.
251251
//
252-
// struct {
253-
// Foo *ebpf.Program `ebpf:"xdp_foo"`
254-
// Bar *ebpf.Map `ebpf:"bar_map"`
255-
// Ignored int
256-
// }
252+
// struct {
253+
// Foo *ebpf.Program `ebpf:"xdp_foo"`
254+
// Bar *ebpf.Map `ebpf:"bar_map"`
255+
// Ignored int
256+
// }
257257
//
258258
// opts may be nil.
259259
//

examples/cgroup_skb/bpf_bpfeb.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/cgroup_skb/bpf_bpfel.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/fentry/bpf_bpfeb.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/fentry/bpf_bpfel.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/kprobe/bpf_bpfeb.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/kprobe/bpf_bpfel.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/kprobe_percpu/bpf_bpfeb.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/kprobe_percpu/bpf_bpfel.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/kprobepin/bpf_bpfeb.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/kprobepin/bpf_bpfel.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)