V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
cmos
V2EX  ›  程序员

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

  •  
  •   cmos · 17 小时 8 分钟前 · 1110 次点击

    经常在 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 条附言  ·  15 小时 53 分钟前

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

    18 条回复    2025-12-16 06:51:20 +08:00
    VPNHunter
        1
    VPNHunter  
       16 小时 54 分钟前   ❤️ 1
    Good ,keep doing it
    shakaraka
        2
    shakaraka  
    PRO
       16 小时 51 分钟前   ❤️ 1
    建议官方合并 😁
    Hudiebbk
        3
    Hudiebbk  
       16 小时 50 分钟前
    终于有人搞这个了 赞
    kevinmissu
        4
    kevinmissu  
       16 小时 36 分钟前
    赞一个
    visper
        5
    visper  
       16 小时 26 分钟前
    第一次用 cargo 的时候,在想这怎么是 rust 的工具名而不是 go 的。
    yyzq007
        6
    yyzq007  
       16 小时 10 分钟前
    看着不错, 那么 github 地址呢...
    weishu
        7
    weishu  
       16 小时 8 分钟前
    看名字就知道用心了,点赞
    cmos
        8
    cmos  
    OP
       15 小时 53 分钟前
    Jinvic
        9
    Jinvic  
       15 小时 38 分钟前
    支持
    lxiian
        10
    lxiian  
       15 小时 35 分钟前 via iPhone
    这个不错,希望能一直维护
    homewORK
        11
    homewORK  
       14 小时 46 分钟前
    如果喜欢这种书写方案,直接 go-zero ? 或者修改 zero cli 的模板好像也成。
    NessajCN
        12
    NessajCN  
       13 小时 32 分钟前   ❤️ 2
    gocar 敲起来太不顺了
    能不能改叫 cars 啊,毕竟隔壁都叫 car go 了, 那咱倒反天罡一下叫 ca rs 也很合理对吧
    cmos
        13
    cmos  
    OP
       12 小时 48 分钟前
    @NessajCN 12#
    这个提议好,cargo 依赖 cars ,我看看有没有名称重合
    brucedone
        14
    brucedone  
       11 小时 18 分钟前
    cargo +1
    cnnblike
        15
    cnnblike  
       10 小时 53 分钟前
    还算是别用“cars”了,搜索引擎很难辨别,影响推广
    cnnblike
        16
    cnnblike  
       10 小时 46 分钟前
    我大概和 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 themselves—they 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
       4 小时 50 分钟前
    叫 dargo 呗
    lifeOsDeveloper
        18
    lifeOsDeveloper  
       9 分钟前
    go-boot
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1001 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 23:00 · PVG 07:00 · LAX 15:00 · JFK 18:00
    ♥ Do have faith in what you're doing.