Skip to content

Runs make fmt over the whole repo #9075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

owen-d
Copy link
Member

@owen-d owen-d commented Apr 7, 2023

Some format housekeeping

@owen-d owen-d requested a review from a team as a code owner April 7, 2023 19:57
Signed-off-by: Owen Diehl <ow.diehl@gmail.com>
Copy link
Contributor

@DylanGuedes DylanGuedes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with some nits

@@ -17,6 +16,8 @@ import (
"go.uber.org/atomic"
"gopkg.in/yaml.v2"

"github.com/grafana/loki/pkg/util/math"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this one is isolated from other packages below (I'm not adding a diff suggestion for you to just apply because the order would be wrong anyway)

"github.com/opentracing/opentracing-go"
otlog "github.com/opentracing/opentracing-go/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/common/model"
"github.com/weaveworks/common/httpgrpc"

"github.com/grafana/loki/pkg/util/math"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: this one after dskit/tenant package

@periklis
Copy link
Collaborator

@owen-d FYI this touches sources in the operator sub folder and it looks like we use different formatting styles

@owen-d
Copy link
Member Author

owen-d commented Apr 10, 2023

Hey @periklis is that ok? This all comes from the goimports -local configs.

$ goimports --help
usage: goimports [flags] [path ...]
  -local string
        put imports beginning with this string after 3rd-party packages; comma-separated list

which is called by make format

format:
	find . $(DONT_FIND) -name '*.pb.go' -prune -o -name '*.y.go' -prune -o -name '*.rl.go' -prune -o \
		-type f -name '*.go' -exec gofmt -w -s {} \;
	find . $(DONT_FIND) -name '*.pb.go' -prune -o -name '*.y.go' -prune -o -name '*.rl.go' -prune -o \
		-type f -name '*.go' -exec goimports -w -local github.com/grafana/loki {} \;

We can exclude the operator dir from the make format command if you'd prefer, but I personally like the formatting changes. WDYT?

@periklis
Copy link
Collaborator

Hey @periklis is that ok? This all comes from the goimports -local configs.

$ goimports --help
usage: goimports [flags] [path ...]
  -local string
        put imports beginning with this string after 3rd-party packages; comma-separated list

which is called by make format

format:
	find . $(DONT_FIND) -name '*.pb.go' -prune -o -name '*.y.go' -prune -o -name '*.rl.go' -prune -o \
		-type f -name '*.go' -exec gofmt -w -s {} \;
	find . $(DONT_FIND) -name '*.pb.go' -prune -o -name '*.y.go' -prune -o -name '*.rl.go' -prune -o \
		-type f -name '*.go' -exec goimports -w -local github.com/grafana/loki {} \;

We can exclude the operator dir from the make format command if you'd prefer, but I personally like the formatting changes. WDYT?

I would like to skip the operator dir for now. As per now it would make backport bugs harder. I suggest the SIG operator lifts the exclude once we have applied goimports on main and present release branches`.

Copy link
Contributor

@jeschkies jeschkies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I was hesitating to do this because I feared it would mess up git blame. However, these are just imports.

Once this land we can simplify the make check-format step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 participants