goscript 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/cmd/goscript/cmd-test.go +104 -11
  2. package/cmd/goscript/cmd-test_test.go +1 -1
  3. package/cmd/goscript/cmd_compile.go +9 -0
  4. package/compiler/compile-request.go +31 -0
  5. package/compiler/compiler.go +1 -1
  6. package/compiler/compliance_test.go +0 -2
  7. package/compiler/config.go +2 -0
  8. package/compiler/gotest/package-result.go +2 -0
  9. package/compiler/gotest/request.go +85 -20
  10. package/compiler/gotest/runner.go +733 -96
  11. package/compiler/gotest/runner_test.go +647 -3
  12. package/compiler/lowered-program.go +10 -2
  13. package/compiler/lowering.go +2676 -349
  14. package/compiler/override-facts.go +77 -27
  15. package/compiler/override-registry.go +5 -4
  16. package/compiler/override-registry_test.go +178 -0
  17. package/compiler/package-graph_test.go +62 -7
  18. package/compiler/package-test-graph-variant.go +40 -16
  19. package/compiler/package-test-graph.go +0 -5
  20. package/compiler/package-test-graph_test.go +61 -3
  21. package/compiler/runtime-contract.go +40 -0
  22. package/compiler/semantic-model-types.go +16 -0
  23. package/compiler/semantic-model.go +336 -91
  24. package/compiler/semantic-model_test.go +50 -1
  25. package/compiler/service.go +9 -3
  26. package/compiler/skeleton_test.go +2371 -296
  27. package/compiler/tsworkspace/owner-process-unix_test.go +72 -0
  28. package/compiler/tsworkspace/owner.go +8 -0
  29. package/compiler/tsworkspace/tool-process-other.go +14 -0
  30. package/compiler/tsworkspace/tool-process-unix.go +19 -0
  31. package/compiler/typescript-emitter.go +149 -10
  32. package/dist/gs/builtin/builtin.d.ts +20 -1
  33. package/dist/gs/builtin/builtin.js +246 -26
  34. package/dist/gs/builtin/builtin.js.map +1 -1
  35. package/dist/gs/builtin/channel.d.ts +24 -10
  36. package/dist/gs/builtin/channel.js +143 -34
  37. package/dist/gs/builtin/channel.js.map +1 -1
  38. package/dist/gs/builtin/defer.d.ts +1 -0
  39. package/dist/gs/builtin/defer.js +12 -2
  40. package/dist/gs/builtin/defer.js.map +1 -1
  41. package/dist/gs/builtin/hostio.d.ts +9 -0
  42. package/dist/gs/builtin/hostio.js +25 -0
  43. package/dist/gs/builtin/hostio.js.map +1 -1
  44. package/dist/gs/builtin/map.js +40 -6
  45. package/dist/gs/builtin/map.js.map +1 -1
  46. package/dist/gs/builtin/print.js.map +1 -1
  47. package/dist/gs/builtin/slice.d.ts +43 -9
  48. package/dist/gs/builtin/slice.js +437 -234
  49. package/dist/gs/builtin/slice.js.map +1 -1
  50. package/dist/gs/builtin/type.d.ts +2 -0
  51. package/dist/gs/builtin/type.js +55 -10
  52. package/dist/gs/builtin/type.js.map +1 -1
  53. package/dist/gs/builtin/varRef.d.ts +2 -0
  54. package/dist/gs/builtin/varRef.js.map +1 -1
  55. package/dist/gs/bytes/buffer.gs.js +28 -28
  56. package/dist/gs/bytes/buffer.gs.js.map +1 -1
  57. package/dist/gs/bytes/bytes.gs.d.ts +7 -5
  58. package/dist/gs/bytes/bytes.gs.js +10 -4
  59. package/dist/gs/bytes/bytes.gs.js.map +1 -1
  60. package/dist/gs/bytes/iter.gs.js +13 -13
  61. package/dist/gs/bytes/iter.gs.js.map +1 -1
  62. package/dist/gs/compress/zlib/index.d.ts +26 -0
  63. package/dist/gs/compress/zlib/index.js +168 -0
  64. package/dist/gs/compress/zlib/index.js.map +1 -0
  65. package/dist/gs/context/context.d.ts +1 -1
  66. package/dist/gs/context/context.js +8 -3
  67. package/dist/gs/context/context.js.map +1 -1
  68. package/dist/gs/crypto/ecdh/index.d.ts +52 -0
  69. package/dist/gs/crypto/ecdh/index.js +226 -0
  70. package/dist/gs/crypto/ecdh/index.js.map +1 -0
  71. package/dist/gs/crypto/ed25519/index.d.ts +34 -0
  72. package/dist/gs/crypto/ed25519/index.js +160 -0
  73. package/dist/gs/crypto/ed25519/index.js.map +1 -0
  74. package/dist/gs/crypto/internal/constanttime/index.d.ts +4 -0
  75. package/dist/gs/crypto/internal/constanttime/index.js +18 -0
  76. package/dist/gs/crypto/internal/constanttime/index.js.map +1 -0
  77. package/dist/gs/crypto/rand/index.d.ts +2 -0
  78. package/dist/gs/crypto/rand/index.js +85 -0
  79. package/dist/gs/crypto/rand/index.js.map +1 -1
  80. package/dist/gs/crypto/sha1/index.d.ts +5 -0
  81. package/dist/gs/crypto/sha1/index.js +106 -0
  82. package/dist/gs/crypto/sha1/index.js.map +1 -0
  83. package/dist/gs/crypto/sha256/index.d.ts +8 -0
  84. package/dist/gs/crypto/sha256/index.js +118 -0
  85. package/dist/gs/crypto/sha256/index.js.map +1 -0
  86. package/dist/gs/crypto/sha512/index.d.ts +14 -0
  87. package/dist/gs/crypto/sha512/index.js +129 -0
  88. package/dist/gs/crypto/sha512/index.js.map +1 -0
  89. package/dist/gs/encoding/json/index.d.ts +3 -0
  90. package/dist/gs/encoding/json/index.js +15 -0
  91. package/dist/gs/encoding/json/index.js.map +1 -1
  92. package/dist/gs/errors/errors.js +29 -6
  93. package/dist/gs/errors/errors.js.map +1 -1
  94. package/dist/gs/fmt/fmt.d.ts +1 -1
  95. package/dist/gs/fmt/fmt.js +64 -3
  96. package/dist/gs/fmt/fmt.js.map +1 -1
  97. package/dist/gs/github.com/aperturerobotics/protobuf-go-lite/index.d.ts +7 -7
  98. package/dist/gs/github.com/aperturerobotics/protobuf-go-lite/index.js +52 -18
  99. package/dist/gs/github.com/aperturerobotics/protobuf-go-lite/index.js.map +1 -1
  100. package/dist/gs/github.com/aperturerobotics/protobuf-go-lite/json/index.js +56 -20
  101. package/dist/gs/github.com/aperturerobotics/protobuf-go-lite/json/index.js.map +1 -1
  102. package/dist/gs/github.com/aperturerobotics/starpc/srpc/index.d.ts +57 -3
  103. package/dist/gs/github.com/aperturerobotics/starpc/srpc/index.js +366 -1
  104. package/dist/gs/github.com/aperturerobotics/starpc/srpc/index.js.map +1 -1
  105. package/dist/gs/github.com/aperturerobotics/util/conc/index.d.ts +20 -0
  106. package/dist/gs/github.com/aperturerobotics/util/conc/index.js +134 -0
  107. package/dist/gs/github.com/aperturerobotics/util/conc/index.js.map +1 -0
  108. package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/browser.js.map +1 -1
  109. package/dist/gs/github.com/hack-pad/safejs/internal/catch/index.d.ts +3 -0
  110. package/dist/gs/github.com/hack-pad/safejs/internal/catch/index.js +50 -0
  111. package/dist/gs/github.com/hack-pad/safejs/internal/catch/index.js.map +1 -0
  112. package/dist/gs/github.com/klauspost/compress/internal/le/index.js +3 -2
  113. package/dist/gs/github.com/klauspost/compress/internal/le/index.js.map +1 -1
  114. package/dist/gs/github.com/mr-tron/base58/base58/index.d.ts +27 -0
  115. package/dist/gs/github.com/mr-tron/base58/base58/index.js +172 -0
  116. package/dist/gs/github.com/mr-tron/base58/base58/index.js.map +1 -0
  117. package/dist/gs/github.com/zeebo/blake3/internal/consts/index.d.ts +21 -0
  118. package/dist/gs/github.com/zeebo/blake3/internal/consts/index.js +22 -0
  119. package/dist/gs/github.com/zeebo/blake3/internal/consts/index.js.map +1 -0
  120. package/dist/gs/go/token/index.js +11 -4
  121. package/dist/gs/go/token/index.js.map +1 -1
  122. package/dist/gs/hash/fnv/index.d.ts +57 -0
  123. package/dist/gs/hash/fnv/index.js +299 -0
  124. package/dist/gs/hash/fnv/index.js.map +1 -0
  125. package/dist/gs/hash/index.d.ts +17 -0
  126. package/dist/gs/hash/index.js +94 -0
  127. package/dist/gs/hash/index.js.map +1 -0
  128. package/dist/gs/io/fs/readlink.js +2 -6
  129. package/dist/gs/io/fs/readlink.js.map +1 -1
  130. package/dist/gs/io/fs/walk.js.map +1 -1
  131. package/dist/gs/io/io.d.ts +8 -5
  132. package/dist/gs/io/io.js +20 -2
  133. package/dist/gs/io/io.js.map +1 -1
  134. package/dist/gs/iter/iter.d.ts +3 -2
  135. package/dist/gs/iter/iter.js.map +1 -1
  136. package/dist/gs/maps/iter.d.ts +5 -5
  137. package/dist/gs/maps/iter.js +48 -21
  138. package/dist/gs/maps/iter.js.map +1 -1
  139. package/dist/gs/maps/maps.d.ts +6 -6
  140. package/dist/gs/math/bits/index.js +14 -24
  141. package/dist/gs/math/bits/index.js.map +1 -1
  142. package/dist/gs/mime/index.js +3 -1
  143. package/dist/gs/mime/index.js.map +1 -1
  144. package/dist/gs/net/http/httptest/index.d.ts +20 -1
  145. package/dist/gs/net/http/httptest/index.js +85 -3
  146. package/dist/gs/net/http/httptest/index.js.map +1 -1
  147. package/dist/gs/net/http/index.d.ts +118 -6
  148. package/dist/gs/net/http/index.js +389 -14
  149. package/dist/gs/net/http/index.js.map +1 -1
  150. package/dist/gs/net/http/pprof/index.d.ts +8 -0
  151. package/dist/gs/net/http/pprof/index.js +59 -0
  152. package/dist/gs/net/http/pprof/index.js.map +1 -0
  153. package/dist/gs/os/error.gs.js +9 -7
  154. package/dist/gs/os/error.gs.js.map +1 -1
  155. package/dist/gs/os/types_js.gs.js +95 -15
  156. package/dist/gs/os/types_js.gs.js.map +1 -1
  157. package/dist/gs/os/zero_copy_posix.gs.js +1 -1
  158. package/dist/gs/os/zero_copy_posix.gs.js.map +1 -1
  159. package/dist/gs/path/filepath/match.js.map +1 -1
  160. package/dist/gs/path/filepath/path.d.ts +5 -3
  161. package/dist/gs/path/filepath/path.js +65 -10
  162. package/dist/gs/path/filepath/path.js.map +1 -1
  163. package/dist/gs/reflect/index.d.ts +3 -2
  164. package/dist/gs/reflect/index.js +2 -1
  165. package/dist/gs/reflect/index.js.map +1 -1
  166. package/dist/gs/reflect/iter.js +2 -2
  167. package/dist/gs/reflect/iter.js.map +1 -1
  168. package/dist/gs/reflect/map.js +26 -0
  169. package/dist/gs/reflect/map.js.map +1 -1
  170. package/dist/gs/reflect/type.d.ts +24 -5
  171. package/dist/gs/reflect/type.js +390 -38
  172. package/dist/gs/reflect/type.js.map +1 -1
  173. package/dist/gs/reflect/types.d.ts +1 -0
  174. package/dist/gs/reflect/types.js +3 -1
  175. package/dist/gs/reflect/types.js.map +1 -1
  176. package/dist/gs/reflect/value.d.ts +4 -1
  177. package/dist/gs/reflect/value.js +39 -1
  178. package/dist/gs/reflect/value.js.map +1 -1
  179. package/dist/gs/reflect/visiblefields.js +1 -1
  180. package/dist/gs/reflect/visiblefields.js.map +1 -1
  181. package/dist/gs/runtime/debug/index.d.ts +39 -0
  182. package/dist/gs/runtime/debug/index.js +58 -0
  183. package/dist/gs/runtime/debug/index.js.map +1 -1
  184. package/dist/gs/runtime/pprof/index.d.ts +20 -0
  185. package/dist/gs/runtime/pprof/index.js +85 -0
  186. package/dist/gs/runtime/pprof/index.js.map +1 -0
  187. package/dist/gs/runtime/trace/index.d.ts +19 -0
  188. package/dist/gs/runtime/trace/index.js +64 -0
  189. package/dist/gs/runtime/trace/index.js.map +1 -0
  190. package/dist/gs/slices/slices.d.ts +24 -9
  191. package/dist/gs/slices/slices.js +229 -24
  192. package/dist/gs/slices/slices.js.map +1 -1
  193. package/dist/gs/sort/slice.gs.d.ts +5 -3
  194. package/dist/gs/sort/slice.gs.js +55 -17
  195. package/dist/gs/sort/slice.gs.js.map +1 -1
  196. package/dist/gs/strings/builder.js +26 -17
  197. package/dist/gs/strings/builder.js.map +1 -1
  198. package/dist/gs/strings/iter.js +140 -75
  199. package/dist/gs/strings/iter.js.map +1 -1
  200. package/dist/gs/strings/replace.js +2 -2
  201. package/dist/gs/strings/replace.js.map +1 -1
  202. package/dist/gs/strings/strings.js +52 -6
  203. package/dist/gs/strings/strings.js.map +1 -1
  204. package/dist/gs/sync/sync.d.ts +6 -3
  205. package/dist/gs/sync/sync.js +39 -11
  206. package/dist/gs/sync/sync.js.map +1 -1
  207. package/dist/gs/syscall/errors.d.ts +116 -112
  208. package/dist/gs/syscall/errors.js +38 -1
  209. package/dist/gs/syscall/errors.js.map +1 -1
  210. package/dist/gs/syscall/fs.d.ts +2 -8
  211. package/dist/gs/syscall/fs.js.map +1 -1
  212. package/dist/gs/syscall/js/index.js +20 -12
  213. package/dist/gs/syscall/js/index.js.map +1 -1
  214. package/dist/gs/syscall/types.d.ts +4 -1
  215. package/dist/gs/syscall/types.js.map +1 -1
  216. package/dist/gs/testing/testing.d.ts +4 -3
  217. package/dist/gs/testing/testing.js +21 -4
  218. package/dist/gs/testing/testing.js.map +1 -1
  219. package/dist/gs/time/time.js +22 -0
  220. package/dist/gs/time/time.js.map +1 -1
  221. package/dist/gs/unicode/unicode.js.map +1 -1
  222. package/dist/gs/unique/index.js +7 -2
  223. package/dist/gs/unique/index.js.map +1 -1
  224. package/go.mod +8 -8
  225. package/go.sum +14 -23
  226. package/gs/builtin/builtin.ts +364 -37
  227. package/gs/builtin/channel.ts +208 -38
  228. package/gs/builtin/defer.ts +13 -2
  229. package/gs/builtin/hostio.test.ts +1 -0
  230. package/gs/builtin/hostio.ts +38 -0
  231. package/gs/builtin/map.ts +46 -6
  232. package/gs/builtin/print.ts +12 -3
  233. package/gs/builtin/runtime-contract.test.ts +290 -10
  234. package/gs/builtin/slice.test.ts +70 -0
  235. package/gs/builtin/slice.ts +566 -255
  236. package/gs/builtin/type.ts +63 -10
  237. package/gs/builtin/varRef.ts +2 -0
  238. package/gs/bytes/buffer.gs.ts +28 -28
  239. package/gs/bytes/bytes.gs.ts +19 -10
  240. package/gs/bytes/bytes.test.ts +17 -0
  241. package/gs/bytes/iter.gs.ts +13 -14
  242. package/gs/compress/zlib/index.test.ts +28 -0
  243. package/gs/compress/zlib/index.ts +200 -0
  244. package/gs/compress/zlib/meta.json +3 -0
  245. package/gs/context/context.test.ts +36 -2
  246. package/gs/context/context.ts +9 -4
  247. package/gs/crypto/ecdh/index.test.ts +43 -0
  248. package/gs/crypto/ecdh/index.ts +274 -0
  249. package/gs/crypto/ed25519/index.test.ts +41 -0
  250. package/gs/crypto/ed25519/index.ts +238 -0
  251. package/gs/crypto/ed25519/meta.json +13 -0
  252. package/gs/crypto/internal/constanttime/index.test.ts +25 -0
  253. package/gs/crypto/internal/constanttime/index.ts +22 -0
  254. package/gs/crypto/rand/index.test.ts +89 -1
  255. package/gs/crypto/rand/index.ts +103 -1
  256. package/gs/crypto/rand/meta.json +4 -1
  257. package/gs/crypto/sha1/index.test.ts +28 -0
  258. package/gs/crypto/sha1/index.ts +130 -0
  259. package/gs/crypto/sha1/meta.json +8 -0
  260. package/gs/crypto/sha256/index.test.ts +78 -0
  261. package/gs/crypto/sha256/index.ts +150 -0
  262. package/gs/crypto/sha256/meta.json +9 -0
  263. package/gs/crypto/sha512/index.test.ts +31 -0
  264. package/gs/crypto/sha512/index.ts +161 -0
  265. package/gs/crypto/sha512/meta.json +11 -0
  266. package/gs/encoding/json/index.test.ts +25 -3
  267. package/gs/encoding/json/index.ts +21 -3
  268. package/gs/errors/errors.test.ts +4 -1
  269. package/gs/errors/errors.ts +32 -8
  270. package/gs/fmt/fmt.test.ts +23 -1
  271. package/gs/fmt/fmt.ts +76 -10
  272. package/gs/github.com/aperturerobotics/protobuf-go-lite/index.test.ts +62 -7
  273. package/gs/github.com/aperturerobotics/protobuf-go-lite/index.ts +78 -36
  274. package/gs/github.com/aperturerobotics/protobuf-go-lite/json/index.test.ts +32 -11
  275. package/gs/github.com/aperturerobotics/protobuf-go-lite/json/index.ts +122 -43
  276. package/gs/github.com/aperturerobotics/starpc/srpc/index.test.ts +31 -0
  277. package/gs/github.com/aperturerobotics/starpc/srpc/index.ts +518 -4
  278. package/gs/github.com/aperturerobotics/starpc/srpc/meta.json +6 -0
  279. package/gs/github.com/aperturerobotics/util/conc/index.test.ts +30 -0
  280. package/gs/github.com/aperturerobotics/util/conc/index.ts +172 -0
  281. package/gs/github.com/aperturerobotics/util/conc/meta.json +9 -0
  282. package/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/browser.ts +1 -4
  283. package/gs/github.com/hack-pad/safejs/internal/catch/index.test.ts +35 -0
  284. package/gs/github.com/hack-pad/safejs/internal/catch/index.ts +65 -0
  285. package/gs/github.com/hack-pad/safejs/internal/catch/meta.json +9 -0
  286. package/gs/github.com/klauspost/compress/internal/le/index.test.ts +2 -1
  287. package/gs/github.com/klauspost/compress/internal/le/index.ts +6 -5
  288. package/gs/github.com/mr-tron/base58/base58/index.test.ts +70 -0
  289. package/gs/github.com/mr-tron/base58/base58/index.ts +231 -0
  290. package/gs/github.com/mr-tron/base58/base58/meta.json +3 -0
  291. package/gs/github.com/zeebo/blake3/internal/consts/index.test.ts +46 -0
  292. package/gs/github.com/zeebo/blake3/internal/consts/index.ts +26 -0
  293. package/gs/go/token/index.ts +17 -4
  294. package/gs/hash/fnv/index.test.ts +67 -0
  295. package/gs/hash/fnv/index.ts +351 -0
  296. package/gs/hash/fnv/meta.json +3 -0
  297. package/gs/hash/index.test.ts +37 -0
  298. package/gs/hash/index.ts +118 -0
  299. package/gs/hash/meta.json +5 -0
  300. package/gs/internal/byteorder/index.test.ts +6 -6
  301. package/gs/io/fs/readlink.ts +40 -48
  302. package/gs/io/fs/walk.ts +10 -2
  303. package/gs/io/io.test.ts +64 -0
  304. package/gs/io/io.ts +34 -13
  305. package/gs/iter/iter.ts +8 -2
  306. package/gs/maps/iter.ts +69 -26
  307. package/gs/maps/maps.test.ts +23 -0
  308. package/gs/maps/maps.ts +6 -6
  309. package/gs/math/bits/index.test.ts +20 -0
  310. package/gs/math/bits/index.ts +15 -28
  311. package/gs/mime/index.ts +8 -2
  312. package/gs/net/http/httptest/index.test.ts +85 -0
  313. package/gs/net/http/httptest/index.ts +113 -3
  314. package/gs/net/http/index.test.ts +159 -1
  315. package/gs/net/http/index.ts +515 -15
  316. package/gs/net/http/meta.json +6 -0
  317. package/gs/net/http/pprof/index.test.ts +47 -0
  318. package/gs/net/http/pprof/index.ts +65 -0
  319. package/gs/os/error.gs.ts +9 -10
  320. package/gs/os/error.test.ts +41 -0
  321. package/gs/os/file_unix_js.test.ts +55 -0
  322. package/gs/os/tempfile.gs.test.ts +37 -10
  323. package/gs/os/types_js.gs.ts +94 -15
  324. package/gs/os/zero_copy_posix.gs.ts +1 -2
  325. package/gs/path/filepath/match.ts +4 -1
  326. package/gs/path/filepath/meta.json +6 -0
  327. package/gs/path/filepath/path.test.ts +57 -2
  328. package/gs/path/filepath/path.ts +91 -12
  329. package/gs/reflect/field.test.ts +63 -0
  330. package/gs/reflect/index.ts +4 -1
  331. package/gs/reflect/iter.ts +2 -2
  332. package/gs/reflect/map.test.ts +24 -2
  333. package/gs/reflect/map.ts +35 -0
  334. package/gs/reflect/type.ts +543 -60
  335. package/gs/reflect/typefor.test.ts +100 -0
  336. package/gs/reflect/types.ts +3 -1
  337. package/gs/reflect/value.ts +50 -1
  338. package/gs/reflect/visiblefields.ts +1 -1
  339. package/gs/runtime/debug/index.test.ts +22 -1
  340. package/gs/runtime/debug/index.ts +88 -0
  341. package/gs/runtime/pprof/index.test.ts +36 -0
  342. package/gs/runtime/pprof/index.ts +104 -0
  343. package/gs/runtime/pprof/meta.json +6 -0
  344. package/gs/runtime/trace/index.test.ts +45 -0
  345. package/gs/runtime/trace/index.ts +97 -0
  346. package/gs/runtime/trace/meta.json +7 -0
  347. package/gs/slices/meta.json +2 -1
  348. package/gs/slices/slices.test.ts +86 -0
  349. package/gs/slices/slices.ts +284 -37
  350. package/gs/sort/slice.gs.ts +73 -23
  351. package/gs/sort/slice.test.ts +40 -0
  352. package/gs/strings/builder.test.ts +8 -0
  353. package/gs/strings/builder.ts +29 -17
  354. package/gs/strings/iter.test.ts +5 -7
  355. package/gs/strings/iter.ts +146 -71
  356. package/gs/strings/replace.test.ts +1 -4
  357. package/gs/strings/replace.ts +6 -6
  358. package/gs/strings/strings.test.ts +4 -0
  359. package/gs/strings/strings.ts +54 -6
  360. package/gs/sync/meta.json +1 -0
  361. package/gs/sync/sync.test.ts +57 -1
  362. package/gs/sync/sync.ts +45 -13
  363. package/gs/syscall/errors.ts +158 -115
  364. package/gs/syscall/fs.ts +8 -8
  365. package/gs/syscall/js/index.ts +49 -22
  366. package/gs/syscall/net.test.ts +26 -0
  367. package/gs/syscall/types.ts +7 -2
  368. package/gs/testing/testing.test.ts +56 -0
  369. package/gs/testing/testing.ts +27 -10
  370. package/gs/time/meta.json +2 -2
  371. package/gs/time/time.test.ts +4 -0
  372. package/gs/time/time.ts +33 -2
  373. package/gs/unicode/unicode.test.ts +14 -3
  374. package/gs/unicode/unicode.ts +1 -5
  375. package/gs/unique/index.ts +9 -2
  376. package/package.json +3 -3
@@ -1,667 +1,710 @@
1
1
  import * as $ from '@goscript/builtin/index.js'
2
- import { Errno } from './types.js'
2
+ import { Errno, ErrnoObject } from './types.js'
3
3
 
4
4
  export function Errno_Error(errno: Errno): string {
5
- return errno.Error()
6
- }
7
-
8
- export const EPERM: Errno = {
5
+ if (typeof errno !== 'number') {
6
+ return errno.Error()
7
+ }
8
+ return `errno ${errno}`
9
+ }
10
+
11
+ export function Errno_Is(errno: Errno, target: $.GoError): boolean {
12
+ if (target === null) {
13
+ return false
14
+ }
15
+ if (typeof errno !== 'number' && errno.Is(target)) {
16
+ return true
17
+ }
18
+ const errnoValue = errnoNumber(errno)
19
+ const targetValue = errnoNumber(target)
20
+ return targetValue !== null && errnoValue === targetValue
21
+ }
22
+
23
+ export function Errno_Temporary(errno: Errno): boolean {
24
+ const value = errnoNumber(errno)
25
+ return (
26
+ value === errnoNumber(EINTR) ||
27
+ value === errnoNumber(EMFILE) ||
28
+ value === errnoNumber(ENFILE) ||
29
+ Errno_Timeout(errno)
30
+ )
31
+ }
32
+
33
+ export function Errno_Timeout(errno: Errno): boolean {
34
+ const value = errnoNumber(errno)
35
+ return value === errnoNumber(EAGAIN) || value === errnoNumber(ETIMEDOUT)
36
+ }
37
+
38
+ function errnoNumber(errno: unknown): number | null {
39
+ if (typeof errno === 'number') {
40
+ return errno
41
+ }
42
+ if (errno !== null && typeof errno === 'object') {
43
+ const value = (errno as { Errno?: () => unknown }).Errno?.()
44
+ if (typeof value === 'number') {
45
+ return value
46
+ }
47
+ }
48
+ return null
49
+ }
50
+
51
+ export const EPERM: ErrnoObject = {
9
52
  Error: () => 'operation not permitted',
10
53
  Is: (target: $.GoError) => target === EPERM,
11
54
  Errno: () => 1,
12
55
  }
13
56
 
14
- export const ENOENT: Errno = {
57
+ export const ENOENT: ErrnoObject = {
15
58
  Error: () => 'no such file or directory',
16
59
  Is: (target: $.GoError) => target === ENOENT,
17
60
  Errno: () => 2,
18
61
  }
19
62
 
20
- export const ESRCH: Errno = {
63
+ export const ESRCH: ErrnoObject = {
21
64
  Error: () => 'no such process',
22
65
  Is: (target: $.GoError) => target === ESRCH,
23
66
  Errno: () => 3,
24
67
  }
25
68
 
26
- export const EINTR: Errno = {
69
+ export const EINTR: ErrnoObject = {
27
70
  Error: () => 'interrupted system call',
28
71
  Is: (target: $.GoError) => target === EINTR,
29
72
  Errno: () => 4,
30
73
  }
31
74
 
32
- export const EIO: Errno = {
75
+ export const EIO: ErrnoObject = {
33
76
  Error: () => 'I/O error',
34
77
  Is: (target: $.GoError) => target === EIO,
35
78
  Errno: () => 5,
36
79
  }
37
80
 
38
- export const ENXIO: Errno = {
81
+ export const ENXIO: ErrnoObject = {
39
82
  Error: () => 'no such device or address',
40
83
  Is: (target: $.GoError) => target === ENXIO,
41
84
  Errno: () => 6,
42
85
  }
43
86
 
44
- export const E2BIG: Errno = {
87
+ export const E2BIG: ErrnoObject = {
45
88
  Error: () => 'argument list too long',
46
89
  Is: (target: $.GoError) => target === E2BIG,
47
90
  Errno: () => 7,
48
91
  }
49
92
 
50
- export const ENOEXEC: Errno = {
93
+ export const ENOEXEC: ErrnoObject = {
51
94
  Error: () => 'exec format error',
52
95
  Is: (target: $.GoError) => target === ENOEXEC,
53
96
  Errno: () => 8,
54
97
  }
55
98
 
56
- export const EBADF: Errno = {
99
+ export const EBADF: ErrnoObject = {
57
100
  Error: () => 'bad file number',
58
101
  Is: (target: $.GoError) => target === EBADF,
59
102
  Errno: () => 9,
60
103
  }
61
104
 
62
- export const ECHILD: Errno = {
105
+ export const ECHILD: ErrnoObject = {
63
106
  Error: () => 'no child processes',
64
107
  Is: (target: $.GoError) => target === ECHILD,
65
108
  Errno: () => 10,
66
109
  }
67
110
 
68
- export const EAGAIN: Errno = {
111
+ export const EAGAIN: ErrnoObject = {
69
112
  Error: () => 'try again',
70
113
  Is: (target: $.GoError) => target === EAGAIN,
71
114
  Errno: () => 11,
72
115
  }
73
116
 
74
- export const ENOMEM: Errno = {
117
+ export const ENOMEM: ErrnoObject = {
75
118
  Error: () => 'out of memory',
76
119
  Is: (target: $.GoError) => target === ENOMEM,
77
120
  Errno: () => 12,
78
121
  }
79
122
 
80
- export const EACCES: Errno = {
123
+ export const EACCES: ErrnoObject = {
81
124
  Error: () => 'permission denied',
82
125
  Is: (target: $.GoError) => target === EACCES,
83
126
  Errno: () => 13,
84
127
  }
85
128
 
86
- export const EFAULT: Errno = {
129
+ export const EFAULT: ErrnoObject = {
87
130
  Error: () => 'bad address',
88
131
  Is: (target: $.GoError) => target === EFAULT,
89
132
  Errno: () => 14,
90
133
  }
91
134
 
92
- export const EBUSY: Errno = {
135
+ export const EBUSY: ErrnoObject = {
93
136
  Error: () => 'device or resource busy',
94
137
  Is: (target: $.GoError) => target === EBUSY,
95
138
  Errno: () => 16,
96
139
  }
97
140
 
98
- export const EEXIST: Errno = {
141
+ export const EEXIST: ErrnoObject = {
99
142
  Error: () => 'file exists',
100
143
  Is: (target: $.GoError) => target === EEXIST,
101
144
  Errno: () => 17,
102
145
  }
103
146
 
104
- export const EXDEV: Errno = {
147
+ export const EXDEV: ErrnoObject = {
105
148
  Error: () => 'cross-device link',
106
149
  Is: (target: $.GoError) => target === EXDEV,
107
150
  Errno: () => 18,
108
151
  }
109
152
 
110
- export const ENODEV: Errno = {
153
+ export const ENODEV: ErrnoObject = {
111
154
  Error: () => 'no such device',
112
155
  Is: (target: $.GoError) => target === ENODEV,
113
156
  Errno: () => 19,
114
157
  }
115
158
 
116
- export const ENOTDIR: Errno = {
159
+ export const ENOTDIR: ErrnoObject = {
117
160
  Error: () => 'not a directory',
118
161
  Is: (target: $.GoError) => target === ENOTDIR,
119
162
  Errno: () => 20,
120
163
  }
121
164
 
122
- export const EISDIR: Errno = {
165
+ export const EISDIR: ErrnoObject = {
123
166
  Error: () => 'is a directory',
124
167
  Is: (target: $.GoError) => target === EISDIR,
125
168
  Errno: () => 21,
126
169
  }
127
170
 
128
- export const EINVAL: Errno = {
171
+ export const EINVAL: ErrnoObject = {
129
172
  Error: () => 'invalid argument',
130
173
  Is: (target: $.GoError) => target === EINVAL,
131
174
  Errno: () => 22,
132
175
  }
133
176
 
134
- export const ENFILE: Errno = {
177
+ export const ENFILE: ErrnoObject = {
135
178
  Error: () => 'file table overflow',
136
179
  Is: (target: $.GoError) => target === ENFILE,
137
180
  Errno: () => 23,
138
181
  }
139
182
 
140
- export const EMFILE: Errno = {
183
+ export const EMFILE: ErrnoObject = {
141
184
  Error: () => 'too many open files',
142
185
  Is: (target: $.GoError) => target === EMFILE,
143
186
  Errno: () => 24,
144
187
  }
145
188
 
146
- export const ENOTTY: Errno = {
189
+ export const ENOTTY: ErrnoObject = {
147
190
  Error: () => 'not a typewriter',
148
191
  Is: (target: $.GoError) => target === ENOTTY,
149
192
  Errno: () => 25,
150
193
  }
151
194
 
152
- export const EFBIG: Errno = {
195
+ export const EFBIG: ErrnoObject = {
153
196
  Error: () => 'file too large',
154
197
  Is: (target: $.GoError) => target === EFBIG,
155
198
  Errno: () => 27,
156
199
  }
157
200
 
158
- export const ENOSPC: Errno = {
201
+ export const ENOSPC: ErrnoObject = {
159
202
  Error: () => 'no space left on device',
160
203
  Is: (target: $.GoError) => target === ENOSPC,
161
204
  Errno: () => 28,
162
205
  }
163
206
 
164
- export const ESPIPE: Errno = {
207
+ export const ESPIPE: ErrnoObject = {
165
208
  Error: () => 'illegal seek',
166
209
  Is: (target: $.GoError) => target === ESPIPE,
167
210
  Errno: () => 29,
168
211
  }
169
212
 
170
- export const EROFS: Errno = {
213
+ export const EROFS: ErrnoObject = {
171
214
  Error: () => 'read-only file system',
172
215
  Is: (target: $.GoError) => target === EROFS,
173
216
  Errno: () => 30,
174
217
  }
175
218
 
176
- export const EMLINK: Errno = {
219
+ export const EMLINK: ErrnoObject = {
177
220
  Error: () => 'too many links',
178
221
  Is: (target: $.GoError) => target === EMLINK,
179
222
  Errno: () => 31,
180
223
  }
181
224
 
182
- export const EPIPE: Errno = {
225
+ export const EPIPE: ErrnoObject = {
183
226
  Error: () => 'broken pipe',
184
227
  Is: (target: $.GoError) => target === EPIPE,
185
228
  Errno: () => 32,
186
229
  }
187
230
 
188
- export const EDOM: Errno = {
231
+ export const EDOM: ErrnoObject = {
189
232
  Error: () => 'math arg out of domain of func',
190
233
  Is: (target: $.GoError) => target === EDOM,
191
234
  Errno: () => 33,
192
235
  }
193
236
 
194
- export const ERANGE: Errno = {
237
+ export const ERANGE: ErrnoObject = {
195
238
  Error: () => 'result too large',
196
239
  Is: (target: $.GoError) => target === ERANGE,
197
240
  Errno: () => 34,
198
241
  }
199
242
 
200
- export const EDEADLK: Errno = {
243
+ export const EDEADLK: ErrnoObject = {
201
244
  Error: () => 'deadlock condition',
202
245
  Is: (target: $.GoError) => target === EDEADLK,
203
246
  Errno: () => 35,
204
247
  }
205
248
 
206
- export const ENAMETOOLONG: Errno = {
249
+ export const ENAMETOOLONG: ErrnoObject = {
207
250
  Error: () => 'file name too long',
208
251
  Is: (target: $.GoError) => target === ENAMETOOLONG,
209
252
  Errno: () => 36,
210
253
  }
211
254
 
212
- export const ENOLCK: Errno = {
255
+ export const ENOLCK: ErrnoObject = {
213
256
  Error: () => 'no record locks available',
214
257
  Is: (target: $.GoError) => target === ENOLCK,
215
258
  Errno: () => 37,
216
259
  }
217
260
 
218
- export const ENOSYS: Errno = {
261
+ export const ENOSYS: ErrnoObject = {
219
262
  Error: () => 'function not implemented',
220
263
  Is: (target: $.GoError) => target === ENOSYS,
221
264
  Errno: () => 38,
222
265
  }
223
266
 
224
- export const ENOTSUP: Errno = {
267
+ export const ENOTSUP: ErrnoObject = {
225
268
  Error: () => 'operation not supported',
226
269
  Is: (target: $.GoError) => target === ENOTSUP,
227
270
  Errno: () => 95,
228
271
  }
229
272
 
230
- export const ENOTEMPTY: Errno = {
273
+ export const ENOTEMPTY: ErrnoObject = {
231
274
  Error: () => 'directory not empty',
232
275
  Is: (target: $.GoError) => target === ENOTEMPTY,
233
276
  Errno: () => 39,
234
277
  }
235
278
 
236
- export const ELOOP: Errno = {
279
+ export const ELOOP: ErrnoObject = {
237
280
  Error: () => 'too many symbolic links',
238
281
  Is: (target: $.GoError) => target === ELOOP,
239
282
  Errno: () => 40,
240
283
  }
241
284
 
242
- export const ENOMSG: Errno = {
285
+ export const ENOMSG: ErrnoObject = {
243
286
  Error: () => 'no message of desired type',
244
287
  Is: (target: $.GoError) => target === ENOMSG,
245
288
  Errno: () => 42,
246
289
  }
247
290
 
248
- export const EIDRM: Errno = {
291
+ export const EIDRM: ErrnoObject = {
249
292
  Error: () => 'identifier removed',
250
293
  Is: (target: $.GoError) => target === EIDRM,
251
294
  Errno: () => 43,
252
295
  }
253
296
 
254
- export const ECHRNG: Errno = {
297
+ export const ECHRNG: ErrnoObject = {
255
298
  Error: () => 'channel number out of range',
256
299
  Is: (target: $.GoError) => target === ECHRNG,
257
300
  Errno: () => 44,
258
301
  }
259
302
 
260
- export const EL2NSYNC: Errno = {
303
+ export const EL2NSYNC: ErrnoObject = {
261
304
  Error: () => 'level 2 not synchronized',
262
305
  Is: (target: $.GoError) => target === EL2NSYNC,
263
306
  Errno: () => 45,
264
307
  }
265
308
 
266
- export const EL3HLT: Errno = {
309
+ export const EL3HLT: ErrnoObject = {
267
310
  Error: () => 'level 3 halted',
268
311
  Is: (target: $.GoError) => target === EL3HLT,
269
312
  Errno: () => 46,
270
313
  }
271
314
 
272
- export const EL3RST: Errno = {
315
+ export const EL3RST: ErrnoObject = {
273
316
  Error: () => 'level 3 reset',
274
317
  Is: (target: $.GoError) => target === EL3RST,
275
318
  Errno: () => 47,
276
319
  }
277
320
 
278
- export const ELNRNG: Errno = {
321
+ export const ELNRNG: ErrnoObject = {
279
322
  Error: () => 'link number out of range',
280
323
  Is: (target: $.GoError) => target === ELNRNG,
281
324
  Errno: () => 48,
282
325
  }
283
326
 
284
- export const EUNATCH: Errno = {
327
+ export const EUNATCH: ErrnoObject = {
285
328
  Error: () => 'protocol driver not attached',
286
329
  Is: (target: $.GoError) => target === EUNATCH,
287
330
  Errno: () => 49,
288
331
  }
289
332
 
290
- export const ENOCSI: Errno = {
333
+ export const ENOCSI: ErrnoObject = {
291
334
  Error: () => 'no CSI structure available',
292
335
  Is: (target: $.GoError) => target === ENOCSI,
293
336
  Errno: () => 50,
294
337
  }
295
338
 
296
- export const EL2HLT: Errno = {
339
+ export const EL2HLT: ErrnoObject = {
297
340
  Error: () => 'level 2 halted',
298
341
  Is: (target: $.GoError) => target === EL2HLT,
299
342
  Errno: () => 51,
300
343
  }
301
344
 
302
- export const EBADE: Errno = {
345
+ export const EBADE: ErrnoObject = {
303
346
  Error: () => 'invalid exchange',
304
347
  Is: (target: $.GoError) => target === EBADE,
305
348
  Errno: () => 52,
306
349
  }
307
350
 
308
- export const EBADR: Errno = {
351
+ export const EBADR: ErrnoObject = {
309
352
  Error: () => 'invalid request descriptor',
310
353
  Is: (target: $.GoError) => target === EBADR,
311
354
  Errno: () => 53,
312
355
  }
313
356
 
314
- export const EXFULL: Errno = {
357
+ export const EXFULL: ErrnoObject = {
315
358
  Error: () => 'exchange full',
316
359
  Is: (target: $.GoError) => target === EXFULL,
317
360
  Errno: () => 54,
318
361
  }
319
362
 
320
- export const ENOANO: Errno = {
363
+ export const ENOANO: ErrnoObject = {
321
364
  Error: () => 'no anode',
322
365
  Is: (target: $.GoError) => target === ENOANO,
323
366
  Errno: () => 55,
324
367
  }
325
368
 
326
- export const EBADRQC: Errno = {
369
+ export const EBADRQC: ErrnoObject = {
327
370
  Error: () => 'invalid request code',
328
371
  Is: (target: $.GoError) => target === EBADRQC,
329
372
  Errno: () => 56,
330
373
  }
331
374
 
332
- export const EBADSLT: Errno = {
375
+ export const EBADSLT: ErrnoObject = {
333
376
  Error: () => 'invalid slot',
334
377
  Is: (target: $.GoError) => target === EBADSLT,
335
378
  Errno: () => 57,
336
379
  }
337
380
 
338
- export const EDEADLOCK: Errno = EDEADLK // File locking deadlock error
381
+ export const EDEADLOCK: ErrnoObject = EDEADLK // File locking deadlock error
339
382
 
340
- export const EBFONT: Errno = {
383
+ export const EBFONT: ErrnoObject = {
341
384
  Error: () => 'bad font file fmt',
342
385
  Is: (target: $.GoError) => target === EBFONT,
343
386
  Errno: () => 59,
344
387
  }
345
388
 
346
- export const ENOSTR: Errno = {
389
+ export const ENOSTR: ErrnoObject = {
347
390
  Error: () => 'device not a stream',
348
391
  Is: (target: $.GoError) => target === ENOSTR,
349
392
  Errno: () => 60,
350
393
  }
351
394
 
352
- export const ENODATA: Errno = {
395
+ export const ENODATA: ErrnoObject = {
353
396
  Error: () => 'no data (for no delay io)',
354
397
  Is: (target: $.GoError) => target === ENODATA,
355
398
  Errno: () => 61,
356
399
  }
357
400
 
358
- export const ETIME: Errno = {
401
+ export const ETIME: ErrnoObject = {
359
402
  Error: () => 'timer expired',
360
403
  Is: (target: $.GoError) => target === ETIME,
361
404
  Errno: () => 62,
362
405
  }
363
406
 
364
- export const ENOSR: Errno = {
407
+ export const ENOSR: ErrnoObject = {
365
408
  Error: () => 'out of streams resources',
366
409
  Is: (target: $.GoError) => target === ENOSR,
367
410
  Errno: () => 63,
368
411
  }
369
412
 
370
- export const ENONET: Errno = {
413
+ export const ENONET: ErrnoObject = {
371
414
  Error: () => 'machine is not on the network',
372
415
  Is: (target: $.GoError) => target === ENONET,
373
416
  Errno: () => 64,
374
417
  }
375
418
 
376
- export const ENOPKG: Errno = {
419
+ export const ENOPKG: ErrnoObject = {
377
420
  Error: () => 'package not installed',
378
421
  Is: (target: $.GoError) => target === ENOPKG,
379
422
  Errno: () => 65,
380
423
  }
381
424
 
382
- export const EREMOTE: Errno = {
425
+ export const EREMOTE: ErrnoObject = {
383
426
  Error: () => 'the object is remote',
384
427
  Is: (target: $.GoError) => target === EREMOTE,
385
428
  Errno: () => 66,
386
429
  }
387
430
 
388
- export const ENOLINK: Errno = {
431
+ export const ENOLINK: ErrnoObject = {
389
432
  Error: () => 'the link has been severed',
390
433
  Is: (target: $.GoError) => target === ENOLINK,
391
434
  Errno: () => 67,
392
435
  }
393
436
 
394
- export const EADV: Errno = {
437
+ export const EADV: ErrnoObject = {
395
438
  Error: () => 'advertise error',
396
439
  Is: (target: $.GoError) => target === EADV,
397
440
  Errno: () => 68,
398
441
  }
399
442
 
400
- export const ESRMNT: Errno = {
443
+ export const ESRMNT: ErrnoObject = {
401
444
  Error: () => 'srmount error',
402
445
  Is: (target: $.GoError) => target === ESRMNT,
403
446
  Errno: () => 69,
404
447
  }
405
448
 
406
- export const ECOMM: Errno = {
449
+ export const ECOMM: ErrnoObject = {
407
450
  Error: () => 'communication error on send',
408
451
  Is: (target: $.GoError) => target === ECOMM,
409
452
  Errno: () => 70,
410
453
  }
411
454
 
412
- export const EPROTO: Errno = {
455
+ export const EPROTO: ErrnoObject = {
413
456
  Error: () => 'protocol error',
414
457
  Is: (target: $.GoError) => target === EPROTO,
415
458
  Errno: () => 71,
416
459
  }
417
460
 
418
- export const EMULTIHOP: Errno = {
461
+ export const EMULTIHOP: ErrnoObject = {
419
462
  Error: () => 'multihop attempted',
420
463
  Is: (target: $.GoError) => target === EMULTIHOP,
421
464
  Errno: () => 72,
422
465
  }
423
466
 
424
- export const EDOTDOT: Errno = {
467
+ export const EDOTDOT: ErrnoObject = {
425
468
  Error: () => 'cross mount point (not really error)',
426
469
  Is: (target: $.GoError) => target === EDOTDOT,
427
470
  Errno: () => 73,
428
471
  }
429
472
 
430
- export const EBADMSG: Errno = {
473
+ export const EBADMSG: ErrnoObject = {
431
474
  Error: () => 'trying to read unreadable message',
432
475
  Is: (target: $.GoError) => target === EBADMSG,
433
476
  Errno: () => 74,
434
477
  }
435
478
 
436
- export const EOVERFLOW: Errno = {
479
+ export const EOVERFLOW: ErrnoObject = {
437
480
  Error: () => 'value too large for defined data type',
438
481
  Is: (target: $.GoError) => target === EOVERFLOW,
439
482
  Errno: () => 75,
440
483
  }
441
484
 
442
- export const ENOTUNIQ: Errno = {
485
+ export const ENOTUNIQ: ErrnoObject = {
443
486
  Error: () => 'given log. name not unique',
444
487
  Is: (target: $.GoError) => target === ENOTUNIQ,
445
488
  Errno: () => 76,
446
489
  }
447
490
 
448
- export const EBADFD: Errno = {
491
+ export const EBADFD: ErrnoObject = {
449
492
  Error: () => 'f.d. invalid for this operation',
450
493
  Is: (target: $.GoError) => target === EBADFD,
451
494
  Errno: () => 77,
452
495
  }
453
496
 
454
- export const EREMCHG: Errno = {
497
+ export const EREMCHG: ErrnoObject = {
455
498
  Error: () => 'remote address changed',
456
499
  Is: (target: $.GoError) => target === EREMCHG,
457
500
  Errno: () => 78,
458
501
  }
459
502
 
460
- export const ELIBACC: Errno = {
503
+ export const ELIBACC: ErrnoObject = {
461
504
  Error: () => "can't access a needed shared lib",
462
505
  Is: (target: $.GoError) => target === ELIBACC,
463
506
  Errno: () => 79,
464
507
  }
465
508
 
466
- export const ELIBBAD: Errno = {
509
+ export const ELIBBAD: ErrnoObject = {
467
510
  Error: () => 'accessing a corrupted shared lib',
468
511
  Is: (target: $.GoError) => target === ELIBBAD,
469
512
  Errno: () => 80,
470
513
  }
471
514
 
472
- export const ELIBSCN: Errno = {
515
+ export const ELIBSCN: ErrnoObject = {
473
516
  Error: () => '.lib section in a.out corrupted',
474
517
  Is: (target: $.GoError) => target === ELIBSCN,
475
518
  Errno: () => 81,
476
519
  }
477
520
 
478
- export const ELIBMAX: Errno = {
521
+ export const ELIBMAX: ErrnoObject = {
479
522
  Error: () => 'attempting to link in too many libs',
480
523
  Is: (target: $.GoError) => target === ELIBMAX,
481
524
  Errno: () => 82,
482
525
  }
483
526
 
484
- export const ELIBEXEC: Errno = {
527
+ export const ELIBEXEC: ErrnoObject = {
485
528
  Error: () => 'attempting to exec a shared library',
486
529
  Is: (target: $.GoError) => target === ELIBEXEC,
487
530
  Errno: () => 83,
488
531
  }
489
532
 
490
- export const EILSEQ: Errno = {
533
+ export const EILSEQ: ErrnoObject = {
491
534
  Error: () => 'illegal byte sequence',
492
535
  Is: (target: $.GoError) => target === EILSEQ,
493
536
  Errno: () => 84,
494
537
  }
495
538
 
496
- export const EUSERS: Errno = {
539
+ export const EUSERS: ErrnoObject = {
497
540
  Error: () => 'too many users',
498
541
  Is: (target: $.GoError) => target === EUSERS,
499
542
  Errno: () => 87,
500
543
  }
501
544
 
502
- export const ENOTSOCK: Errno = {
545
+ export const ENOTSOCK: ErrnoObject = {
503
546
  Error: () => 'socket operation on non-socket',
504
547
  Is: (target: $.GoError) => target === ENOTSOCK,
505
548
  Errno: () => 88,
506
549
  }
507
550
 
508
- export const EDESTADDRREQ: Errno = {
551
+ export const EDESTADDRREQ: ErrnoObject = {
509
552
  Error: () => 'destination address required',
510
553
  Is: (target: $.GoError) => target === EDESTADDRREQ,
511
554
  Errno: () => 89,
512
555
  }
513
556
 
514
- export const EMSGSIZE: Errno = {
557
+ export const EMSGSIZE: ErrnoObject = {
515
558
  Error: () => 'message too long',
516
559
  Is: (target: $.GoError) => target === EMSGSIZE,
517
560
  Errno: () => 90,
518
561
  }
519
562
 
520
- export const EPROTOTYPE: Errno = {
563
+ export const EPROTOTYPE: ErrnoObject = {
521
564
  Error: () => 'protocol wrong type for socket',
522
565
  Is: (target: $.GoError) => target === EPROTOTYPE,
523
566
  Errno: () => 91,
524
567
  }
525
568
 
526
- export const ENOPROTOOPT: Errno = {
569
+ export const ENOPROTOOPT: ErrnoObject = {
527
570
  Error: () => 'protocol not available',
528
571
  Is: (target: $.GoError) => target === ENOPROTOOPT,
529
572
  Errno: () => 92,
530
573
  }
531
574
 
532
- export const EPROTONOSUPPORT: Errno = {
575
+ export const EPROTONOSUPPORT: ErrnoObject = {
533
576
  Error: () => 'unknown protocol',
534
577
  Is: (target: $.GoError) => target === EPROTONOSUPPORT,
535
578
  Errno: () => 93,
536
579
  }
537
580
 
538
- export const ESOCKTNOSUPPORT: Errno = {
581
+ export const ESOCKTNOSUPPORT: ErrnoObject = {
539
582
  Error: () => 'socket type not supported',
540
583
  Is: (target: $.GoError) => target === ESOCKTNOSUPPORT,
541
584
  Errno: () => 94,
542
585
  }
543
586
 
544
- export const EOPNOTSUPP: Errno = {
587
+ export const EOPNOTSUPP: ErrnoObject = {
545
588
  Error: () => 'operation not supported on transport endpoint',
546
589
  Is: (target: $.GoError) => target === EOPNOTSUPP,
547
590
  Errno: () => 95,
548
591
  }
549
592
 
550
- export const EPFNOSUPPORT: Errno = {
593
+ export const EPFNOSUPPORT: ErrnoObject = {
551
594
  Error: () => 'protocol family not supported',
552
595
  Is: (target: $.GoError) => target === EPFNOSUPPORT,
553
596
  Errno: () => 96,
554
597
  }
555
598
 
556
- export const EAFNOSUPPORT: Errno = {
599
+ export const EAFNOSUPPORT: ErrnoObject = {
557
600
  Error: () => 'address family not supported by protocol family',
558
601
  Is: (target: $.GoError) => target === EAFNOSUPPORT,
559
602
  Errno: () => 97,
560
603
  }
561
604
 
562
- export const EADDRINUSE: Errno = {
605
+ export const EADDRINUSE: ErrnoObject = {
563
606
  Error: () => 'address already in use',
564
607
  Is: (target: $.GoError) => target === EADDRINUSE,
565
608
  Errno: () => 98,
566
609
  }
567
610
 
568
- export const EADDRNOTAVAIL: Errno = {
611
+ export const EADDRNOTAVAIL: ErrnoObject = {
569
612
  Error: () => 'address not available',
570
613
  Is: (target: $.GoError) => target === EADDRNOTAVAIL,
571
614
  Errno: () => 99,
572
615
  }
573
616
 
574
- export const ENETDOWN: Errno = {
617
+ export const ENETDOWN: ErrnoObject = {
575
618
  Error: () => 'network interface is not configured',
576
619
  Is: (target: $.GoError) => target === ENETDOWN,
577
620
  Errno: () => 100,
578
621
  }
579
622
 
580
- export const ENETUNREACH: Errno = {
623
+ export const ENETUNREACH: ErrnoObject = {
581
624
  Error: () => 'network is unreachable',
582
625
  Is: (target: $.GoError) => target === ENETUNREACH,
583
626
  Errno: () => 101,
584
627
  }
585
628
 
586
- export const ENETRESET: Errno = {
629
+ export const ENETRESET: ErrnoObject = {
587
630
  Error: () => 'network dropped connection because of reset',
588
631
  Is: (target: $.GoError) => target === ENETRESET,
589
632
  Errno: () => 102,
590
633
  }
591
634
 
592
- export const ECONNABORTED: Errno = {
635
+ export const ECONNABORTED: ErrnoObject = {
593
636
  Error: () => 'connection aborted',
594
637
  Is: (target: $.GoError) => target === ECONNABORTED,
595
638
  Errno: () => 103,
596
639
  }
597
640
 
598
- export const ECONNRESET: Errno = {
641
+ export const ECONNRESET: ErrnoObject = {
599
642
  Error: () => 'connection reset by peer',
600
643
  Is: (target: $.GoError) => target === ECONNRESET,
601
644
  Errno: () => 104,
602
645
  }
603
646
 
604
- export const ENOBUFS: Errno = {
647
+ export const ENOBUFS: ErrnoObject = {
605
648
  Error: () => 'no buffer space available',
606
649
  Is: (target: $.GoError) => target === ENOBUFS,
607
650
  Errno: () => 105,
608
651
  }
609
652
 
610
- export const EISCONN: Errno = {
653
+ export const EISCONN: ErrnoObject = {
611
654
  Error: () => 'socket is already connected',
612
655
  Is: (target: $.GoError) => target === EISCONN,
613
656
  Errno: () => 106,
614
657
  }
615
658
 
616
- export const ENOTCONN: Errno = {
659
+ export const ENOTCONN: ErrnoObject = {
617
660
  Error: () => 'socket is not connected',
618
661
  Is: (target: $.GoError) => target === ENOTCONN,
619
662
  Errno: () => 107,
620
663
  }
621
664
 
622
- export const ESHUTDOWN: Errno = {
665
+ export const ESHUTDOWN: ErrnoObject = {
623
666
  Error: () => "can't send after socket shutdown",
624
667
  Is: (target: $.GoError) => target === ESHUTDOWN,
625
668
  Errno: () => 108,
626
669
  }
627
670
 
628
- export const ETOOMANYREFS: Errno = {
671
+ export const ETOOMANYREFS: ErrnoObject = {
629
672
  Error: () => 'too many references: cannot splice',
630
673
  Is: (target: $.GoError) => target === ETOOMANYREFS,
631
674
  Errno: () => 109,
632
675
  }
633
676
 
634
- export const ETIMEDOUT: Errno = {
677
+ export const ETIMEDOUT: ErrnoObject = {
635
678
  Error: () => 'connection timed out',
636
679
  Is: (target: $.GoError) => target === ETIMEDOUT,
637
680
  Errno: () => 110,
638
681
  }
639
682
 
640
- export const ECONNREFUSED: Errno = {
683
+ export const ECONNREFUSED: ErrnoObject = {
641
684
  Error: () => 'connection refused',
642
685
  Is: (target: $.GoError) => target === ECONNREFUSED,
643
686
  Errno: () => 111,
644
687
  }
645
688
 
646
- export const EHOSTDOWN: Errno = {
689
+ export const EHOSTDOWN: ErrnoObject = {
647
690
  Error: () => 'host is down',
648
691
  Is: (target: $.GoError) => target === EHOSTDOWN,
649
692
  Errno: () => 112,
650
693
  }
651
694
 
652
- export const EHOSTUNREACH: Errno = {
695
+ export const EHOSTUNREACH: ErrnoObject = {
653
696
  Error: () => 'host is unreachable',
654
697
  Is: (target: $.GoError) => target === EHOSTUNREACH,
655
698
  Errno: () => 113,
656
699
  }
657
700
 
658
- export const EALREADY: Errno = {
701
+ export const EALREADY: ErrnoObject = {
659
702
  Error: () => 'socket already connected',
660
703
  Is: (target: $.GoError) => target === EALREADY,
661
704
  Errno: () => 114,
662
705
  }
663
706
 
664
- export const EDQUOT: Errno = {
707
+ export const EDQUOT: ErrnoObject = {
665
708
  Error: () => 'quota exceeded',
666
709
  Is: (target: $.GoError) => target === EDQUOT,
667
710
  Errno: () => 122,