gofront 1.7.0 → 1.8.0

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 (128) hide show
  1. package/README.md +13 -13
  2. package/package.json +8 -37
  3. package/src/backend/js/expressions.js +1341 -148
  4. package/src/backend/js/fmt-runtime.js +573 -0
  5. package/src/backend/js/index.js +375 -57
  6. package/src/backend/js/runtime.js +1460 -133
  7. package/src/backend/js/statements.js +900 -86
  8. package/src/backend/js/stdlib/bits.js +87 -14
  9. package/src/backend/js/stdlib/builder.js +41 -6
  10. package/src/backend/js/stdlib/bytes.js +253 -7
  11. package/src/backend/js/stdlib/errors.js +2 -1
  12. package/src/backend/js/stdlib/fmt.js +349 -10
  13. package/src/backend/js/stdlib/index.js +8 -3
  14. package/src/backend/js/stdlib/json.js +247 -52
  15. package/src/backend/js/stdlib/maps.js +0 -8
  16. package/src/backend/js/stdlib/math.js +17 -1
  17. package/src/backend/js/stdlib/simd.js +10 -0
  18. package/src/backend/js/stdlib/slices.js +36 -6
  19. package/src/backend/js/stdlib/strconv.js +10 -5
  20. package/src/backend/js/stdlib/strings.js +83 -4
  21. package/src/backend/js/stdlib/testing.js +7 -0
  22. package/src/backend/js/stdlib/time.js +79 -55
  23. package/src/backend/js/stdlib/unicode.js +1 -1
  24. package/src/backend/js/stdlib/utf8.js +1 -1
  25. package/src/backend/js/templ.js +38 -76
  26. package/src/backend/js/type-info.js +272 -0
  27. package/src/backend/shared/fmt-types.js +188 -0
  28. package/src/backend/wasm/boundary.js +436 -80
  29. package/src/backend/wasm/emit-builtins.js +303 -13
  30. package/src/backend/wasm/emit-exprs.js +1397 -203
  31. package/src/backend/wasm/emit-maps.js +61 -13
  32. package/src/backend/wasm/emit-stmts.js +1359 -164
  33. package/src/backend/wasm/emit.js +512 -77
  34. package/src/backend/wasm/encode.js +43 -13
  35. package/src/backend/wasm/globals.js +452 -0
  36. package/src/backend/wasm/index.js +194 -2489
  37. package/src/backend/wasm/method-expr.js +381 -0
  38. package/src/backend/wasm/module-emitter.js +2240 -0
  39. package/src/backend/wasm/monomorph.js +62 -4
  40. package/src/backend/wasm/prescan.js +397 -0
  41. package/src/backend/wasm/stdlib/bytes.js +1804 -127
  42. package/src/backend/wasm/stdlib/core.js +1574 -199
  43. package/src/backend/wasm/stdlib/index.js +0 -5
  44. package/src/backend/wasm/stdlib/io.js +1567 -150
  45. package/src/backend/wasm/stdlib/packages.js +2 -0
  46. package/src/backend/wasm/stdlib/simd.js +293 -28
  47. package/src/backend/wasm/stdlib/time.js +1041 -12
  48. package/src/backend/wasm/types.js +200 -15
  49. package/src/backend/wasm/variadic.js +93 -0
  50. package/src/backend/wasm/wat.js +47 -20
  51. package/src/{cli-core.js → cli/cli-core.js} +236 -10
  52. package/src/{test-runner.js → cli/test-runner.js} +332 -39
  53. package/src/{vendor.js → cli/vendor.js} +3 -4
  54. package/src/compiler.js +107 -269
  55. package/src/index.js +15 -169
  56. package/src/{lexer.js → lexer/lexer.js} +102 -55
  57. package/src/{tokens.js → lexer/tokens.js} +1 -0
  58. package/src/link/sourcemap.js +97 -0
  59. package/src/link/stdlib.js +515 -0
  60. package/src/link/wasm.js +294 -0
  61. package/src/lower/bounds.js +394 -0
  62. package/src/lower/boxing.js +1 -1
  63. package/src/lower/captures.js +176 -32
  64. package/src/lower/index.js +26 -18
  65. package/src/lower/json-codecs.js +1398 -0
  66. package/src/lower/ownership.js +22 -1
  67. package/src/lower/range.js +86 -1
  68. package/src/lower/reachability.js +132 -0
  69. package/src/parser/declarations.js +58 -13
  70. package/src/parser/expressions.js +29 -7
  71. package/src/parser/index.js +2 -1
  72. package/src/parser/statements.js +37 -22
  73. package/src/{templ-parser.js → parser/templ.js} +138 -15
  74. package/src/parser/types.js +69 -9
  75. package/src/resolver.js +22 -1
  76. package/src/typechecker/assignability.js +176 -17
  77. package/src/typechecker/const-fold.js +356 -0
  78. package/src/typechecker/constants.js +256 -0
  79. package/src/typechecker/expressions.js +931 -122
  80. package/src/typechecker/index.js +459 -67
  81. package/src/typechecker/init-order.js +330 -0
  82. package/src/typechecker/resolve.js +451 -56
  83. package/src/typechecker/statements.js +90 -9
  84. package/src/typechecker/stdlib/core.js +333 -55
  85. package/src/typechecker/stdlib/excluded.js +898 -0
  86. package/src/typechecker/stdlib/extended.js +322 -26
  87. package/src/typechecker/{stdlib.js → stdlib/index.js} +5 -5
  88. package/src/typechecker/stdlib/simd.js +65 -15
  89. package/src/typechecker/termination.js +1 -1
  90. package/src/typechecker/types.js +149 -25
  91. package/stdlib/bytes/iter.go +192 -0
  92. package/stdlib/bytes/search.go +240 -0
  93. package/stdlib/bytes/split.go +218 -0
  94. package/stdlib/cmp/cmp.go +65 -0
  95. package/stdlib/encoding/json/errors.go +31 -0
  96. package/stdlib/encoding/json/indent.go +71 -0
  97. package/stdlib/encoding/json/number.go +12 -0
  98. package/stdlib/encoding/json/stream.go +173 -0
  99. package/stdlib/errors/overlay.go +12 -0
  100. package/stdlib/hash/hash.go +53 -0
  101. package/stdlib/internal/jsonrt/dec.go +738 -0
  102. package/stdlib/internal/jsonrt/enc.go +366 -0
  103. package/stdlib/internal/jsonrt/indent.go +135 -0
  104. package/stdlib/internal/jsonrt/number.go +27 -0
  105. package/stdlib/internal/jsonrt/reader.go +73 -0
  106. package/stdlib/internal/jsonrt/scanner.go +649 -0
  107. package/stdlib/io/io.go +346 -0
  108. package/stdlib/iter/iter.go +18 -0
  109. package/stdlib/maps/iter.go +65 -0
  110. package/stdlib/math/extra.go +270 -0
  111. package/stdlib/slices/extra.go +73 -0
  112. package/stdlib/slices/iter.go +113 -0
  113. package/stdlib/sort/sort.go +561 -0
  114. package/stdlib/strconv/quote.go +341 -0
  115. package/stdlib/strings/extra.go +35 -0
  116. package/stdlib/strings/iter.go +122 -0
  117. package/stdlib/sync/extra.go +105 -0
  118. package/stdlib/unicode/unicode.go +112 -0
  119. package/stdlib/unicode/utf8/bytes.go +239 -0
  120. package/src/backend/wasm/const-fold.js +0 -205
  121. package/src/backend/wasm/emit-stdlib.js +0 -13
  122. /package/src/{asset-manager.js → cli/asset-manager.js} +0 -0
  123. /package/src/{colors.js → cli/colors.js} +0 -0
  124. /package/src/{dev-server.js → cli/dev-server.js} +0 -0
  125. /package/src/{minifier.js → cli/minifier.js} +0 -0
  126. /package/src/{project-config.js → cli/project-config.js} +0 -0
  127. /package/src/{pwa.js → cli/pwa.js} +0 -0
  128. /package/src/{templ-lexer.js → lexer/templ-lexer.js} +0 -0
@@ -0,0 +1,898 @@
1
+ // src/typechecker/stdlib/excluded.js
2
+ // Stdlib packages and members that get a targeted diagnostic with a reason
3
+ // instead of the generic `No member` error. Hand-maintained.
4
+
5
+ const pkgIdent = (pkg) =>
6
+ pkg
7
+ .split("/")
8
+ .filter((s) => !/^v\d+$/.test(s))
9
+ .at(-1);
10
+
11
+ // reason -> excluded package paths
12
+ const EXCLUDED_PACKAGE_GROUPS = {
13
+ deferred: [
14
+ "archive/tar",
15
+ "archive/zip",
16
+ "compress/bzip2",
17
+ "compress/flate",
18
+ "compress/gzip",
19
+ "compress/lzw",
20
+ "compress/zlib",
21
+ "crypto",
22
+ "crypto/aes",
23
+ "crypto/cipher",
24
+ "crypto/des",
25
+ "crypto/dsa",
26
+ "crypto/ecdh",
27
+ "crypto/ecdsa",
28
+ "crypto/ed25519",
29
+ "crypto/elliptic",
30
+ "crypto/fips140",
31
+ "crypto/hkdf",
32
+ "crypto/hpke",
33
+ "crypto/mlkem",
34
+ "crypto/mlkem/mlkemtest",
35
+ "crypto/pbkdf2",
36
+ "crypto/rc4",
37
+ "crypto/rsa",
38
+ "crypto/sha3",
39
+ "crypto/tls",
40
+ "crypto/x509",
41
+ "crypto/x509/pkix",
42
+ "debug/buildinfo",
43
+ "debug/dwarf",
44
+ "debug/elf",
45
+ "debug/gosym",
46
+ "debug/macho",
47
+ "debug/pe",
48
+ "debug/plan9obj",
49
+ "embed",
50
+ "encoding",
51
+ "encoding/ascii85",
52
+ "encoding/asn1",
53
+ "encoding/pem",
54
+ "go/ast",
55
+ "go/build",
56
+ "go/build/constraint",
57
+ "go/constant",
58
+ "go/doc",
59
+ "go/doc/comment",
60
+ "go/format",
61
+ "go/importer",
62
+ "go/parser",
63
+ "go/printer",
64
+ "go/scanner",
65
+ "go/token",
66
+ "go/types",
67
+ "go/version",
68
+ "hash/crc64",
69
+ "hash/maphash",
70
+ "image",
71
+ "image/color",
72
+ "image/color/palette",
73
+ "image/draw",
74
+ "image/gif",
75
+ "image/jpeg",
76
+ "image/png",
77
+ "index/suffixarray",
78
+ "log/slog",
79
+ "math/big",
80
+ "mime",
81
+ "mime/quotedprintable",
82
+ "net/mail",
83
+ "net/netip",
84
+ "regexp/syntax",
85
+ "testing/cryptotest",
86
+ "testing/iotest",
87
+ "testing/slogtest",
88
+ "text/scanner",
89
+ "text/tabwriter",
90
+ "text/template/parse",
91
+ ],
92
+ host: [
93
+ "database/sql",
94
+ "database/sql/driver",
95
+ "expvar",
96
+ "io/fs",
97
+ "io/ioutil",
98
+ "log/syslog",
99
+ "mime/multipart",
100
+ "net",
101
+ "net/http",
102
+ "net/http/cgi",
103
+ "net/http/cookiejar",
104
+ "net/http/fcgi",
105
+ "net/http/httptest",
106
+ "net/http/httptrace",
107
+ "net/http/httputil",
108
+ "net/http/pprof",
109
+ "net/rpc",
110
+ "net/rpc/jsonrpc",
111
+ "net/smtp",
112
+ "net/textproto",
113
+ "os/exec",
114
+ "os/signal",
115
+ "os/user",
116
+ "syscall",
117
+ "testing/fstest",
118
+ ],
119
+ reflection: [
120
+ "encoding/gob",
121
+ "encoding/xml",
122
+ "flag",
123
+ "html/template",
124
+ "testing/quick",
125
+ "text/template",
126
+ ],
127
+ runtime: [
128
+ "plugin",
129
+ "reflect",
130
+ "runtime",
131
+ "runtime/cgo",
132
+ "runtime/coverage",
133
+ "runtime/debug",
134
+ "runtime/metrics",
135
+ "runtime/pprof",
136
+ "runtime/trace",
137
+ "structs",
138
+ "testing/synctest",
139
+ "unique",
140
+ "unsafe",
141
+ "weak",
142
+ ],
143
+ };
144
+
145
+ const PACKAGE_GROUP_REASONS = {
146
+ deferred: "deferred; open an issue if you need it",
147
+ host: "needs host services (network, processes, signals or files) that GoFront does not provide",
148
+ reflection: "needs runtime reflection, which GoFront does not have",
149
+ runtime:
150
+ "needs the Go runtime (scheduler, reflection or raw memory), which GoFront does not have",
151
+ };
152
+
153
+ const TRIMMED_UNICODE_TABLES =
154
+ "removed in v1.8.0; range tables are not supported";
155
+ const TRIMMED_UNICODE_CASE =
156
+ "removed in v1.8.0; case ranges are not supported, use ToUpper, ToLower or ToTitle";
157
+ const TRIMMED_FSCAN =
158
+ "removed in v1.8.0; scanning from an io.Reader is not supported, use fmt.Sscan on the text";
159
+
160
+ // reason -> package path -> excluded member names
161
+ const EXCLUDED_MEMBER_GROUPS = {
162
+ [TRIMMED_UNICODE_TABLES]: {
163
+ unicode: [
164
+ "Is",
165
+ "In",
166
+ "IsOneOf",
167
+ "IsMark",
168
+ "IsNumber",
169
+ "IsSymbol",
170
+ "IsTitle",
171
+ "RangeTable",
172
+ "Range16",
173
+ "Range32",
174
+ "Letter",
175
+ "Digit",
176
+ "Space",
177
+ "Upper",
178
+ "Lower",
179
+ "Punct",
180
+ "Symbol",
181
+ "Mark",
182
+ "Number",
183
+ ],
184
+ },
185
+ [TRIMMED_UNICODE_CASE]: {
186
+ unicode: ["To", "UpperCase", "LowerCase", "TitleCase", "MaxCase"],
187
+ },
188
+ [TRIMMED_FSCAN]: {
189
+ fmt: ["Fscan", "Fscanf", "Fscanln"],
190
+ },
191
+ "removed in v1.8.0; this function is not supported": {
192
+ math: ["Gamma", "Erf"],
193
+ },
194
+ "removed in v1.8.0; not supported, use a plain struct or map": {
195
+ sync: ["Pool", "Map"],
196
+ },
197
+ "removed in v1.8.0; graphic quoting is not supported, use Quote or QuoteToASCII":
198
+ {
199
+ strconv: [
200
+ "QuoteToGraphic",
201
+ "QuoteRuneToGraphic",
202
+ "AppendQuoteToGraphic",
203
+ "AppendQuoteRuneToGraphic",
204
+ ],
205
+ },
206
+ "needs math/big": {
207
+ "crypto/rand": ["Int", "Prime"],
208
+ },
209
+ "a pipe blocks until the other side reads": {
210
+ io: [
211
+ "ErrClosedPipe",
212
+ "Pipe",
213
+ "PipeReader",
214
+ "PipeReader.Close",
215
+ "PipeReader.CloseWithError",
216
+ "PipeReader.Read",
217
+ "PipeWriter",
218
+ "PipeWriter.Close",
219
+ "PipeWriter.CloseWithError",
220
+ "PipeWriter.Write",
221
+ ],
222
+ },
223
+ "requires coroutines; out of scope (no runtime)": {
224
+ iter: ["Pull", "Pull2"],
225
+ },
226
+ "files, processes and signals": {
227
+ os: [
228
+ "Chdir",
229
+ "Chmod",
230
+ "Chown",
231
+ "Chtimes",
232
+ "Clearenv",
233
+ "CopyFS",
234
+ "Create",
235
+ "CreateTemp",
236
+ "DevNull",
237
+ "DirEntry",
238
+ "DirFS",
239
+ "Environ",
240
+ "ErrClosed",
241
+ "ErrDeadlineExceeded",
242
+ "ErrExist",
243
+ "ErrInvalid",
244
+ "ErrNoDeadline",
245
+ "ErrNoHandle",
246
+ "ErrNotExist",
247
+ "ErrPermission",
248
+ "ErrProcessDone",
249
+ "Executable",
250
+ "Expand",
251
+ "ExpandEnv",
252
+ "File.Chdir",
253
+ "File.Chmod",
254
+ "File.Chown",
255
+ "File.Close",
256
+ "File.Fd",
257
+ "File.Name",
258
+ "File.ReadAt",
259
+ "File.Readdir",
260
+ "File.ReadDir",
261
+ "File.Readdirnames",
262
+ "File.ReadFrom",
263
+ "File.Seek",
264
+ "File.SetDeadline",
265
+ "File.SetReadDeadline",
266
+ "File.SetWriteDeadline",
267
+ "File.Stat",
268
+ "File.Sync",
269
+ "File.SyscallConn",
270
+ "File.Truncate",
271
+ "File.WriteAt",
272
+ "File.WriteTo",
273
+ "FileInfo",
274
+ "FileMode",
275
+ "FindProcess",
276
+ "Getegid",
277
+ "Geteuid",
278
+ "Getgid",
279
+ "Getgroups",
280
+ "Getpagesize",
281
+ "Getpid",
282
+ "Getppid",
283
+ "Getuid",
284
+ "Getwd",
285
+ "Hostname",
286
+ "Interrupt",
287
+ "IsExist",
288
+ "IsNotExist",
289
+ "IsPathSeparator",
290
+ "IsPermission",
291
+ "IsTimeout",
292
+ "Kill",
293
+ "Lchown",
294
+ "Link",
295
+ "LinkError",
296
+ "LinkError.Err",
297
+ "LinkError.Error",
298
+ "LinkError.New",
299
+ "LinkError.Old",
300
+ "LinkError.Op",
301
+ "LinkError.Unwrap",
302
+ "LookupEnv",
303
+ "Lstat",
304
+ "Mkdir",
305
+ "MkdirAll",
306
+ "MkdirTemp",
307
+ "ModeAppend",
308
+ "ModeCharDevice",
309
+ "ModeDevice",
310
+ "ModeDir",
311
+ "ModeExclusive",
312
+ "ModeIrregular",
313
+ "ModeNamedPipe",
314
+ "ModePerm",
315
+ "ModeSetgid",
316
+ "ModeSetuid",
317
+ "ModeSocket",
318
+ "ModeSticky",
319
+ "ModeSymlink",
320
+ "ModeTemporary",
321
+ "ModeType",
322
+ "NewFile",
323
+ "NewSyscallError",
324
+ "O_APPEND",
325
+ "O_CREATE",
326
+ "O_EXCL",
327
+ "O_RDONLY",
328
+ "O_RDWR",
329
+ "O_SYNC",
330
+ "O_TRUNC",
331
+ "O_WRONLY",
332
+ "Open",
333
+ "OpenFile",
334
+ "OpenInRoot",
335
+ "OpenRoot",
336
+ "PathError",
337
+ "PathListSeparator",
338
+ "PathSeparator",
339
+ "Pipe",
340
+ "ProcAttr",
341
+ "ProcAttr.Dir",
342
+ "ProcAttr.Env",
343
+ "ProcAttr.Files",
344
+ "ProcAttr.Sys",
345
+ "Process",
346
+ "Process.Kill",
347
+ "Process.Pid",
348
+ "Process.Release",
349
+ "Process.Signal",
350
+ "Process.Wait",
351
+ "Process.WithHandle",
352
+ "ProcessState",
353
+ "ProcessState.ExitCode",
354
+ "ProcessState.Exited",
355
+ "ProcessState.Pid",
356
+ "ProcessState.String",
357
+ "ProcessState.Success",
358
+ "ProcessState.Sys",
359
+ "ProcessState.SystemTime",
360
+ "ProcessState.SysUsage",
361
+ "ProcessState.UserTime",
362
+ "ReadDir",
363
+ "ReadFile",
364
+ "Readlink",
365
+ "Remove",
366
+ "RemoveAll",
367
+ "Rename",
368
+ "Root",
369
+ "Root.Chmod",
370
+ "Root.Chown",
371
+ "Root.Chtimes",
372
+ "Root.Close",
373
+ "Root.Create",
374
+ "Root.FS",
375
+ "Root.Lchown",
376
+ "Root.Link",
377
+ "Root.Lstat",
378
+ "Root.Mkdir",
379
+ "Root.MkdirAll",
380
+ "Root.Name",
381
+ "Root.Open",
382
+ "Root.OpenFile",
383
+ "Root.OpenRoot",
384
+ "Root.ReadFile",
385
+ "Root.Readlink",
386
+ "Root.Remove",
387
+ "Root.RemoveAll",
388
+ "Root.Rename",
389
+ "Root.Stat",
390
+ "Root.Symlink",
391
+ "Root.WriteFile",
392
+ "SameFile",
393
+ "SEEK_CUR",
394
+ "SEEK_END",
395
+ "SEEK_SET",
396
+ "Setenv",
397
+ "Signal",
398
+ "Signal.Signal",
399
+ "Signal.String",
400
+ "StartProcess",
401
+ "Stat",
402
+ "Symlink",
403
+ "SyscallError",
404
+ "SyscallError.Err",
405
+ "SyscallError.Error",
406
+ "SyscallError.Syscall",
407
+ "SyscallError.Timeout",
408
+ "SyscallError.Unwrap",
409
+ "TempDir",
410
+ "Truncate",
411
+ "Unsetenv",
412
+ "UserCacheDir",
413
+ "UserConfigDir",
414
+ "UserHomeDir",
415
+ "WriteFile",
416
+ ],
417
+ },
418
+ "file system": {
419
+ "path/filepath": [
420
+ "Abs",
421
+ "EvalSymlinks",
422
+ "Glob",
423
+ "SkipAll",
424
+ "SkipDir",
425
+ "Walk",
426
+ "WalkDir",
427
+ "WalkFunc",
428
+ ],
429
+ testing: [
430
+ "B.ArtifactDir",
431
+ "B.Chdir",
432
+ "B.TempDir",
433
+ "T.ArtifactDir",
434
+ "T.Chdir",
435
+ "T.TempDir",
436
+ "TB.ArtifactDir",
437
+ "TB.Chdir",
438
+ "TB.TempDir",
439
+ ],
440
+ },
441
+ "blocking wait": {
442
+ sync: [
443
+ "Cond",
444
+ "Cond.Broadcast",
445
+ "Cond.L",
446
+ "Cond.Signal",
447
+ "Cond.Wait",
448
+ "NewCond",
449
+ ],
450
+ },
451
+ "starts a goroutine": {
452
+ sync: ["WaitGroup.Go"],
453
+ },
454
+ "allocation counters": {
455
+ testing: ["AllocsPerRun"],
456
+ },
457
+ goroutines: {
458
+ testing: ["B.RunParallel", "B.SetParallelism", "PB", "PB.Next"],
459
+ },
460
+ "go test driver internals": {
461
+ testing: [
462
+ "Cover",
463
+ "Cover.Blocks",
464
+ "Cover.Counters",
465
+ "Cover.CoveredPackages",
466
+ "Cover.Mode",
467
+ "Coverage",
468
+ "CoverBlock",
469
+ "CoverBlock.Col0",
470
+ "CoverBlock.Col1",
471
+ "CoverBlock.Line0",
472
+ "CoverBlock.Line1",
473
+ "CoverBlock.Stmts",
474
+ "CoverMode",
475
+ "InternalBenchmark",
476
+ "InternalBenchmark.F",
477
+ "InternalBenchmark.Name",
478
+ "InternalExample",
479
+ "InternalExample.F",
480
+ "InternalExample.Name",
481
+ "InternalExample.Output",
482
+ "InternalExample.Unordered",
483
+ "InternalTest",
484
+ "InternalTest.F",
485
+ "InternalTest.Name",
486
+ "Main",
487
+ "MainStart",
488
+ "RunBenchmarks",
489
+ "RunExamples",
490
+ "RunTests",
491
+ ],
492
+ },
493
+ fuzzing: {
494
+ testing: [
495
+ "F",
496
+ "F.Add",
497
+ "F.ArtifactDir",
498
+ "F.Attr",
499
+ "F.Chdir",
500
+ "F.Cleanup",
501
+ "F.Context",
502
+ "F.Error",
503
+ "F.Errorf",
504
+ "F.Fail",
505
+ "F.Failed",
506
+ "F.FailNow",
507
+ "F.Fatal",
508
+ "F.Fatalf",
509
+ "F.Fuzz",
510
+ "F.Helper",
511
+ "F.Log",
512
+ "F.Logf",
513
+ "F.Name",
514
+ "F.Output",
515
+ "F.Setenv",
516
+ "F.Skip",
517
+ "F.Skipf",
518
+ "F.SkipNow",
519
+ "F.Skipped",
520
+ "F.TempDir",
521
+ "InternalFuzzTarget",
522
+ "InternalFuzzTarget.Fn",
523
+ "InternalFuzzTarget.Name",
524
+ ],
525
+ },
526
+ channels: {
527
+ time: [
528
+ "After",
529
+ "NewTicker",
530
+ "NewTimer",
531
+ "Tick",
532
+ "Ticker",
533
+ "Ticker.C",
534
+ "Ticker.Reset",
535
+ "Ticker.Stop",
536
+ "Timer.C",
537
+ ],
538
+ },
539
+ "tz database": {
540
+ time: ["LoadLocation"],
541
+ },
542
+ "tz database parser (code size)": {
543
+ time: ["LoadLocationFromTZData"],
544
+ },
545
+ "Unicode table size": {
546
+ unicode: [
547
+ "Adlam",
548
+ "Ahom",
549
+ "Anatolian_Hieroglyphs",
550
+ "Arabic",
551
+ "Armenian",
552
+ "ASCII_Hex_Digit",
553
+ "Avestan",
554
+ "AzeriCase",
555
+ "Balinese",
556
+ "Bamum",
557
+ "Bassa_Vah",
558
+ "Batak",
559
+ "Bengali",
560
+ "Bhaiksuki",
561
+ "Bidi_Control",
562
+ "Bopomofo",
563
+ "Brahmi",
564
+ "Braille",
565
+ "Buginese",
566
+ "Buhid",
567
+ "C",
568
+ "Canadian_Aboriginal",
569
+ "Carian",
570
+ "CaseRange",
571
+ "CaseRange.Delta",
572
+ "CaseRange.Hi",
573
+ "CaseRange.Lo",
574
+ "CaseRanges",
575
+ "Categories",
576
+ "CategoryAliases",
577
+ "Caucasian_Albanian",
578
+ "Cc",
579
+ "Cf",
580
+ "Chakma",
581
+ "Cham",
582
+ "Cherokee",
583
+ "Chorasmian",
584
+ "Cn",
585
+ "Co",
586
+ "Common",
587
+ "Coptic",
588
+ "Cs",
589
+ "Cuneiform",
590
+ "Cypriot",
591
+ "Cypro_Minoan",
592
+ "Cyrillic",
593
+ "Dash",
594
+ "Deprecated",
595
+ "Deseret",
596
+ "Devanagari",
597
+ "Diacritic",
598
+ "Dives_Akuru",
599
+ "Dogra",
600
+ "Duployan",
601
+ "Egyptian_Hieroglyphs",
602
+ "Elbasan",
603
+ "Elymaic",
604
+ "Ethiopic",
605
+ "Extender",
606
+ "FoldCategory",
607
+ "FoldScript",
608
+ "Georgian",
609
+ "Glagolitic",
610
+ "Gothic",
611
+ "Grantha",
612
+ "GraphicRanges",
613
+ "Greek",
614
+ "Gujarati",
615
+ "Gunjala_Gondi",
616
+ "Gurmukhi",
617
+ "Han",
618
+ "Hangul",
619
+ "Hanifi_Rohingya",
620
+ "Hanunoo",
621
+ "Hatran",
622
+ "Hebrew",
623
+ "Hex_Digit",
624
+ "Hiragana",
625
+ "Hyphen",
626
+ "Ideographic",
627
+ "IDS_Binary_Operator",
628
+ "IDS_Trinary_Operator",
629
+ "Imperial_Aramaic",
630
+ "Inherited",
631
+ "Inscriptional_Pahlavi",
632
+ "Inscriptional_Parthian",
633
+ "Javanese",
634
+ "Join_Control",
635
+ "Kaithi",
636
+ "Kannada",
637
+ "Katakana",
638
+ "Kawi",
639
+ "Kayah_Li",
640
+ "Kharoshthi",
641
+ "Khitan_Small_Script",
642
+ "Khmer",
643
+ "Khojki",
644
+ "Khudawadi",
645
+ "L",
646
+ "Lao",
647
+ "Latin",
648
+ "LC",
649
+ "Lepcha",
650
+ "Limbu",
651
+ "Linear_A",
652
+ "Linear_B",
653
+ "Lisu",
654
+ "Ll",
655
+ "Lm",
656
+ "Lo",
657
+ "Logical_Order_Exception",
658
+ "Lt",
659
+ "Lu",
660
+ "Lycian",
661
+ "Lydian",
662
+ "M",
663
+ "Mahajani",
664
+ "Makasar",
665
+ "Malayalam",
666
+ "Mandaic",
667
+ "Manichaean",
668
+ "Marchen",
669
+ "Masaram_Gondi",
670
+ "Mc",
671
+ "Me",
672
+ "Medefaidrin",
673
+ "Meetei_Mayek",
674
+ "Mende_Kikakui",
675
+ "Meroitic_Cursive",
676
+ "Meroitic_Hieroglyphs",
677
+ "Miao",
678
+ "Mn",
679
+ "Modi",
680
+ "Mongolian",
681
+ "Mro",
682
+ "Multani",
683
+ "Myanmar",
684
+ "N",
685
+ "Nabataean",
686
+ "Nag_Mundari",
687
+ "Nandinagari",
688
+ "Nd",
689
+ "New_Tai_Lue",
690
+ "Newa",
691
+ "Nko",
692
+ "Nl",
693
+ "No",
694
+ "Noncharacter_Code_Point",
695
+ "Nushu",
696
+ "Nyiakeng_Puachue_Hmong",
697
+ "Ogham",
698
+ "Ol_Chiki",
699
+ "Old_Hungarian",
700
+ "Old_Italic",
701
+ "Old_North_Arabian",
702
+ "Old_Permic",
703
+ "Old_Persian",
704
+ "Old_Sogdian",
705
+ "Old_South_Arabian",
706
+ "Old_Turkic",
707
+ "Old_Uyghur",
708
+ "Oriya",
709
+ "Osage",
710
+ "Osmanya",
711
+ "Other",
712
+ "Other_Alphabetic",
713
+ "Other_Default_Ignorable_Code_Point",
714
+ "Other_Grapheme_Extend",
715
+ "Other_ID_Continue",
716
+ "Other_ID_Start",
717
+ "Other_Lowercase",
718
+ "Other_Math",
719
+ "Other_Uppercase",
720
+ "P",
721
+ "Pahawh_Hmong",
722
+ "Palmyrene",
723
+ "Pattern_Syntax",
724
+ "Pattern_White_Space",
725
+ "Pau_Cin_Hau",
726
+ "Pc",
727
+ "Pd",
728
+ "Pe",
729
+ "Pf",
730
+ "Phags_Pa",
731
+ "Phoenician",
732
+ "Pi",
733
+ "Po",
734
+ "Prepended_Concatenation_Mark",
735
+ "PrintRanges",
736
+ "Properties",
737
+ "Ps",
738
+ "Psalter_Pahlavi",
739
+ "Quotation_Mark",
740
+ "Radical",
741
+ "Regional_Indicator",
742
+ "Rejang",
743
+ "Runic",
744
+ "S",
745
+ "Samaritan",
746
+ "Saurashtra",
747
+ "Sc",
748
+ "Scripts",
749
+ "Sentence_Terminal",
750
+ "Sharada",
751
+ "Shavian",
752
+ "Siddham",
753
+ "SignWriting",
754
+ "Sinhala",
755
+ "Sk",
756
+ "Sm",
757
+ "So",
758
+ "Soft_Dotted",
759
+ "Sogdian",
760
+ "Sora_Sompeng",
761
+ "Soyombo",
762
+ "SpecialCase",
763
+ "SpecialCase.ToLower",
764
+ "SpecialCase.ToTitle",
765
+ "SpecialCase.ToUpper",
766
+ "STerm",
767
+ "Sundanese",
768
+ "Syloti_Nagri",
769
+ "Syriac",
770
+ "Tagalog",
771
+ "Tagbanwa",
772
+ "Tai_Le",
773
+ "Tai_Tham",
774
+ "Tai_Viet",
775
+ "Takri",
776
+ "Tamil",
777
+ "Tangsa",
778
+ "Tangut",
779
+ "Telugu",
780
+ "Terminal_Punctuation",
781
+ "Thaana",
782
+ "Thai",
783
+ "Tibetan",
784
+ "Tifinagh",
785
+ "Tirhuta",
786
+ "Title",
787
+ "Toto",
788
+ "TurkishCase",
789
+ "Ugaritic",
790
+ "Unified_Ideograph",
791
+ "Vai",
792
+ "Variation_Selector",
793
+ "Vithkuqi",
794
+ "Wancho",
795
+ "Warang_Citi",
796
+ "White_Space",
797
+ "Yezidi",
798
+ "Yi",
799
+ "Z",
800
+ "Zanabazar_Square",
801
+ "Zl",
802
+ "Zp",
803
+ "Zs",
804
+ ],
805
+ },
806
+ };
807
+
808
+ // Packages that were pruned from the lean core: import path -> reason.
809
+ const REMOVED_PACKAGES = {
810
+ bufio: "removed in v1.8.0; use strings and bytes readers",
811
+ "net/url": "removed in v1.8.0; use the URL class from a js package",
812
+ context:
813
+ "removed in v1.8.0; use a cancel flag, or AbortController from a js package",
814
+ "encoding/csv":
815
+ "removed in v1.8.0; split lines and fields with strings.Split",
816
+ "container/heap":
817
+ "removed in v1.8.0; write the data structure in your package",
818
+ "container/list":
819
+ "removed in v1.8.0; write the data structure in your package",
820
+ "container/ring":
821
+ "removed in v1.8.0; write the data structure in your package",
822
+ "hash/adler32": "removed in v1.8.0; write the checksum in your package",
823
+ "hash/crc32": "removed in v1.8.0; write the checksum in your package",
824
+ "hash/fnv": "removed in v1.8.0; write the hash in your package",
825
+ "crypto/hmac":
826
+ "removed in v1.8.0; use Web Crypto (crypto.subtle) in a js package",
827
+ "crypto/md5":
828
+ "removed in v1.8.0; use Web Crypto (crypto.subtle) in a js package",
829
+ "crypto/sha1":
830
+ "removed in v1.8.0; use Web Crypto (crypto.subtle) in a js package",
831
+ "crypto/sha512":
832
+ "removed in v1.8.0; use Web Crypto (crypto.subtle) in a js package",
833
+ "crypto/subtle":
834
+ "removed in v1.8.0; use Web Crypto (crypto.subtle) in a js package",
835
+ "encoding/base32": "removed in v1.8.0; use encoding/base64 or encoding/hex",
836
+ log: "removed in v1.8.0; use fmt or println",
837
+ "math/rand/v2": "removed in v1.8.0; use math/rand",
838
+ "unicode/utf16": "removed in v1.8.0; use unicode/utf8",
839
+ "math/cmplx": "removed in v1.8.0; complex math is not supported",
840
+ "sync/atomic":
841
+ "removed in v1.8.0; GoFront is single-threaded, use plain variables",
842
+ };
843
+
844
+ export const EXCLUDED_STDLIB_PACKAGES = new Map(
845
+ Object.entries(REMOVED_PACKAGES),
846
+ );
847
+ for (const [group, paths] of Object.entries(EXCLUDED_PACKAGE_GROUPS)) {
848
+ for (const p of paths) {
849
+ if (!EXCLUDED_STDLIB_PACKAGES.has(p))
850
+ EXCLUDED_STDLIB_PACKAGES.set(p, PACKAGE_GROUP_REASONS[group]);
851
+ }
852
+ }
853
+
854
+ export const EXCLUDED_STDLIB_MEMBERS = new Map([
855
+ ["iter.Pull", "requires coroutines; out of scope (no runtime)"],
856
+ ["iter.Pull2", "requires coroutines; out of scope (no runtime)"],
857
+ ["time.After", "channels"],
858
+ ["time.Tick", "channels"],
859
+ ["time.NewTicker", "channels"],
860
+ ["time.NewTimer", "channels"],
861
+ ["time.Ticker", "channels"],
862
+ ["time.Timer.C", "channels"],
863
+ ["sync.Cond", "blocking wait"],
864
+ ["sync.Cond.Broadcast", "blocking wait"],
865
+ ["sync.Cond.L", "blocking wait"],
866
+ ["sync.Cond.Signal", "blocking wait"],
867
+ ["sync.Cond.Wait", "blocking wait"],
868
+ ["sync.NewCond", "blocking wait"],
869
+ ["sync.WaitGroup.Go", "starts a goroutine"],
870
+ ["testing.T.TempDir", "file system"],
871
+ ["testing.T.Chdir", "file system"],
872
+ ["testing.T.ArtifactDir", "file system"],
873
+ ["testing.B.TempDir", "file system"],
874
+ ["testing.B.Chdir", "file system"],
875
+ ["testing.B.ArtifactDir", "file system"],
876
+ ["testing.B.RunParallel", "goroutines"],
877
+ ["testing.B.SetParallelism", "goroutines"],
878
+ ["testing.TB.TempDir", "file system"],
879
+ ["testing.TB.Chdir", "file system"],
880
+ ["testing.TB.ArtifactDir", "file system"],
881
+ ]);
882
+
883
+ for (const [reason, byPkg] of Object.entries(EXCLUDED_MEMBER_GROUPS)) {
884
+ for (const [pkg, names] of Object.entries(byPkg)) {
885
+ for (const name of names) {
886
+ const keys = [
887
+ `${pkg}.${name}`,
888
+ `${pkgIdent(pkg)}.${name}`,
889
+ `${pkg.split("/").at(-1)}.${name}`,
890
+ ];
891
+ for (const key of keys) {
892
+ if (!EXCLUDED_STDLIB_MEMBERS.has(key)) {
893
+ EXCLUDED_STDLIB_MEMBERS.set(key, reason);
894
+ }
895
+ }
896
+ }
897
+ }
898
+ }