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

make sure no resource has the same id for capability type #12

Merged
merged 2 commits into from
Jan 3, 2023

Conversation

jhsinger-klotho
Copy link
Contributor

• Does any part of it require special attention?
• Does it relate to or fix any issue? closes #635

For now this only really will ever catch persist since no other resource type has multiple kinds, but checking them anyways in case they ever do.

Standard checks

  • Unit tests: Any special considerations? added
  • Docs: Do we need to update any docs, internal or public? no
  • Backwards compatibility: Will this break existing apps? If so, what would be the extra work required to keep them working? it shouldnt

unitIds := make(map[string]struct{})
units := core.GetResourcesOfType[T](result)
for _, unit := range units {
fmt.Println(unit)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Println(unit)

for _, unit := range units {
fmt.Println(unit)
if id, ok := unitIds[unit.Key().Name]; ok {
return fmt.Errorf("Multiple Persist objects with the same name, '%s'", id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't id be a struct{}{}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yeah, meant to swithc that and log name. will update

@github-actions
Copy link

Package Line Rate Health
github.com/klothoplatform/klotho/pkg/analytics 2%
github.com/klothoplatform/klotho/pkg/annotation 24%
github.com/klothoplatform/klotho/pkg/core 21%
github.com/klothoplatform/klotho/pkg/env_var 82%
github.com/klothoplatform/klotho/pkg/exec_unit 41%
github.com/klothoplatform/klotho/pkg/infra/kubernetes 56%
github.com/klothoplatform/klotho/pkg/infra/kubernetes/helm 52%
github.com/klothoplatform/klotho/pkg/input 63%
github.com/klothoplatform/klotho/pkg/lang 37%
github.com/klothoplatform/klotho/pkg/lang/dockerfile 0%
github.com/klothoplatform/klotho/pkg/lang/golang 9%
github.com/klothoplatform/klotho/pkg/lang/javascript 46%
github.com/klothoplatform/klotho/pkg/lang/python 60%
github.com/klothoplatform/klotho/pkg/lang/yaml 0%
github.com/klothoplatform/klotho/pkg/logging 7%
github.com/klothoplatform/klotho/pkg/multierr 95%
github.com/klothoplatform/klotho/pkg/provider/aws 54%
github.com/klothoplatform/klotho/pkg/runtime 75%
github.com/klothoplatform/klotho/pkg/static_unit 22%
github.com/klothoplatform/klotho/pkg/validation 73%
Summary 41% (3495 / 8462)

@jhsinger-klotho
Copy link
Contributor Author

fyi, this works, i needed to rebase from main locally because the bug from a couple days ago was still affecting this finding the persist annotations to begin with

@jhsinger-klotho jhsinger-klotho merged commit ea862f3 into main Jan 3, 2023
@jhsinger-klotho jhsinger-klotho deleted the validate_resource_ids branch January 3, 2023 15:07
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.

3 participants