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

[resolution pt.2] required package variable source #96

Merged

Conversation

perdasilva
Copy link
Contributor

This PR adds the RequiredPackage variable source for generating required package variables from package names

@perdasilva perdasilva force-pushed the resolution_pt2_required_package branch from 9872bb4 to d9b2429 Compare January 24, 2023 11:58
@perdasilva perdasilva changed the title [resolution Pt2] required package variable source [resolution pt.2] - required package variable source Jan 24, 2023
@perdasilva perdasilva changed the title [resolution pt.2] - required package variable source [resolution pt.2] required package variable source Jan 24, 2023
@tmshort
Copy link
Contributor

tmshort commented Jan 24, 2023

These all seem to build upon each other. So, part 2, includes part 1? And part 3 includes parts 1 and 2?

@dtfranz
Copy link
Contributor

dtfranz commented Jan 24, 2023

These all seem to build upon each other. So, part 2, includes part 1? And part 3 includes parts 1 and 2?

Yes, I've been reviewing them individually by looking at changes from only the last commit e.g. for this one: d9b2429

@tmshort
Copy link
Contributor

tmshort commented Jan 24, 2023

These all seem to build upon each other. So, part 2, includes part 1? And part 3 includes parts 1 and 2?

Yes, I've been reviewing them individually by looking at changes from only the last commit e.g. for this one: d9b2429

Because the merges aren't fast-forward, this might get strange...

}
}

var _ input.VariableSource = &RequiredPackageVariableSource{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I get this construct?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's ensuring that RequiredPackageVariableSource correctly implements input.VariableSource: https://go.dev/doc/effective_go#blank_implements

Copy link
Member

@awgreene awgreene left a comment

Choose a reason for hiding this comment

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

Great work Per

packageName string
}

func NewRequiredPackage(packageName string) *RequiredPackageVariableSource {
Copy link
Member

Choose a reason for hiding this comment

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

If RequiredPackageVariableSource is exported, why do I need this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just being more idiomatic, I suppose. Plus if something changes in the initialization we don't need to refactor every call.

Comment on lines 44 to 47
requiredPackage := &RequiredPackageVariableSource{
packageName: packageName,
}
return requiredPackage
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking nit:

Suggested change
requiredPackage := &RequiredPackageVariableSource{
packageName: packageName,
}
return requiredPackage
return &RequiredPackageVariableSource{
packageName: packageName,
}

}))
})

It("should return error if package not found", func() {
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking nit:

Suggested change
It("should return error if package not found", func() {
It("should return an error if package not found", func() {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed ^^

Signed-off-by: perdasilva <perdasilva@redhat.com>
@perdasilva perdasilva force-pushed the resolution_pt2_required_package branch from d9b2429 to eca26f7 Compare January 25, 2023 10:21
Signed-off-by: perdasilva <perdasilva@redhat.com>
@perdasilva perdasilva force-pushed the resolution_pt2_required_package branch from eca26f7 to b6bc92c Compare January 25, 2023 10:54
@perdasilva perdasilva merged commit f204fa3 into operator-framework:main Jan 25, 2023
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.

4 participants