Skip to content

Commit 4810b98

Browse files
committed
Apply gofumpt and gci formatting. Explicitly enable errcheck in config
file Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
1 parent 1f54bba commit 4810b98

148 files changed

Lines changed: 448 additions & 434 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.golangci.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ linters:
1313
- predeclared
1414
- revive
1515
- whitespace
16+
- errcheck
1617
settings:
1718
errcheck:
1819
exclude-functions:
@@ -52,8 +53,15 @@ issues:
5253
max-same-issues: 0
5354
formatters:
5455
enable:
55-
- gofmt
56+
- gci
57+
- gofumpt
5658
settings:
59+
gci:
60+
sections:
61+
- standard
62+
- default
63+
- prefix(px.dev)
64+
custom-order: true
5765
goimports:
5866
local-prefixes:
5967
- px.dev

src/api/go/pxapi/examples/basic_example/example.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ import (
2828
"px.dev/pixie/src/api/go/pxapi/types"
2929
)
3030

31-
var (
32-
pxl = `
31+
var pxl = `
3332
import px
3433
df = px.DataFrame('http_events')
3534
df = df[['upid', 'req_path', 'remote_addr', 'req_method']]
3635
df = df.head(10)
3736
px.display(df, 'http')
3837
`
39-
)
4038

4139
type tablePrinter struct{}
4240

@@ -56,8 +54,7 @@ func (t *tablePrinter) HandleDone(ctx context.Context) error {
5654
return nil
5755
}
5856

59-
type tableMux struct {
60-
}
57+
type tableMux struct{}
6158

6259
func (s *tableMux) AcceptTable(ctx context.Context, metadata types.TableMetadata) (pxapi.TableRecordHandler, error) {
6360
return &tablePrinter{}, nil

src/api/go/pxapi/examples/encryption_example/example.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ import (
2828
"px.dev/pixie/src/api/go/pxapi/types"
2929
)
3030

31-
var (
32-
pxl = `
31+
var pxl = `
3332
import px
3433
df = px.DataFrame('http_events')
3534
df = df[['upid', 'req_path', 'remote_addr', 'req_method']]
3635
df = df.head(10)
3736
px.display(df, 'http')
3837
`
39-
)
4038

4139
type tablePrinter struct{}
4240

@@ -56,8 +54,7 @@ func (t *tablePrinter) HandleDone(ctx context.Context) error {
5654
return nil
5755
}
5856

59-
type tableMux struct {
60-
}
57+
type tableMux struct{}
6158

6259
func (s *tableMux) AcceptTable(ctx context.Context, metadata types.TableMetadata) (pxapi.TableRecordHandler, error) {
6360
return &tablePrinter{}, nil

src/api/go/pxapi/examples/example_mux/example.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ import (
3030
"px.dev/pixie/src/api/go/pxapi/types"
3131
)
3232

33-
var (
34-
pxl = `
33+
var pxl = `
3534
import px
3635
df = px.DataFrame('http_events')
3736
df = df[['upid', 'req_path', 'remote_addr', 'req_method']]
3837
df = df.head(10)
3938
px.display(df, 'http_as_json')
4039
px.display(df, 'http_as_table')
4140
`
42-
)
4341

4442
func main() {
4543
apiKey, ok := os.LookupEnv("PX_API_KEY")

src/api/go/pxapi/examples/standalone_pem_example/example.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ type tablePrinter struct{}
9090
func (t *tablePrinter) HandleInit(ctx context.Context, metadata types.TableMetadata) error {
9191
return nil
9292
}
93+
9394
func (t *tablePrinter) HandleRecord(ctx context.Context, r *types.Record) error {
9495
for _, d := range r.Data {
9596
fmt.Printf("%s ", d.String())
@@ -103,8 +104,7 @@ func (t *tablePrinter) HandleDone(ctx context.Context) error {
103104
}
104105

105106
// Satisfies the TableMuxer interface.
106-
type tableMux struct {
107-
}
107+
type tableMux struct{}
108108

109109
func (s *tableMux) AcceptTable(ctx context.Context, metadata types.TableMetadata) (pxapi.TableRecordHandler, error) {
110110
return &tablePrinter{}, nil

src/api/go/pxapi/examples/streaming_example/example.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ import (
2828
"px.dev/pixie/src/api/go/pxapi/types"
2929
)
3030

31-
var (
32-
pxl = `
31+
var pxl = `
3332
import px
3433
df = px.DataFrame('http_events', start_time='-5m')[['resp_status','req_path']]
3534
px.display(df.stream(), 'http_table')
3635
`
37-
)
3836

3937
type tablePrinter struct{}
4038

@@ -54,8 +52,7 @@ func (t *tablePrinter) HandleDone(ctx context.Context) error {
5452
return nil
5553
}
5654

57-
type tableMux struct {
58-
}
55+
type tableMux struct{}
5956

6057
func (s *tableMux) AcceptTable(ctx context.Context, metadata types.TableMetadata) (pxapi.TableRecordHandler, error) {
6158
return &tablePrinter{}, nil

src/api/go/pxapi/results.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ func (s *ScriptResults) run() error {
181181
ctx := s.c.Context()
182182
for {
183183
resp, err := s.c.Recv()
184-
185184
if err != nil {
186185
if err == io.EOF {
187186
// Stream has terminated.

src/api/go/pxapi/vizier.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"context"
2323

2424
"px.dev/pixie/src/api/go/pxapi/errdefs"
25-
2625
"px.dev/pixie/src/api/proto/vizierpb"
2726
)
2827

src/carnot/docstring/pkg/docstring.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func (w *parser) ArgMatch(s string) bool {
8080

8181
return allRe.MatchString(s) && w.isTabbedLine(s)
8282
}
83+
8384
func (w *parser) ReturnMatch(s string) bool {
8485
allRe := re.MustCompile(w.ReturnReStr())
8586

@@ -373,8 +374,10 @@ func parseDocstring(docString string) (*FunctionDocstring, error) {
373374
return p.parsedDoc, nil
374375
}
375376

376-
const topicRegex = `:topic: (?P<topic>[^\s]*)\n`
377-
const opnameRegex = `:opname: (?P<opname>.*)\n`
377+
const (
378+
topicRegex = `:topic: (?P<topic>[^\s]*)\n`
379+
opnameRegex = `:opname: (?P<opname>.*)\n`
380+
)
378381

379382
// getTag finds the tag in the docstring if it exists.
380383
func getTag(docstring, tagRegex string) string {

src/carnot/docstring/tables/datatables.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ import (
3636
"px.dev/pixie/src/shared/services"
3737
)
3838

39-
var (
40-
pxl = `
39+
var pxl = `
4140
import px
4241
px.display(px.GetTables(), 'table_desc')
4342
px.display(px.GetSchemas(), 'table_schemas')
4443
`
45-
)
4644

4745
func init() {
4846
pflag.String("cluster_id", "", "The cluster_id of the cluster to query")

0 commit comments

Comments
 (0)