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

feat: find .tool-versions and legacy files until reach root directory and keep .tool-versions order. #289

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

Conversation

aooohan
Copy link
Member

@aooohan aooohan commented May 23, 2024

fix #269

fix #228

fix #288

@Chance-fyi
Copy link
Member

It seems that there is no sorting implementation in SortedMap and SortedSet

internal/util/map.go Outdated Show resolved Hide resolved
@aooohan
Copy link
Member Author

aooohan commented May 24, 2024

It seems that there is no sorting implementation in SortedMap and SortedSet

Yes, only ensures that the order of adding.

@aooohan aooohan force-pushed the feat/tool-version-behavior branch from 76d2508 to 4da6bab Compare May 24, 2024 06:40
flushCache.Clear()
}
if item.Version == version {
logger.Debugf("Hit cache, skip flush envrionment, %s@%s\n", name, version)
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

}
wg.Wait()
}
if versionMap.Len() != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I may not understand the code correctly. As soon as the first .toolsversion is found, the recursion is stopped. However, it could be that not all SDKs are specified in this file. In other words, I would expect a combination of all .toolsversions from all paths. The global file has the lowest priority and then ascending according to proximity to the current working directory.

Copy link
Member Author

Choose a reason for hiding this comment

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

You reminded me that the global .tool-versions file should be combined.

In other words, I would expect a combination of all .toolsversions from all paths

I don't agree to this point.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't agree to this point.

Expressed incorrectly. I mean all files that can be found up to the root. Say the following example

image

If I enter folder childdir1, I will receive all SDK in .tool-versions file 1 and 3, but not 2.

Copy link
Member Author

@aooohan aooohan Jun 28, 2024

Choose a reason for hiding this comment

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

Sorry for the late reply. I have got it, and I will continue to improve this PR soon later.

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