From d6ff5f7d9624ea48c0d67c36668b2ca6b3004236 Mon Sep 17 00:00:00 2001 From: kunish <17328586+kunish@users.noreply.github.com> Date: Fri, 17 Feb 2023 16:31:37 +0800 Subject: [PATCH] style: run go fmt on every .go file (#392) --- common/generics/list/list.go | 2 +- component/ebpf/redir/bpf_bpfeb.go | 7 ++++--- component/ebpf/redir/bpf_bpfel.go | 7 ++++--- component/ebpf/tc/bpf_bpfeb.go | 7 ++++--- component/ebpf/tc/bpf_bpfel.go | 7 ++++--- constant/dns.go | 2 +- dns/doh.go | 2 +- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/common/generics/list/list.go b/common/generics/list/list.go index a06a7c61..04d84180 100644 --- a/common/generics/list/list.go +++ b/common/generics/list/list.go @@ -5,10 +5,10 @@ // Package list implements a doubly linked list. // // To iterate over a list (where l is a *List): +// // for e := l.Front(); e != nil; e = e.Next() { // // do something with e.Value // } -// package list // Element is an element of a linked list. diff --git a/component/ebpf/redir/bpf_bpfeb.go b/component/ebpf/redir/bpf_bpfeb.go index ec0e1a77..57a526e8 100644 --- a/component/ebpf/redir/bpf_bpfeb.go +++ b/component/ebpf/redir/bpf_bpfeb.go @@ -41,9 +41,9 @@ func loadBpf() (*ebpf.CollectionSpec, error) { // // The following types are suitable as obj argument: // -// *bpfObjects -// *bpfPrograms -// *bpfMaps +// *bpfObjects +// *bpfPrograms +// *bpfMaps // // See ebpf.CollectionSpec.LoadAndAssign documentation for details. func loadBpfObjects(obj interface{}, opts *ebpf.CollectionOptions) error { @@ -134,5 +134,6 @@ func _BpfClose(closers ...io.Closer) error { } // Do not access this directly. +// //go:embed bpf_bpfeb.o var _BpfBytes []byte diff --git a/component/ebpf/redir/bpf_bpfel.go b/component/ebpf/redir/bpf_bpfel.go index ed859e5d..936b84eb 100644 --- a/component/ebpf/redir/bpf_bpfel.go +++ b/component/ebpf/redir/bpf_bpfel.go @@ -41,9 +41,9 @@ func loadBpf() (*ebpf.CollectionSpec, error) { // // The following types are suitable as obj argument: // -// *bpfObjects -// *bpfPrograms -// *bpfMaps +// *bpfObjects +// *bpfPrograms +// *bpfMaps // // See ebpf.CollectionSpec.LoadAndAssign documentation for details. func loadBpfObjects(obj interface{}, opts *ebpf.CollectionOptions) error { @@ -134,5 +134,6 @@ func _BpfClose(closers ...io.Closer) error { } // Do not access this directly. +// //go:embed bpf_bpfel.o var _BpfBytes []byte diff --git a/component/ebpf/tc/bpf_bpfeb.go b/component/ebpf/tc/bpf_bpfeb.go index 12847538..623986dc 100644 --- a/component/ebpf/tc/bpf_bpfeb.go +++ b/component/ebpf/tc/bpf_bpfeb.go @@ -28,9 +28,9 @@ func loadBpf() (*ebpf.CollectionSpec, error) { // // The following types are suitable as obj argument: // -// *bpfObjects -// *bpfPrograms -// *bpfMaps +// *bpfObjects +// *bpfPrograms +// *bpfMaps // // See ebpf.CollectionSpec.LoadAndAssign documentation for details. func loadBpfObjects(obj interface{}, opts *ebpf.CollectionOptions) error { @@ -115,5 +115,6 @@ func _BpfClose(closers ...io.Closer) error { } // Do not access this directly. +// //go:embed bpf_bpfeb.o var _BpfBytes []byte diff --git a/component/ebpf/tc/bpf_bpfel.go b/component/ebpf/tc/bpf_bpfel.go index c09e35bb..07daba12 100644 --- a/component/ebpf/tc/bpf_bpfel.go +++ b/component/ebpf/tc/bpf_bpfel.go @@ -28,9 +28,9 @@ func loadBpf() (*ebpf.CollectionSpec, error) { // // The following types are suitable as obj argument: // -// *bpfObjects -// *bpfPrograms -// *bpfMaps +// *bpfObjects +// *bpfPrograms +// *bpfMaps // // See ebpf.CollectionSpec.LoadAndAssign documentation for details. func loadBpfObjects(obj interface{}, opts *ebpf.CollectionOptions) error { @@ -115,5 +115,6 @@ func _BpfClose(closers ...io.Closer) error { } // Do not access this directly. +// //go:embed bpf_bpfel.o var _BpfBytes []byte diff --git a/constant/dns.go b/constant/dns.go index da68753c..3d97d97b 100644 --- a/constant/dns.go +++ b/constant/dns.go @@ -124,4 +124,4 @@ const ( HTTPVersion2 HTTPVersion = "h2" // HTTPVersion3 is HTTP/3. HTTPVersion3 HTTPVersion = "h3" -) \ No newline at end of file +) diff --git a/dns/doh.go b/dns/doh.go index 0a9efe1c..1e6528d9 100644 --- a/dns/doh.go +++ b/dns/doh.go @@ -109,7 +109,7 @@ func (doh *dnsOverHTTPS) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D. // formats that include the ID field from the DNS message header, such // as "application/dns-message", SHOULD use a DNS ID of 0 in every DNS // request. - m=m.Copy() + m = m.Copy() id := m.Id m.Id = 0 defer func() {