[workspace]
members = ["goish-macros"]

[package]
name = "goish"
version = "0.20.7"
edition = "2021"
rust-version = "1.70"
authors = ["Chanwit Kaewkasi <chanwit@gmail.com>"]
description = "Goish Rust — write Rust using Go idioms. Ports Go's standard library and syntax so Go programmers can write Rust code that reads and feels like Go."
repository = "https://github.com/chanwit/goish"
homepage = "https://github.com/chanwit/goish"
documentation = "https://docs.rs/goish"
readme = "README.md"
license = "MIT OR Apache-2.0"
keywords = ["go", "golang", "idioms", "stdlib", "port"]
categories = ["development-tools", "rust-patterns", "api-bindings"]
exclude = [
    "refs/*",
    "/.claude/*",
    "**/.memsearch/*",
    "examples/gostring_prototype/*",
    # Not needed by downstream users — keep the published crate lean.
    "tests/*",            # ~588 KiB — integration tests
    "transpiler/*",       # ~100 KiB — Go program, not part of the Rust crate
    "target/*",
    ".github/*",
]

[dependencies]
# Runtime: tokio + flume.
#   - tokio::task::spawn backs the `go!{}` macro: each goroutine is a
#     ~200 B async task on a multi-thread runtime. Proven at 1,000,000
#     concurrent goroutines (tests/million_goroutines.rs).
#   - `goish-macros` rewrites `c.Send(v)` / `c.Recv()` / `g.Wait()` inside
#     `go!{}` bodies to their `.await` forms at compile time, so the call
#     site stays Go-shaped.
#   - flume backs Chan<T>: winner of v0.4 channel bake-off (see commit
#     b996384 — 2× faster rendezvous, 3.5× less RSS vs async-channel).
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time", "sync"] }
goish-macros = { version = "0.6", path = "goish-macros" }
flume = { version = "0.11", default-features = false, features = ["async", "select", "eventual-fairness"] }
serde = "1"
serde_json = "1"
regex = "1"

# net/http (v0.5) — hyper + hyper-util for server/client, http for shared
# low-level types, http-body-util for body helpers, bytes for zero-copy
# byte buffers. All four are the canonical hyper 1.x split-crate stack.
hyper = { version = "1", features = ["http1", "server", "client"] }
hyper-util = { version = "0.1", features = ["tokio", "http1", "server", "server-graceful", "client-legacy"] }
http = "1"
http-body-util = "0.1"
bytes = "1"

# testing harness: `test!` registers into a linker-backed inventory so
# `test_main!` (in harness=false test targets) can discover + run them.
inventory = "0.3"

[lib]
path = "src/lib.rs"

[[example]]
name = "hello"
path = "examples/hello.rs"

[[example]]
name = "config"
path = "examples/config.rs"

[[example]]
name = "literals"
path = "examples/literals.rs"

[[example]]
name = "worker"
path = "examples/worker.rs"

[[example]]
name = "pipeline"
path = "examples/pipeline.rs"

[[example]]
name = "webscrape"
path = "examples/webscrape.rs"

[[example]]
name = "webserver"
path = "examples/webserver.rs"

[[example]]
name = "transpiled_hello"
path = "examples/transpiled_hello.rs"

[[test]]
name = "test_main_harness"
path = "tests/test_main_harness.rs"
harness = false
