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

downgrade yamlfmt to go 1.18 #105

Merged
merged 1 commit into from Apr 1, 2023
Merged

Conversation

braydonk
Copy link
Collaborator

@braydonk braydonk commented Apr 1, 2023

Since I was only using one simple feature of go 1.20 and nothing unique from go 1.19, it did not really make any sense to require such a new version. Downgrading it will make it easier for pre-commit users or folks installing through go install.

Implemented an Errors collection type to replicate the errors.Join feature from go 1.20.

Fixed a small path matching issue for exclusions. Closes #97

Since I was only using one simple feature of go 1.20 and nothing unique
from go 1.19, it did not really make any sense to require such a new
version. Downgrading it will make it easier for pre-commit users or
folks installing through `go install`.

Implemented an Errors collection type to replicate the errors.Join
feature from go 1.20.

Fixed a small path matching issue for exclusions.
@braydonk braydonk merged commit f81fb82 into google:main Apr 1, 2023
4 checks passed
Comment on lines +121 to +122
// I wonder how this could ever happen...
log.Printf("could not create absolute path for %s: %v", path, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

This literally never happens on a day-to-day basis, but an error can trigger under some improbable circumstances
Internally filepath.Abs calls the getwd syscall, which has quite a few possible errors : https://linux.die.net/man/3/getwd

Here is a small example triggering an error on purpose : https://go.dev/play/p/JoPt8x9bQJl

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah good to know, thank you for the information!

I think I am okay with how I'm handling this for now then; if it was able to collect that path in the first place up until this point, then failing getwd doesn't necessarily mean the program can't eventually read that file from the relative path it currently has. So logging the error and moving on will at least notify the user that if they expect that path to be excluded, something unexpected went wrong.

(I probably should have thrown a newline on that log though...)

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.

Doublestar excludes doesn't seem to work:
2 participants