use std::collections::HashMap;
use std::sync::LazyLock;
static GO_STDLIB_TYPEDEFS: LazyLock<HashMap<&str, &str>> = LazyLock::new(|| {
HashMap::from([
("archive/tar", include_str!("../typedefs/archive/tar.d.lis")),
("archive/zip", include_str!("../typedefs/archive/zip.d.lis")),
("bufio", include_str!("../typedefs/bufio.d.lis")),
("bytes", include_str!("../typedefs/bytes.d.lis")),
("cmp", include_str!("../typedefs/cmp.d.lis")),
(
"compress/bzip2",
include_str!("../typedefs/compress/bzip2.d.lis"),
),
(
"compress/flate",
include_str!("../typedefs/compress/flate.d.lis"),
),
(
"compress/gzip",
include_str!("../typedefs/compress/gzip.d.lis"),
),
(
"compress/lzw",
include_str!("../typedefs/compress/lzw.d.lis"),
),
(
"compress/zlib",
include_str!("../typedefs/compress/zlib.d.lis"),
),
(
"container/heap",
include_str!("../typedefs/container/heap.d.lis"),
),
(
"container/list",
include_str!("../typedefs/container/list.d.lis"),
),
(
"container/ring",
include_str!("../typedefs/container/ring.d.lis"),
),
("context", include_str!("../typedefs/context.d.lis")),
("crypto", include_str!("../typedefs/crypto.d.lis")),
("crypto/aes", include_str!("../typedefs/crypto/aes.d.lis")),
(
"crypto/cipher",
include_str!("../typedefs/crypto/cipher.d.lis"),
),
("crypto/des", include_str!("../typedefs/crypto/des.d.lis")),
("crypto/dsa", include_str!("../typedefs/crypto/dsa.d.lis")),
("crypto/ecdh", include_str!("../typedefs/crypto/ecdh.d.lis")),
(
"crypto/ecdsa",
include_str!("../typedefs/crypto/ecdsa.d.lis"),
),
(
"crypto/ed25519",
include_str!("../typedefs/crypto/ed25519.d.lis"),
),
(
"crypto/elliptic",
include_str!("../typedefs/crypto/elliptic.d.lis"),
),
(
"crypto/fips140",
include_str!("../typedefs/crypto/fips140.d.lis"),
),
("crypto/hkdf", include_str!("../typedefs/crypto/hkdf.d.lis")),
("crypto/hmac", include_str!("../typedefs/crypto/hmac.d.lis")),
("crypto/md5", include_str!("../typedefs/crypto/md5.d.lis")),
(
"crypto/mlkem",
include_str!("../typedefs/crypto/mlkem.d.lis"),
),
(
"crypto/pbkdf2",
include_str!("../typedefs/crypto/pbkdf2.d.lis"),
),
("crypto/rand", include_str!("../typedefs/crypto/rand.d.lis")),
("crypto/rc4", include_str!("../typedefs/crypto/rc4.d.lis")),
("crypto/rsa", include_str!("../typedefs/crypto/rsa.d.lis")),
("crypto/sha1", include_str!("../typedefs/crypto/sha1.d.lis")),
(
"crypto/sha256",
include_str!("../typedefs/crypto/sha256.d.lis"),
),
("crypto/sha3", include_str!("../typedefs/crypto/sha3.d.lis")),
(
"crypto/sha512",
include_str!("../typedefs/crypto/sha512.d.lis"),
),
(
"crypto/subtle",
include_str!("../typedefs/crypto/subtle.d.lis"),
),
("crypto/tls", include_str!("../typedefs/crypto/tls.d.lis")),
("crypto/x509", include_str!("../typedefs/crypto/x509.d.lis")),
(
"crypto/x509/pkix",
include_str!("../typedefs/crypto/x509/pkix.d.lis"),
),
(
"database/sql",
include_str!("../typedefs/database/sql.d.lis"),
),
(
"database/sql/driver",
include_str!("../typedefs/database/sql/driver.d.lis"),
),
(
"debug/buildinfo",
include_str!("../typedefs/debug/buildinfo.d.lis"),
),
("debug/dwarf", include_str!("../typedefs/debug/dwarf.d.lis")),
("debug/elf", include_str!("../typedefs/debug/elf.d.lis")),
("debug/gosym", include_str!("../typedefs/debug/gosym.d.lis")),
("debug/macho", include_str!("../typedefs/debug/macho.d.lis")),
("debug/pe", include_str!("../typedefs/debug/pe.d.lis")),
(
"debug/plan9obj",
include_str!("../typedefs/debug/plan9obj.d.lis"),
),
("embed", include_str!("../typedefs/embed.d.lis")),
("encoding", include_str!("../typedefs/encoding.d.lis")),
(
"encoding/ascii85",
include_str!("../typedefs/encoding/ascii85.d.lis"),
),
(
"encoding/asn1",
include_str!("../typedefs/encoding/asn1.d.lis"),
),
(
"encoding/base32",
include_str!("../typedefs/encoding/base32.d.lis"),
),
(
"encoding/base64",
include_str!("../typedefs/encoding/base64.d.lis"),
),
(
"encoding/binary",
include_str!("../typedefs/encoding/binary.d.lis"),
),
(
"encoding/csv",
include_str!("../typedefs/encoding/csv.d.lis"),
),
(
"encoding/gob",
include_str!("../typedefs/encoding/gob.d.lis"),
),
(
"encoding/hex",
include_str!("../typedefs/encoding/hex.d.lis"),
),
(
"encoding/json",
include_str!("../typedefs/encoding/json.d.lis"),
),
(
"encoding/pem",
include_str!("../typedefs/encoding/pem.d.lis"),
),
(
"encoding/xml",
include_str!("../typedefs/encoding/xml.d.lis"),
),
("errors", include_str!("../typedefs/errors.d.lis")),
("expvar", include_str!("../typedefs/expvar.d.lis")),
("flag", include_str!("../typedefs/flag.d.lis")),
("fmt", include_str!("../typedefs/fmt.d.lis")),
("go/ast", include_str!("../typedefs/go/ast.d.lis")),
("go/build", include_str!("../typedefs/go/build.d.lis")),
(
"go/build/constraint",
include_str!("../typedefs/go/build/constraint.d.lis"),
),
("go/constant", include_str!("../typedefs/go/constant.d.lis")),
("go/doc", include_str!("../typedefs/go/doc.d.lis")),
(
"go/doc/comment",
include_str!("../typedefs/go/doc/comment.d.lis"),
),
("go/format", include_str!("../typedefs/go/format.d.lis")),
("go/importer", include_str!("../typedefs/go/importer.d.lis")),
("go/parser", include_str!("../typedefs/go/parser.d.lis")),
("go/printer", include_str!("../typedefs/go/printer.d.lis")),
("go/scanner", include_str!("../typedefs/go/scanner.d.lis")),
("go/token", include_str!("../typedefs/go/token.d.lis")),
("go/types", include_str!("../typedefs/go/types.d.lis")),
("go/version", include_str!("../typedefs/go/version.d.lis")),
("hash", include_str!("../typedefs/hash.d.lis")),
(
"hash/adler32",
include_str!("../typedefs/hash/adler32.d.lis"),
),
("hash/crc32", include_str!("../typedefs/hash/crc32.d.lis")),
("hash/crc64", include_str!("../typedefs/hash/crc64.d.lis")),
("hash/fnv", include_str!("../typedefs/hash/fnv.d.lis")),
(
"hash/maphash",
include_str!("../typedefs/hash/maphash.d.lis"),
),
("html", include_str!("../typedefs/html.d.lis")),
(
"html/template",
include_str!("../typedefs/html/template.d.lis"),
),
("image", include_str!("../typedefs/image.d.lis")),
("image/color", include_str!("../typedefs/image/color.d.lis")),
(
"image/color/palette",
include_str!("../typedefs/image/color/palette.d.lis"),
),
("image/draw", include_str!("../typedefs/image/draw.d.lis")),
("image/gif", include_str!("../typedefs/image/gif.d.lis")),
("image/jpeg", include_str!("../typedefs/image/jpeg.d.lis")),
("image/png", include_str!("../typedefs/image/png.d.lis")),
(
"index/suffixarray",
include_str!("../typedefs/index/suffixarray.d.lis"),
),
("io", include_str!("../typedefs/io.d.lis")),
("io/fs", include_str!("../typedefs/io/fs.d.lis")),
("io/ioutil", include_str!("../typedefs/io/ioutil.d.lis")),
("iter", include_str!("../typedefs/iter.d.lis")),
("log", include_str!("../typedefs/log.d.lis")),
("log/slog", include_str!("../typedefs/log/slog.d.lis")),
("log/syslog", include_str!("../typedefs/log/syslog.d.lis")),
("maps", include_str!("../typedefs/maps.d.lis")),
("math", include_str!("../typedefs/math.d.lis")),
("math/big", include_str!("../typedefs/math/big.d.lis")),
("math/bits", include_str!("../typedefs/math/bits.d.lis")),
("math/cmplx", include_str!("../typedefs/math/cmplx.d.lis")),
("math/rand", include_str!("../typedefs/math/rand.d.lis")),
(
"math/rand/v2",
include_str!("../typedefs/math/rand/v2.d.lis"),
),
("mime", include_str!("../typedefs/mime.d.lis")),
(
"mime/multipart",
include_str!("../typedefs/mime/multipart.d.lis"),
),
(
"mime/quotedprintable",
include_str!("../typedefs/mime/quotedprintable.d.lis"),
),
("net", include_str!("../typedefs/net.d.lis")),
("net/http", include_str!("../typedefs/net/http.d.lis")),
(
"net/http/cgi",
include_str!("../typedefs/net/http/cgi.d.lis"),
),
(
"net/http/cookiejar",
include_str!("../typedefs/net/http/cookiejar.d.lis"),
),
(
"net/http/fcgi",
include_str!("../typedefs/net/http/fcgi.d.lis"),
),
(
"net/http/httptest",
include_str!("../typedefs/net/http/httptest.d.lis"),
),
(
"net/http/httptrace",
include_str!("../typedefs/net/http/httptrace.d.lis"),
),
(
"net/http/httputil",
include_str!("../typedefs/net/http/httputil.d.lis"),
),
(
"net/http/pprof",
include_str!("../typedefs/net/http/pprof.d.lis"),
),
("net/mail", include_str!("../typedefs/net/mail.d.lis")),
("net/netip", include_str!("../typedefs/net/netip.d.lis")),
("net/rpc", include_str!("../typedefs/net/rpc.d.lis")),
(
"net/rpc/jsonrpc",
include_str!("../typedefs/net/rpc/jsonrpc.d.lis"),
),
("net/smtp", include_str!("../typedefs/net/smtp.d.lis")),
(
"net/textproto",
include_str!("../typedefs/net/textproto.d.lis"),
),
("net/url", include_str!("../typedefs/net/url.d.lis")),
("os", include_str!("../typedefs/os.d.lis")),
("os/exec", include_str!("../typedefs/os/exec.d.lis")),
("os/signal", include_str!("../typedefs/os/signal.d.lis")),
("os/user", include_str!("../typedefs/os/user.d.lis")),
("path", include_str!("../typedefs/path.d.lis")),
(
"path/filepath",
include_str!("../typedefs/path/filepath.d.lis"),
),
("plugin", include_str!("../typedefs/plugin.d.lis")),
("reflect", include_str!("../typedefs/reflect.d.lis")),
("regexp", include_str!("../typedefs/regexp.d.lis")),
(
"regexp/syntax",
include_str!("../typedefs/regexp/syntax.d.lis"),
),
("runtime", include_str!("../typedefs/runtime.d.lis")),
("runtime/cgo", include_str!("../typedefs/runtime/cgo.d.lis")),
(
"runtime/coverage",
include_str!("../typedefs/runtime/coverage.d.lis"),
),
(
"runtime/debug",
include_str!("../typedefs/runtime/debug.d.lis"),
),
(
"runtime/metrics",
include_str!("../typedefs/runtime/metrics.d.lis"),
),
(
"runtime/pprof",
include_str!("../typedefs/runtime/pprof.d.lis"),
),
(
"runtime/race",
include_str!("../typedefs/runtime/race.d.lis"),
),
(
"runtime/trace",
include_str!("../typedefs/runtime/trace.d.lis"),
),
("slices", include_str!("../typedefs/slices.d.lis")),
("sort", include_str!("../typedefs/sort.d.lis")),
("strconv", include_str!("../typedefs/strconv.d.lis")),
("strings", include_str!("../typedefs/strings.d.lis")),
("structs", include_str!("../typedefs/structs.d.lis")),
("sync", include_str!("../typedefs/sync.d.lis")),
("sync/atomic", include_str!("../typedefs/sync/atomic.d.lis")),
("syscall", include_str!("../typedefs/syscall.d.lis")),
("testing", include_str!("../typedefs/testing.d.lis")),
(
"testing/fstest",
include_str!("../typedefs/testing/fstest.d.lis"),
),
(
"testing/iotest",
include_str!("../typedefs/testing/iotest.d.lis"),
),
(
"testing/quick",
include_str!("../typedefs/testing/quick.d.lis"),
),
(
"testing/slogtest",
include_str!("../typedefs/testing/slogtest.d.lis"),
),
(
"testing/synctest",
include_str!("../typedefs/testing/synctest.d.lis"),
),
(
"text/scanner",
include_str!("../typedefs/text/scanner.d.lis"),
),
(
"text/tabwriter",
include_str!("../typedefs/text/tabwriter.d.lis"),
),
(
"text/template",
include_str!("../typedefs/text/template.d.lis"),
),
(
"text/template/parse",
include_str!("../typedefs/text/template/parse.d.lis"),
),
("time", include_str!("../typedefs/time.d.lis")),
("time/tzdata", include_str!("../typedefs/time/tzdata.d.lis")),
("unicode", include_str!("../typedefs/unicode.d.lis")),
(
"unicode/utf16",
include_str!("../typedefs/unicode/utf16.d.lis"),
),
(
"unicode/utf8",
include_str!("../typedefs/unicode/utf8.d.lis"),
),
("unique", include_str!("../typedefs/unique.d.lis")),
("unsafe", include_str!("../typedefs/unsafe.d.lis")),
("weak", include_str!("../typedefs/weak.d.lis")),
])
});
pub fn get_go_stdlib_typedef(package: &str) -> Option<&'static str> {
GO_STDLIB_TYPEDEFS.get(package).copied()
}
pub fn get_go_stdlib_packages() -> Vec<&'static str> {
let mut packages: Vec<&'static str> = GO_STDLIB_TYPEDEFS.keys().copied().collect();
packages.sort();
packages
}