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

bug: Index out of range when splitting path while loading assets on windows #49

Closed
owenrumney opened this issue Sep 7, 2022 · 1 comment

Comments

@owenrumney
Copy link
Contributor

owenrumney commented Sep 7, 2022

When the assets are loaded for v2 in Windows, the path of the embedded license files is split on os.PathSeparator but this is incorrect for Windows.

When trying to split using backslash, there is an index out of range panic

panic: runtime error: index out of range [1] with length 1 [recovered]
	panic: runtime error: index out of range [1] with length 1

As per the embed documentation (https://pkg.go.dev/embed) - Even on Windows, the separator for embedded filesystem is forward slash

The //go:embed directive accepts multiple space-separated patterns for brevity, but it can also be repeated, to avoid very long lines when there are many patterns. The patterns are interpreted relative to the package directory containing the source file. The path separator is a forward slash, even on Windows systems. Patterns may not contain ‘.’ or ‘..’ or empty path elements, nor may they begin or end with a slash. To match everything in the current directory, use ‘*’ instead of ‘.’. To allow for naming files with spaces in their names, patterns can be written as Go double-quoted or back-quoted string literals.

@owenrumney owenrumney changed the title bug: NPE when splitting path while loading assets on windows bug: Index out of range when splitting path while loading assets on windows Sep 7, 2022
@owenrumney
Copy link
Contributor Author

this is resolved

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

No branches or pull requests

1 participant