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

[util.go] 'FunderName' vs 'Funder': Potential name mixup #81

Open
mpsonntag opened this issue Dec 30, 2020 · 1 comment
Open

[util.go] 'FunderName' vs 'Funder': Potential name mixup #81

mpsonntag opened this issue Dec 30, 2020 · 1 comment

Comments

@mpsonntag
Copy link
Contributor

The util.go function FunderName is linked via the template.Func map, but seems to be unused.

There is a reference in template.go to funding.Funder which cannot be found in the code. Since funding.Funder appears right next to funding.AwardNumber and there is an AwardNumber function in util.go right next to the FunderName function, funding.Funder should probably be funding.FunderName in template.go.

@achilleas-k
Copy link
Member

achilleas-k commented Jan 5, 2021

The util.go function FunderName is linked via the template.Func map, but seems to be unused.

It's an old function for formatting the funding information in templates but isn't used anymore. Can be safely deleted.

There is a reference in template.go to funding.Funder which cannot be found in the code.

funding in the info template:

{{range $index, $funding := .FundingReferences}}
<li itemprop="funder" itemscope itemtype="http://schema.org/Organization"><span itemprop="name">{{$funding.Funder}}</span> {{$funding.AwardNumber}}</li>
{{end}}

is an instance of FundingReference which is defined in libgin:
https://github.com/G-Node/libgin/blob/7cddc5bb2c86ea49da5bec0df4a3a40f4896d40e/libgin/datacite.go#L94-L98

Since funding.Funder appears right next to funding.AwardNumber and there is an AwardNumber function in util.go right next to the FunderName function, funding.Funder should probably be funding.FunderName in template.go.

AwardNumber is also a field of the FundingReference. The AwardNumber() function, like the Funder() function is also old and unused and should probably be deleted.

The Funder string could be renamed to FunderName in libgin for clarity. It would probably be better since the field name in the XML is actually funderName as well.

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