-
Notifications
You must be signed in to change notification settings - Fork 18
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
create: replace vfs with embed #637
Conversation
Looks like a breaking change. Can you clarify, whether it discards support of some Go versions? |
ac9ec68
to
715a416
Compare
To solve #631 issue, we need to use Go with fixed embedding of folders for case when only contents are files starting with dot [1]. It should be introduced in Go 1.18, but it is not released yet. 1. golang/go#43854 Part of #637
126f023
to
7019bb4
Compare
Maybe it should wait until Go 1.18 stable release, but I'll press review request button since it works |
To solve #631 issue, we need to use Go with fixed embedding of folders for case when only contents are files starting with dot [1]. It should be introduced in Go 1.18, but it is not released yet. 1. golang/go#43854 Part of #637
7019bb4
to
56a6414
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no objections here, but, it seems, we should wait until Go 1.18 will be released.
56a6414
to
b07b189
Compare
Do we include internal changes like this in CHANGELOG or should it only include changes that affect binary artifact user? |
@LeonidVas it's relevant again |
To solve #631 issue, we need to use Go with fixed embedding of folders for case when only contents are files starting with dot [1]. The fix was introduced in Go 1.18. 1. golang/go#43854 Part of #631
Since Go 1.16, it is possible to use "embed" library to work with virtual file systems. We use one for templates in ``cartridge create``. Before this patch, we used third party library [1]. Now it's replaced with "embed". To support embedding folder which only contents are file starting with dot, we need to use Go 1.18. Moreover, file with "|" symbol in name considered to be invalid [2] and its embedding is not supported. So approach from #612 was reworked to use lowered app name as variable instead of transforming it with Funcs. Directories in vfs now have "dr-xr-xr-x" permissions instead of "drwxr-xr-x", so we change it on template build (otherwise it would be impossible to create subdirectories and files in directories). Running ``go mod tidy`` regrouped go.mod contents, together with cleaning up [1] dependency. 1. https://github.com/shurcooL/vfsgen 2. https://cs.opensource.google/go/x/mod/+/refs/tags/v0.5.1:module/module.go;l=488 Closes #631
Reworked by @DifferentialOrange
Go requirement was bumped to
1.18
.To solve #631 issue, we need to use Go with fixed embedding of
folders for case when only contents are files starting with dot [1].
The fix was introduced in Go 1.18.
Since Go 1.16, it is possible to use "embed" library to work with
virtual file systems. We use one for templates in
cartridge create
.Before this patch, we used third party library [2]. Now it's replaced
with "embed".
To support embedding folder which only contents are file starting with
dot, we need to use Go 1.18. Moreover, file with "|" symbol in name
considered to be invalid [3] and its embedding is not supported.
So approach from #612 was reworked to use lowered app name as variable
instead of transforming it with Funcs.
Directories in vfs now have "dr-xr-xr-x" permissions instead of
"drwxr-xr-x", so we change it on template build (otherwise it would be
impossible to create subdirectories and files in directories).
Running
go mod tidy
regrouped go.mod contents, together withcleaning up [2] dependency.
Closes #631