Open OGKevin opened 5 years ago
this error is returned from the call to the standard libs format.Source
at line 123 in generator.go
. If you provide a path including the filename to -s
and do not specify what package the generated output should be in - gojay will output a package name that is invalid source code - effectively the full path to the directory the target file is in.
// Code generated by Gojay. DO NOT EDIT.
package /Users/myuser/go/src/github.com/foo/my-package
This does appear to be a bug and not user error as the -pkg
flag is not required. That said - the workaround with the existing version is to provide a valid package name to the -pkg
flag or not provide the filename to the -s
flag and ensure that -o
is set to the correct destination.
the bug itself appears to be at line 241 in generator.go
where the output package name is not set correctly. happy to open a simple PR for this one if it is the case
Thank you @syllabix for the workaround!!
When generating a struct with 1 string field or any number of fields, i manage to get
4:9: expected 'IDENT', found '/'
error.e.g.
and then
On top of the file generates that error.
Any ideas what might be causing this?