bsm / redislock

Simplified distributed locking implementation using Redis
Other
1.45k stars 157 forks source link

chore(example): import used package in examples #62

Closed spike014 closed 1 year ago

dim commented 1 year ago

Thanks very much, but you need to change this in https://github.com/bsm/redislock/blob/main/README.md.tpl, then run make README.md to propagate.

spike014 commented 1 year ago

Hi, @dim ! Happy to see your response, I run make README.md without changing the import package in README.md.But nothing happened. I curious about how make README.md (becca -package $(subst $(GOPATH)/src/,,$(PWD))) works? I can't figure out by Google. Would you mind to tell me how it works?

dim commented 1 year ago

Hi, @dim ! Happy to see your response, I run make README.md without changing the import package in README.md.But nothing happened. I curious about how make README.md (becca -package $(subst $(GOPATH)/src/,,$(PWD))) works? I can't figure out by Google. Would you mind to tell me how it works?

I assume that's because make doesn't update target files that are newer than the source. Try make -b README.md to force the issue. Or touch README.md.tmpl first.

dim commented 1 year ago

becca (https://github.com/dave/rebecca) simply inserts examples (from examples.go) into the README so I don't need to maintain them 2x

spike014 commented 1 year ago

Hi, @dim ! Happy to see your response, I run make README.md without changing the import package in README.md.But nothing happened. I curious about how make README.md (becca -package $(subst $(GOPATH)/src/,,$(PWD))) works? I can't figure out by Google. Would you mind to tell me how it works?

I assume that's because make doesn't update target files that are newer than the source. Try make -b README.md to force the issue. Or touch README.md.tmpl first.

Thanks for your response! After reading the document in rebecca, I think I figured out why the changes doesn't take effect when I run make README.md.

Because the {{ "Example" | code }} in README.md.tpl only works for the main function body, it can't rewrite the content out of the main function body. The import package won't change after running make README.md or make -b README.md.

So I think this PR finished its mission. Please let me know if there is anything else need to do in this PR.