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

Replace vfs with embed #631

Closed
olegrok opened this issue Sep 2, 2021 · 1 comment · Fixed by #637
Closed

Replace vfs with embed #631

olegrok opened this issue Sep 2, 2021 · 1 comment · Fixed by #637
Assignees
Labels
code health Improve code readability, simplify maintenance and so on
Milestone

Comments

@olegrok
Copy link
Contributor

olegrok commented Sep 2, 2021

Currently go provides native way to bundle static files in binary. Initially we used third-party vfs module (8b0753f). Currently it's possible to replace it with built-in Go "embed" module.

https://pkg.go.dev/embed

@mRrvz mRrvz self-assigned this Sep 2, 2021
@mRrvz mRrvz added the code health Improve code readability, simplify maintenance and so on label Sep 2, 2021
@Totktonada Totktonada added this to the wishlist milestone Sep 3, 2021
mRrvz added a commit that referenced this issue Sep 23, 2021
This patch must be accepted after golang/go#43854

Closes #631
@mRrvz
Copy link
Contributor

mRrvz commented Sep 23, 2021

Currently embed doesn't support files starting with a ..

And our project template has such files. You can see error in pipeline

I made a pull request #637 to be accepted after golang/go#43980 is implemented.

DifferentialOrange pushed a commit that referenced this issue Jan 11, 2022
This patch must be accepted after golang/go#43854

Closes #631
DifferentialOrange pushed a commit that referenced this issue Jan 12, 2022
This patch must be accepted after golang/go#43854

Closes #631

Update modules and use fixed go

Maybe this will be enough?

This should help

Wait what

this?

Fix using stable

Fix .keep

Complicated templates?

Finally?

What is wrong with you

???

I dunno lets try

I hate Go traditions

Fix imports

Fix imports
DifferentialOrange added a commit that referenced this issue Jan 12, 2022
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
DifferentialOrange added a commit that referenced this issue Jan 12, 2022
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.

Closes #631

1. https://github.com/shurcooL/vfsgen
2. https://cs.opensource.google/go/x/mod/+/refs/tags/v0.5.1:module/module.go;l=488
DifferentialOrange added a commit that referenced this issue Jan 27, 2022
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
DifferentialOrange added a commit that referenced this issue Jan 27, 2022
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.

Closes #631

1. https://github.com/shurcooL/vfsgen
2. https://cs.opensource.google/go/x/mod/+/refs/tags/v0.5.1:module/module.go;l=488
DifferentialOrange added a commit that referenced this issue Mar 17, 2022
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
DifferentialOrange added a commit that referenced this issue Mar 17, 2022
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
LeonidVas pushed a commit that referenced this issue Mar 29, 2022
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
LeonidVas pushed a commit that referenced this issue Mar 29, 2022
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
LeonidVas pushed a commit that referenced this issue Mar 29, 2022
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
LeonidVas pushed a commit that referenced this issue Mar 29, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Improve code readability, simplify maintenance and so on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants