Skip to content
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

Move most of gazelle main package into a subpackage #1292

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dragonsinth
Copy link
Contributor

What type of PR is this?

Feature

What package or component does this PR mostly affect?

cmd/gazelle

What does this PR do? Why is it needed?

For people who are extending gazelle with other languages, IDE development is a chore. There's no easy way to produce a working gazelle binary with a desired set of languages configured. Allowing the implementation of /cmd/gazelle to be accessible enables IDE development and debug without needing bazel code generation.

Which issues(s) does this PR fix?

Fixes #1291

}
}
return false
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a 99% move/rename, but unfortunately github isn't showing this well since the old gazelle.go is still there and replaced.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could probably rename cmd/gazelle/gazelle.go -> cmd/gazelle/gazelle-cmd.go to get github to show the correct diff.

author Scott Blum <dragonsinth@gmail.com> 1656555128 -0400
committer Scott Blum <dragonsinth@gmail.com> 1657651964 -0400

Move most of gazelle main package into a subpackage

regen

feedback

polish
@dragonsinth
Copy link
Contributor Author

@sluongng this is the PR where I implemented #1291

Copy link
Contributor

@sluongng sluongng left a comment

Choose a reason for hiding this comment

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

I have a few nits but the overall direction LGTM 👍

runner/BUILD.bazel Outdated Show resolved Hide resolved
runner/gazelle.go Outdated Show resolved Hide resolved
runner/diff.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sluongng sluongng left a comment

Choose a reason for hiding this comment

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

LGTM

@sluongng
Copy link
Contributor

@achew22 @fmeum could you guys take a look? This and #1303 both work toward making it easier to build a Gazelle extension.

Copy link
Member

@fmeum fmeum left a comment

Choose a reason for hiding this comment

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

This looks good to me, but I would like someone with more experience developing Gazelle to take a look as well. @linzhp, what do you think?

@achew22
Copy link
Member

achew22 commented Jul 24, 2022

I think we should be very very careful about extending our public interface. It sounds to me like the intent here is to only expose Run and nothing else. Can we hide GetDefaultWorkspaceDirectory? Are there any others that are now exported that weren't before?

@dragonsinth
Copy link
Contributor Author

I think we should be very very careful about extending our public interface. It sounds to me like the intent here is to only expose Run and nothing else. Can we hide GetDefaultWorkspaceDirectory? Are there any others that are now exported that weren't before?

It's just those two. Funny enough, @sluongng and I went back and forth a bit on exactly how that should be formulated.

@dragonsinth
Copy link
Contributor Author

How do we get this landed? 😺

@dragonsinth
Copy link
Contributor Author

Annnd.... now this PR is stale, since it's a month old. I'd love to update this, but can we first agree on whether or not this can be landed? Or what changes are needed to land it?

@pcj
Copy link
Contributor

pcj commented Jun 12, 2023

I'd like to see development on this PR resume. Maintaining a separate copy of cmd/gazelle in https://github.com/stackb/rules_proto/tree/master/cmd/gazelle is a pain.

@sluongng
Copy link
Contributor

@achew22 I think this PR is currently pending your review? Do you have any objection merging this as-is or suggestion on how to improve this?

We also have to patch Gazelle to make things work on our end, some having this PR merged would be very nice.

@pcj
Copy link
Contributor

pcj commented Jun 12, 2023

I suspect the age of the PR will require someone making sure all the changes that have occurred in cmd/gazelle since July 2022 are faithfully propagated to this one. I'd be hesitant to merge it as-is without careful review of that even if checks are passing.

@dragonsinth
Copy link
Contributor Author

Indeed, this branch is full of conflicts. I'll basically need to re-do this PR. But I also don't want to waste time if this can't land.

Basically, I'm waiting on someone with the power to merge PRs to actively engage on this and offer a path to getting this merged.

@pcj
Copy link
Contributor

pcj commented Jun 12, 2023

FWIW I'm +1 on accepting this. @achew22 I believe your question was answered previously, do you have any remaining concerns?

@achew22
Copy link
Member

achew22 commented Jun 12, 2023

My concerns mostly revolve around that this isn't really an interface ever designed to be part of a v1 API. As evidenced by the buzz around this PR, I'm inclined to believe that if we expose this API, people will come to depend on it in it's current form. I would love to see a refactor of this logic to allow the runner to be embedded into other applications, but I would like API design to be something that is at least considered instead of "just use the old API because it is there".

@dragonsinth
Copy link
Contributor Author

If it makes a difference, this repo being on v0.31.0 (rather than say, 1.0) means that there's no guarantee of API compatibility, at least in the Go world. I personally just want to be able to use this repo as a Go module, knowing that when I update to a newer gazelle it might break my client code that uses it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow building gazelle cmd using Go with custom plugins, to ease development
5 participants