Skip to content

Commit 0262dbc

Browse files
committed
refactor: move examples to __examples directory and update build targets
- Move all example files from examples/ to __examples/ directory - Replace Makefile benchmark target with run-example target for running examples - Update README.md to reflect new example directory path and make command - Update .PHONY targets in Makefile to include run-example This change follows Go project conventions by using __examples prefix to clearly distinguish example code from main library code.
1 parent 0dd5faf commit 0262dbc

11 files changed

Lines changed: 10 additions & 9 deletions

File tree

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ test:
1414
bench:
1515
cd tests/benchmark && go test -bench=. -benchmem -benchtime=4s . -timeout 30m
1616

17-
benchmark:
18-
go test -bench=. -benchmem ./pkg/ewrap
19-
go test -bench=Benchmark -benchmem ./test
20-
# go test -run=TestProfile -cpuprofile=cpu.prof -memprofile=mem.prof ./test
17+
# run-example runs the example specified in the example variable with the optional arguments specified in the ARGS variable.
18+
run-example:
19+
go run __examples/$(example)/*.go $(ARGS)
2120

2221
update-deps:
2322
go get -v -u ./...
@@ -91,4 +90,4 @@ help:
9190
@echo
9291
@echo "For more information, see the project README."
9392

94-
.PHONY: prepare-toolchain test bench update-deps lint help
93+
.PHONY: prepare-toolchain test bench run-example update-deps lint help

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ ok github.com/hyp3rd/hypercache/tests/benchmark 30.031s
6464
To run the examples, use the following command:
6565

6666
```bash
67-
make run example=eviction # or any other example
67+
make run-example example=eviction # or any other example
6868
```
6969

70-
For a complete list of examples, refer to the [examples](./examples/README.md) directory.
70+
For a complete list of examples, refer to the [examples](./__examples/README.md) directory.
7171

7272
## API
7373

@@ -113,15 +113,17 @@ if err != nil {
113113

114114
## Usage
115115

116-
Examples can be too broad for a readme, refer to the [examples](./examples/README.md) directory for a more comprehensive overview.
116+
Examples can be too broad for a readme, refer to the [examples](./__examples/README.md) directory for a more comprehensive overview.
117117

118118
## License
119119

120120
The code and documentation in this project are released under Mozilla Public License 2.0.
121121

122122
## Author
123123

124-
I'm a surfer, a crypto trader, and a software architect with 15 years of experience designing highly available distributed production environments and developing cloud-native apps in public and private clouds. Feel free to hook me up on [LinkedIn](https://www.linkedin.com/in/francesco-cosentino/).
124+
I'm a surfer, and a software architect with 15 years of experience designing highly available distributed production systems and developing cloud-native apps in public and private clouds. Feel free to connect with me on LinkedIn.
125+
126+
[![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/francesco-cosentino/)
125127

126128
[build-link]: https://github.com/hyp3rd/hypercache/actions/workflows/go.yml
127129
[codeql-link]:https://github.com/hyp3rd/hypercache/actions/workflows/codeql.yml
File renamed without changes.

0 commit comments

Comments
 (0)