Skip to content

Commit

Permalink
use -extra flag for gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss committed Apr 22, 2024
1 parent 61ac522 commit 4852e30
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ linters-settings:
local-prefixes: github.com/celestiaorg/celestia-node
dupl:
threshold: 200
gofumpt:
extra-rules: true
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fmt: sort-imports
@find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s
@go mod tidy -compat=1.20
@cfmt -w -m=100 ./...
@gofumpt -w .
@gofumpt -w -extra .
@markdownlint --fix --quiet --config .markdownlint.yaml .
.PHONY: fmt

Expand Down
2 changes: 1 addition & 1 deletion api/docgen/openrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func ParseCommentsFromNodebuilderModules(moduleNames ...string) (Comments, Comme
return nodeComments, permComments
}

func NewOpenRPCDocument(comments Comments, permissions Comments) *go_openrpc_reflect.Document {
func NewOpenRPCDocument(comments, permissions Comments) *go_openrpc_reflect.Document {
d := &go_openrpc_reflect.Document{}

d.WithMeta(&go_openrpc_reflect.MetaT{
Expand Down
2 changes: 1 addition & 1 deletion api/gateway/bindings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func TestRegisterEndpoints(t *testing.T) {
}
}

func hasEndpointRegistered(router *mux.Router, path string, method string) bool {
func hasEndpointRegistered(router *mux.Router, path, method string) bool {
var registered bool
err := router.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error {
template, err := route.GetPathTemplate()
Expand Down
2 changes: 1 addition & 1 deletion api/rpc/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (c *Client) Close() {

// NewClient creates a new Client with one connection per namespace with the
// given token as the authorization token.
func NewClient(ctx context.Context, addr string, token string) (*Client, error) {
func NewClient(ctx context.Context, addr, token string) (*Client, error) {
authHeader := http.Header{perms.AuthKey: []string{fmt.Sprintf("Bearer %s", token)}}
return newClient(ctx, addr, authHeader)
}
Expand Down
2 changes: 1 addition & 1 deletion api/rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *Server) verifyAuth(_ context.Context, token string) ([]auth.Permission,

// RegisterService registers a service onto the RPC server. All methods on the service will then be
// exposed over the RPC.
func (s *Server) RegisterService(namespace string, service interface{}, out interface{}) {
func (s *Server) RegisterService(namespace string, service, out interface{}) {
if s.authDisabled {
s.rpc.Register(namespace, service)
return
Expand Down
2 changes: 1 addition & 1 deletion das/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var ErrInvalidOption = errors.New("das: invalid option")

// errInvalidOptionValue is a utility function to dedup code for error-returning
// when dealing with invalid parameter values
func errInvalidOptionValue(optionName string, value string) error {
func errInvalidOptionValue(optionName, value string) error {
return fmt.Errorf("%w: value %s cannot be %s", ErrInvalidOption, optionName, value)
}

Expand Down
2 changes: 1 addition & 1 deletion nodebuilder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func UpdateConfig(tp node.Type, path string) (err error) {

// updateConfig merges new values from the new config into the old
// config, returning the updated old config.
func updateConfig(oldCfg *Config, newCfg *Config) (*Config, error) {
func updateConfig(oldCfg, newCfg *Config) (*Config, error) {
err := mergo.Merge(oldCfg, newCfg, mergo.WithOverrideEmptySlice)
return oldCfg, err
}
Expand Down
2 changes: 1 addition & 1 deletion nodebuilder/p2p/addrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Listen(listen []string) func(h hst.Host) (err error) {
}

// addrsFactory returns a constructor for AddrsFactory.
func addrsFactory(announce []string, noAnnounce []string) func() (_ p2pconfig.AddrsFactory, err error) {
func addrsFactory(announce, noAnnounce []string) func() (_ p2pconfig.AddrsFactory, err error) {
return func() (_ p2pconfig.AddrsFactory, err error) {
// Convert maAnnounce strings to Multiaddresses
maAnnounce := make([]ma.Multiaddr, len(announce))
Expand Down
2 changes: 1 addition & 1 deletion nodebuilder/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func DiscoverOpened() (string, error) {

// DefaultNodeStorePath constructs the default node store path using the given
// node type and network.
var DefaultNodeStorePath = func(tp string, network string) (string, error) {
var DefaultNodeStorePath = func(tp, network string) (string, error) {
home := os.Getenv("CELESTIA_HOME")

if home == "" {
Expand Down
6 changes: 3 additions & 3 deletions nodebuilder/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func TestDiscoverOpened(t *testing.T) {
t.Run("single open store", func(t *testing.T) {
_, dir := initAndOpenStore(t, node.Full)

mockDefaultNodeStorePath := func(t string, n string) (string, error) {
mockDefaultNodeStorePath := func(t, n string) (string, error) {
return dir, nil
}
DefaultNodeStorePath = mockDefaultNodeStorePath
Expand All @@ -193,7 +193,7 @@ func TestDiscoverOpened(t *testing.T) {
}
}

mockDefaultNodeStorePath := func(tp string, n string) (string, error) {
mockDefaultNodeStorePath := func(tp, n string) (string, error) {
key := n + "_" + tp
if dir, ok := dirMap[key]; ok {
return dir, nil
Expand All @@ -218,7 +218,7 @@ func TestDiscoverOpened(t *testing.T) {

t.Run("no opened store", func(t *testing.T) {
dir := t.TempDir()
mockDefaultNodeStorePath := func(t string, n string) (string, error) {
mockDefaultNodeStorePath := func(t, n string) (string, error) {
return dir, nil
}
DefaultNodeStorePath = mockDefaultNodeStorePath
Expand Down
4 changes: 2 additions & 2 deletions share/availability/light/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Sample struct {

// SampleSquare randomly picks *num* unique points from the given *width* square
// and returns them as samples.
func SampleSquare(squareWidth int, num int) ([]Sample, error) {
func SampleSquare(squareWidth, num int) ([]Sample, error) {
ss := newSquareSampler(squareWidth, num)
err := ss.generateSample(num)
if err != nil {
Expand All @@ -29,7 +29,7 @@ type squareSampler struct {
smpls map[Sample]struct{}
}

func newSquareSampler(squareWidth int, expectedSamples int) *squareSampler {
func newSquareSampler(squareWidth, expectedSamples int) *squareSampler {
return &squareSampler{
squareWidth: squareWidth,
smpls: make(map[Sample]struct{}, expectedSamples),
Expand Down

0 comments on commit 4852e30

Please sign in to comment.