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

Can't loading template during the gen #85

Open
tuxoo opened this issue Mar 19, 2024 · 1 comment
Open

Can't loading template during the gen #85

tuxoo opened this issue Mar 19, 2024 · 1 comment

Comments

@tuxoo
Copy link

tuxoo commented Mar 19, 2024

good afternoon

I've tried to generate a tracing wrapper by my custom teplate which is uploading from github https://github.com/XeniaBgd/templates/blob/main/tracing

The command is :
gowrap gen -p ./internal/domain/repository -i Repository -t https://raw.githubusercontent.com/XeniaBgd/templates/main/tracing -o ./internal/providers/analytics/tracing.go

But I've got this error:
"failed to load template: open https://raw.githubusercontent.com/XeniaBgd/templates/main/tracing: The filename, directory name, or volume label syntax is incorrect"

I've checked code
https://github.com/hexdigest/gowrap/blob/master/cmd_generate.go#L191

func underlyingErrorIs(err, target error) bool {
// Note that this function is not errors.Is:
// underlyingError only unwraps the specific error-wrapping types
// that it historically did, not all errors implementing Unwrap().
err = underlyingError(err)
if err == target {
return true
}
// To preserve prior behavior, only examine syscall errors.
e, ok := err.(syscallErrorType)
return ok && e.Is(target)
}

My error was "internal/syscall/windows.ERROR_INVALID_NAME (123)". That's why the function above returned false.

//if !os.IsNotExist(err) {
// return
//}

Without this code everything is ok.

Could somebody explain me why was that?

@jeroenrinzema
Copy link

Hi @tuxoo, I am facing the same issue. It seems to be the issue that gowrap is fetching it's templates directly from Github. You could hit the limits by running gowrap too many times.

@hexdigest would it be an idea to embed the templates within gowrap? This would resole the issue reported by @tuxoo, allow gowrap to be executed without any internet connection, and improve the security of gowrap by avoiding to fetch code templates from an external source.

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

2 participants