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

Add working examples #299

Open
ikawaha opened this issue Mar 6, 2023 · 4 comments
Open

Add working examples #299

ikawaha opened this issue Mar 6, 2023 · 4 comments

Comments

@ikawaha
Copy link
Owner

ikawaha commented Mar 6, 2023

see. #277 (comment)

./sample/
├── dict
│   └── userdict.txt
├── example      ← ※ folder for adding working examples
└── wasm
    ├── README.md
    ├── go.mod
    ├── kagome.html
    └── main.go
@KEINOS
Copy link
Sponsor Contributor

KEINOS commented Apr 12, 2024

I wish to refactor the sample directory as below, if I may.
If so, this change will ease adding other examples.

# Current
sample
├── _example
│   ├── db_search
│   │   └── main.go
│   ├── go.mod
│   ├── go.sum
│   ├── tokenize
│   │   └── main.go
│   └── wakati
│       └── main.go
├── dict
│   └── userdict.txt
└── wasm
    ├── README.md
    ├── go.mod
    ├── kagome.html
    └── main.go
# After refactor
_example
├── go.mod
├── go.sum
│
├── dict
│   └── userdict.txt
├── db_search
│   └── main.go
├── tokenize
│   └── main.go
├── wakati
│   └── main.go
└── wasm
    ├── README.md
    ├── kagome.html
    └── main.go

@ikawaha
Copy link
Owner Author

ikawaha commented Apr 12, 2024

Thanks for the suggestion.

I had the current directory structure so as not to change the location of the sample user dictionary, but I thought it would be a good idea to change it.

I thought it would be better to put go.mod in each subdirectory. What do you think?

# After refactor
_example
│
├── dict (or user_dict)
│   └── userdict.txt
├── db_search
│   ├── go.mod
│   ├── go.sum
│   └── main.go
├── tokenize
│   ├── go.mod
│   ├── go.sum
│   └── main.go
├── wakati
│   ├── go.mod
│   ├── go.sum
│   └── main.go
└── wasm
    ├── go.mod
    ├── go.sum
    ├── README.md
    ├── kagome.html
    └── main.go

@KEINOS
Copy link
Sponsor Contributor

KEINOS commented Apr 13, 2024

I agree.

Having go.mod and go.sum in every example directory is ideal. It looses coupling and easy to understand.

In that case we need to place go.work file for multi-module to avoid warnings from IDE/gopls.

# After refactor
_example
+├── go.work-├── dict (or user_dict)
+├── user_dict
+│   ├── go.mod
+│   ├── go.sum
+│   ├── main.go
 │   └── userdict.txt
 ├── db_search
 │   ├── go.mod
 │   ├── go.sum
 │   └── main.go
 ├── tokenize
 │   ├── go.mod
 │   ├── go.sum
 │   └── main.go
 ├── wakati
 │   ├── go.mod
 │   ├── go.sum
 │   └── main.go
 └── wasm
     ├── go.mod
     ├── go.sum
     ├── README.md
     ├── kagome.html
     └── main.go

This allows users to simply change their working directory and run the examples.
If this is okay with you, I would like to make a PR of it.

@ikawaha
Copy link
Owner Author

ikawaha commented Apr 13, 2024

It seems to be good, looking forward to your pull request.

Thank you!

KEINOS added a commit to KEINOS/Fork_kagome that referenced this issue Apr 13, 2024
Refactor directory structure of examples.

- related issue ikawaha#200 ikawaha#299 (comment)
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