我构建了 Go 的 Cargo: gocar,一个 Go 项目脚手架工具 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
请不要在回答技术问题时复制粘贴 AI 生成的内容
cmos
V2EX    程序员

我构建了 Go 的 Cargo: gocar,一个 Go 项目脚手架工具

  •  1
     
  •   cmos 2025 年 12 月 15 日 3143 次点击
    这是一个创建于 103 天前的主题,其中的信息可能已经有所发展或是发生改变。

    经常在 Go 和 Rust 之间切换,超级无敌喜欢 Rust 的 Cargo:

    • cargo new 一键创建标准项目
    • cargo build 统一构建流程

    但回到 Go 时,虽然 go mod 很好,但项目初始化、结构规范、构建优化这些事,总是要手动操作。

    所以,我把 Cargo 的部分理念带到 Go 生态中,倒反天罡,做了 gocar:简化 Go 项目“创建-构建”流程的命令行工具。它不替代 go 命令,而是作为补充,提供更一致、更便捷的起点。

    # 1. 创建一个简化布局的项目 gocar new my-server # gocar new my-server --mode project 将创建遵循标准布局的项目 # 2. 进入目录 cd my-server # 3. 构建(发布模式,优化体积,激进的设置了 CGO=0 ) gocar build --release # 4. 运行 gocar run 或者 ./bin/my-server # 输出示例: Hello, gocar! A golang package manager. 2025-12-15 13:51:49 
    第 1 条附言    2025 年 12 月 15 日

    自己写的项目,没相对这么多人需要,那就放一下GitHub连接:https://github.com/uselibrary/gocar

    21 条回复    2025-12-17 15:59:25 +08:00
    VPNHunter
        1
    VPNHunter  
       2025 年 12 月 15 日   1
    Good ,keep doing it
    shakaraka
        2
    shakaraka  
    PRO
       2025 年 12 月 15 日   1
    建议官方合并
    Hudiebbk
        3
    Hudiebbk  
       2025 年 12 月 15 日
    终于有人搞这个了 赞
    kevinmissu
        4
    kevinmissu  
       2025 年 12 月 15 日
    赞一个
    visper
        5
    visper  
       2025 年 12 月 15 日
    第一次用 cargo 的时候,在想这怎么是 rust 的工具名而不是 go 的。
    yyzq007
        6
    yyzq007  
       2025 年 12 月 15 日
    看着不错, 那么 github 地址呢...
    weishu
        7
    weishu  
       2025 年 12 月 15 日
    看名字就知道用心了,点赞
    cmos
        8
    cmos  
    OP
       2025 年 12 月 15 日
    Jinvic
        9
    Jinvic  
       2025 年 12 月 15 日
    支持
    lxiian
        10
    lxiian  
       2025 年 12 月 15 日 via iPhone
    这个不错,希望能一直维护
    homewORK
        11
    homewORK  
       2025 年 12 月 15 日
    如果喜欢这种书写方案,直接 go-zero ? 或者修改 zero cli 的模板好像也成。
    NessajCN
        12
    NessajCN  
       2025 年 12 月 15 日   3
    gocar 敲起来太不顺了
    能不能改叫 cars 啊,毕竟隔壁都叫 car go 了, 那咱倒反天罡一下叫 ca rs 也很合理对吧
    cmos
        13
    cmos  
    OP
       2025 年 12 月 15 日
    @NessajCN 12#
    这个提议好,cargo 依赖 cars ,我看看有没有名称重合
    brucedone
        14
    brucedone  
       2025 年 12 月 15 日
    cargo +1
    cnnblike
        15
    cnnblike  
       2025 年 12 月 15 日
    还算是别用“cars”了,搜索引擎很难辨别,影响推广
    cnnblike
        16
    cnnblike  
       2025 年 12 月 15 日
    我大概和 gemini 讨论了下,我觉得哈,有几个要求可以搞这个 rust-golang 和 cargo-x 的双关,一个是需要看上去像是个能拼写的名字,这样母语是英语的人好拼读,一个是需要是要明确的不存在的拼写,这样搜索引擎好推广,还有一个是最好是一个载具的名字,cargo 本意是货船
    emm, I'm wondering, if we pick a name for some vihecle for ocean, then add some kind of "rs"/"rust" suffix, will it make more sense? this make search engine easier to spot "it's a tool name"

    This is a fantastic constraint because it combines three layers of meaning:

    Ocean Vehicle: Fits the shipping/logistics theme (like Cargo).

    "Rust" Suffix: The hidden nod to the rival language.

    SEO Friendly: Unique spellings that are easy to Google.

    Here are the best Ocean Vehicle names that integrate "Rust/rs" to create that perfect "A-ha" moment.

    1. Ferrust
    The Breakdown:

    Vehicle: Ferry (A boat that transports people/cars).

    Suffix: Rust.

    The "A-ha" Pun: It sounds exactly like "Ferrous"the scientific term for iron, which is the metal that creates rust.

    The Logic:

    Rust Tool = Car + go.

    Go Tool = Ferry + rust.

    SEO: Ferrust is likely completely unique in search results.

    2. Towrust
    The Breakdown:

    Vehicle: Tow (Towboat/Tugboat).

    Suffix: Rust.

    The "A-ha" Pun: When said aloud, it sounds like "Tourist". A tourist is someone who travels (or "Goes") to places.

    The Logic: "I use Towrust to manage my dependencies."

    SEO: Towrust is unique, whereas "Tourist" is common.

    3. Tugrust
    The Breakdown:

    Vehicle: Tug (Tugboat).

    Suffix: Rust.

    The "A-ha" Pun: In a harbor, the huge Cargo ships can't park themselvesthey need a Tug to manage them.

    The Logic: This tool (Tugrust) manages the heavier packages (Cargo) of your system. It implies your tool is stronger or more agile than Cargo.

    SEO: Very high distinctiveness.

    4. Scowrs
    The Breakdown:

    Vehicle: Scow (A flat-bottomed boat used for hauling bulk freight).

    Suffix: rs (The common Rust file extension).

    The "A-ha" Pun: It sounds like "Scours".

    The Logic: A package manager "scours" the internet to find the libraries you need.

    SEO: Scowrs is distinct and looks like a modern tech tool name (like Flickr, Tumblr).

    5. Subrust
    The Breakdown:

    Vehicle: Sub (Submarine).

    Suffix: Rust.

    The "A-ha" Pun: It implies "Sub-Rust" or "Below Rust"perhaps implying you are operating at a lower, deeper level, or that you are stealthier.

    The Logic: Go is the language of the cloud (often represented by whales/ocean), so a submarine fits the deep-sea theme.

    My Recommendation: Ferrust
    It is the smartest choice because it works on three levels:

    Visual: It looks like a legitimate tool name.

    Thematic: Ferry fits the transport theme of "Cargo".

    Intellectual: The "Ferrous" (Iron/Rust) double-entendre is the kind of clever joke developers love.

    Visualizing the README:

    Ferrust
    The vehicle for Go that carries a bit of Rust.

    ferrust install [package]
    itechify
        17
    itechify  
    PRO
       2025 年 12 月 16 日
    叫 dargo 呗
    lifeOsDeveloper
        18
    lifeOsDeveloper  
       2025 年 12 月 16 日
    go-boot
    signalyc
        19
    signalyc  
       2025 年 12 月 17 日
    要不,就叫 truckgo ,充分体现 chinese style english
    iorilu
        20
    iorilu  
       2025 年 12 月 17 日
    还不如叫 cago

    没有 r
    UnknoownUser
        21
    UnknoownUser  
       2025 年 12 月 17 日
    感觉 github README 放英文介绍会更好推广流行一点
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2565 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 24ms UTC 01:40 PVG 09:40 LAX 18:40 JFK 21:40
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86