Comments (4)
Should be solved by v2.0
I'm using go-bindata to generate the dict files, and the generated code-comment seems to be multiline which I think github may have issues with. But that is a problem with go-bindata, rather than golem.
Split into both separate files and multiple packages.
from golem.
@aaaton yeah, that's cool.
While original issue considered solved I'd like to make some notes.
I did a quick peek at your code and if it's appropriate for you there's things that can be improved:
- I don't see need for having exported struct for
LanguagePack
and since you have generic interface for that anyway it may be convenient to return this one instead of struct pointer. But it's questionable though. And interface definition in this case should be moved fromgolem
package to avoid circular dependencies (root ofdict/
is sufficient I guess). - You have some common code inside your generated language files which probably can be exported to another package and re-used. It'll help to avoid errors when you need to regenerate these files.
- As a general recommendation it is good to name methods that create objects just "New" in these cases where package can return only single type of object.
- Comments needed to guard generated files still seem not to be respected by code editors (single-line comment with dot at the end should be used I suppose).
from golem.
Thanks for your suggestions. I'll look into both.
I think the first suggestion might just be a matter of updating the data generator used and re-generating. But the are some other details I would like the fix with that as well.
Someone suggested adding the different languages to different packages and requiring the import of those packages for the language to work, which I think makes sense, performance and memory usage wise. And the git tracking like you suggested.
There should also be some way of reducing the storage size by at least a factor 2 for the language-files. Which should also affect tracking capabilities.
from golem.
Thanks for your feedback @gudvinr.
I think you have a few sensible points there. But I have questions!
-
Whats's the argument for exporting the interface instead of a struct implementing the interface?
-
The duplicated code is sad indeed. I'll look into this.
-
This was my original design, but felt confusing to write en.New() to produce a LanguagePack. That pattern makes way more sense when the package name accurately describes the single purpose of the constructor. Like
golem.New()
. But perhaps consistency outweighs descriptiveness. -
Yeah, the pattern Rob Pike posted is the one I've added to the generated files of the language/pack.go structures. That seems to work for VS Code and GitHub for me at least. Does it not work for you? The language/data.go files have the "generation-comment" produced by go-bindata which is not really something I want to alter.
from golem.
Related Issues (9)
- Stopwords not lemmatized
- dicts/de/data.go:1:1: expected 'package', found version HOT 20
- Getting an error straight from the beginning HOT 3
- Breaks without go mod HOT 1
- Multiple options gives random result HOT 3
- English, Swedish, French, Spanish & German HOT 3
- License HOT 2
- importing golem package HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from golem.