diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2024-03-06 08:51:54 -0300 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2024-03-06 11:40:09 -0300 |
commit | e671d3bbbda9b2bec8fa119aa1ff46499118ef17 (patch) | |
tree | de070bfc9392fe6bbb73f786db960279755540a7 /doc/languages-frameworks/go.section.md | |
parent | a2c4602ccd6a9e32dac098abf38bd1fa0fe53dd4 (diff) | |
download | nixlib-e671d3bbbda9b2bec8fa119aa1ff46499118ef17.tar nixlib-e671d3bbbda9b2bec8fa119aa1ff46499118ef17.tar.gz nixlib-e671d3bbbda9b2bec8fa119aa1ff46499118ef17.tar.bz2 nixlib-e671d3bbbda9b2bec8fa119aa1ff46499118ef17.tar.lz nixlib-e671d3bbbda9b2bec8fa119aa1ff46499118ef17.tar.xz nixlib-e671d3bbbda9b2bec8fa119aa1ff46499118ef17.tar.zst nixlib-e671d3bbbda9b2bec8fa119aa1ff46499118ef17.zip |
Nix docs: remove `with lib;` from example code
Following [Best Practices](https://nix.dev/guides/best-practices#with-scopes), `with` is a problematic language construction and should be avoided. Usually it is employed like a "factorization": `[ X.A X.B X.C X.D ]` is written `with X; [ A B C D ]`. However, as shown in the link above, the syntatical rules of `with` are not so intuitive, and this "distributive rule" is very selective, in the sense that `with X; [ A B C D ]` is not equivalent to `[ X.A X.B X.C X.D ]`. However, this factorization is still useful to "squeeze" some code, especially in lists like `meta.maintainers`. On the other hand, it becomes less justifiable in bigger scopes. This is especially true in cases like `with lib;` in the top of expression and in sets like `meta = with lib; { . . . }`. That being said, this patch removes most of example code in the current documentation. The exceptions are, for now - doc/functions/generators.section.md - doc/languages-frameworks/coq.section.md because, well, they are way more complicated, and I couldn't parse them mentally - yet another reason why `with` should be avoided!
Diffstat (limited to 'doc/languages-frameworks/go.section.md')
-rw-r--r-- | doc/languages-frameworks/go.section.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/languages-frameworks/go.section.md b/doc/languages-frameworks/go.section.md index 7f151c76129f..369eb88d331f 100644 --- a/doc/languages-frameworks/go.section.md +++ b/doc/languages-frameworks/go.section.md @@ -51,11 +51,11 @@ pet = buildGoModule rec { vendorHash = "sha256-ciBIR+a1oaYH+H1PcC8cD8ncfJczk1IiJ8iYNM+R6aA="; - meta = with lib; { + meta = { description = "Simple command-line snippet manager, written in Go"; homepage = "https://github.com/knqyf263/pet"; - license = licenses.mit; - maintainers = with maintainers; [ kalbasit ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ kalbasit ]; }; } ``` |