snivilised / traverse

🌀 concurrent directory walker
MIT License
0 stars 0 forks source link

generate i18n error code #115

Closed plastikfan closed 2 weeks ago

plastikfan commented 1 month ago

The reason why I've been having so many problems with go-i18n is because of the poor design of go-i18n, which depends on the code always importing "github.com/nicksnyder/go-i18n/v2/i18n", which is really stupid. All code with extractable content MUST import directly from nicksnyder/go-i18n/v2/i18n.

To avoid namespace clashes, we'll name local localisation folders locales instead of i18n. Unfortunately we have to accept that i18n is reserved for go-i18n because of the issue recently discovered.

See:

plastikfan commented 2 weeks ago

created ginkgo snippet:

  "Ginko Variable Native Error": {
    "scope": "go",
    "prefix": "gverrt",
    "body": [
      "Context(\"$1 error\", func() {",
      "  When(\"given: matching error\", func() {",
      "    It(\"🧪 should: affirm\", func() {",
      "      err := core.New$1Error(\"bar\")",
      "      Expect(",
      "        core.Is$1Error(err),",
      "      ).To(BeTrue(),",
      "        \"error does not match $1\",",
      "      )",
      "    })",
      "  })",
      "",
      "  When(\"given: non matching error\", func() {",
      "    It(\"🧪 should: reject\", func() {",
      "      err := errors.New(\"fake\")",
      "      Expect(",
      "        core.Is$1Error(err),",
      "      ).To(BeFalse(),",
      "        \"not matching error should not match $1\",",
      "      )",
      "    })",
      "  })",
      "})",
      "",
    ],
  },