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(jpath): support nested calling again #456

Merged
merged 7 commits into from
Dec 30, 2020
Merged

Conversation

sh0rez
Copy link
Member

@sh0rez sh0rez commented Dec 30, 2020

Originally, Tanka was able to find the environments entrypoint, even when it was actually called on a directory that is nested underneath that environment.

This was modeled after the ability to use git commands anywhere in the project.

This functionality was lost however in a recent PR (#389)

While restoring it, I took the chance to do a long overdue refactoring of the jpath package.

Originally, Tanka was able to find the environments entrypoint, even
when it was actually called on a directory that is nested underneath
that environment.

This was modeled after the ability to use `git` commands anywhere in the
project.

This functionality was lost however in a recent PR.

While restoring it, I took the chance to do a long overdue refactoring
of the `jpath` package.
@sh0rez sh0rez added kind/bug Something isn't working kind/enhancement Improve something existing component/jsonnet Everything regarding the jsonnet language labels Dec 30, 2020
Copy link
Contributor

@jvrplmlmn jvrplmlmn left a comment

Choose a reason for hiding this comment

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

Would it be possible to add a unit test this to ensure that this functionality is not lost?

Copy link
Member

@Duologic Duologic 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.

Comment on lines +26 to +32
root, err := FindParentFile("tkrc.yaml", start, stop)
if err == nil {
return root, nil
}

// otherwise use jsonnetfile.json
root, err = FindParentFile("jsonnetfile.json", start, stop)
Copy link
Member

@Duologic Duologic Dec 30, 2020

Choose a reason for hiding this comment

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

nit: Can we have a list of parentFiles []string and iterate over it? It could make the jsonnet/jpath API a bit more flexible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Where would that go? I would not want every callee of jpath.Resolve or jpath.FindRoot have to specify that

Copy link
Member Author

Choose a reason for hiding this comment

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

Merging, we can address that later if we wish to

pkg/jsonnet/jpath/errors.go Outdated Show resolved Hide resolved
@sh0rez sh0rez merged commit dc54501 into master Dec 30, 2020
@sh0rez sh0rez deleted the refactor-entrypoint branch December 30, 2020 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/jsonnet Everything regarding the jsonnet language kind/bug Something isn't working kind/enhancement Improve something existing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants