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

fix: overwrite attribute values when not mergeable #1952

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

Conversation

jbedard
Copy link
Contributor

@jbedard jbedard commented Oct 9, 2024

Fix #1962

What type of PR is this?

Bug fix

What package or component does this PR mostly affect?

all

What does this PR do? Why is it needed?

Allow updating non-mergeable/resolveable attributes.

Which issues(s) does this PR fix?

Fixes #1962

Other notes for review

@jbedard jbedard force-pushed the set-unknown-attributes branch 8 times, most recently from 1a675a4 to 06fe94e Compare October 21, 2024 07:47
merger/merger.go Outdated
}
}

isManaged := func(r *rule.Rule, attr string) bool {
// Name and visibility are uniquely managed by gazelle.
if attr == "name" || attr == "visibility" {
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 actually don't think visibility should be here but it causes too many changes in this repo atm. I think those changes are actually correct but they could be breaking such as reducing the visibility of //internal/....

@jbedard jbedard marked this pull request as ready for review October 21, 2024 08:08
rule/merge.go Outdated Show resolved Hide resolved
@jbedard jbedard force-pushed the set-unknown-attributes branch 6 times, most recently from 23e8768 to 40bd8f4 Compare October 23, 2024 21:04
@jbedard jbedard requested a review from fmeum October 23, 2024 21:14
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.

@tyler-french Could you test this at Uber?

rule/merge.go Outdated Show resolved Hide resolved
rule/merge.go Outdated
@@ -41,6 +41,9 @@ import (
// marked with a "# keep" comment, values in the attribute not marked with
// a "# keep" comment will be dropped. If the attribute is empty afterward,
// it will be deleted.
//
// If src has an attribute not present in 'mergeable' and not marked with a
Copy link
Member

Choose a reason for hiding this comment

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

Should this be

Suggested change
// If src has an attribute not present in 'mergeable' and not marked with a
// If dst has an attribute not present in 'mergeable' and not marked with a

Copy link
Contributor Author

@jbedard jbedard Oct 25, 2024

Choose a reason for hiding this comment

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

I think this comment is correct as-is, although maybe confusing.

This is pointing out that attributes in src will overwrite those in dst if they are unknown and the value in dst is not marked as # keep.

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've updated the comment a bit. See the fixup commits.

@tyler-french
Copy link
Contributor

@tyler-french Could you test this at Uber?

I'm seeing 1000s of build files behaving differently, need to dig a bit deeper. Please hold off on merging for now

@jbedard
Copy link
Contributor Author

jbedard commented Oct 30, 2024

@tyler-french what types of changes are you seeing? Are effected attributes in the KindInfo anywhere?

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.

unknown attributes only set on initial generated
3 participants