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

Redeclaration in output go code #73

Open
jgoodall opened this issue Mar 8, 2024 · 0 comments
Open

Redeclaration in output go code #73

jgoodall opened this issue Mar 8, 2024 · 0 comments

Comments

@jgoodall
Copy link

jgoodall commented Mar 8, 2024

Description

This seems related to #8, but I dont need an enhancement in the xgen tool, just a way to solve the problem below.

I am having a similar problem when trying to use xgen on the Grobid xsd files: xgen -i ./grobid/grobid-home/schemas/xsd -o ./pkg/extraction/grobid -p grobid -l Go

It creates all the corresponding go files, albeit in a weird directory path (pkg/extraction/grobid/grobid/grobid-home/schemas/xsd/), but after moving the files to the expected path, the go compiler complains found packages schema (Grobid.xsd.go) and grobid (dcr.xsd.go). If I manually change the package from schema to grobid in Grobid.xsd.go I get a bunch of errors related to redeclared in this block. Is there any way to work around this issue?

Steps to reproduce the issue:

  1. xgen -i ./grobid/grobid-home/schemas/xsd -o ./pkg/extraction/grobid -p grobid -l Go
  2. mv pkg/extraction/grobid/grobid/grobid-home/schemas/xsd/* pkg/extraction/grobid && rm -rf pkg/extraction/grobid/grobid/grobid-home
  3. Build:
pkg/extraction/extraction.go:25:2: found packages schema (Grobid.xsd.go) and grobid (dcr.xsd.go) in /Users/ojg/code/corpora/server/pkg/extraction/grobid```
5. Change package name to `grobid` in `Grobid.xsd.go` and build:
```go build -o bin/test .
pkg/extraction/grobid/tei.xsd.go:10:6: P redeclared in this block
	pkg/extraction/grobid/Grobid.xsd.go:2606:6: other declaration of P
pkg/extraction/grobid/tei.xsd.go:20:6: Hi redeclared in this block
	pkg/extraction/grobid/Grobid.xsd.go:2616:6: other declaration of Hi

Describe the results you received:

The code did not compile compile - see output above.

Describe the results you expected:

The code to compile.

Output of go version:

go version go1.22.1 darwin/arm64

xgen version or commit ID:

xgen version: 0.1.0

Environment details (OS, physical, etc.):

macOS 14.4 on MacBook Pro with M2.

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