ByteNote LogoByteNote

Navigation

  • Blog
  • 工具

    © 2025 ByteNote. All rights reserved.

    vscode go struct生成 tags

    Jul 2, 20227 min read
    type Config struct {
    	AppName string
    	AppPort string
    	AppMode string
    }
    

    在struct上右键选择 Go: Add Tags To Struct Fields

    package tool
    
    type Config struct {
    	AppName string `json:"app_name,omitempty"`
    	AppPort string `json:"app_port,omitempty"`
    	AppMode string `json:"app_mode,omitempty"`
    }
    

    omitempty的作用是当一个field的值是empty的时候,序列化JSON时候忽略这个field

    相关文章

    colima 的安装和使用

    安装和使用Colima的步骤包括下载或使用Homebrew安装Colima,配置并验证Docker,以及通过终端命令启动和管理Colima环境,注意Colima仍在开发中可能存在问题。

    岳阳楼记全文

    范仲淹在《岳阳楼记》中描绘了登楼远眺的壮阔景象,抒发了对自然美景的赞叹及对人生际遇的感慨。

    Copilot 开始付费了, 如何白嫖

    GitHub Copilot is now paid, but remains free for maintainers of popular open source projects on GitHub and verified students through the GitHub Global Campus Program.

    SwiftUI 如何用一个视图掩盖另一个视图?

    在 SwiftUI 中,`mask` 修饰符允许一个视图(如文本)作为遮罩来裁剪另一个视图(如图像),如使用文本视图遮罩图像的示例代码所示。

    几个 IPTV 源

    APTV开发者提供的IPTV源,节目全面,加载快,清晰度高,每日更新,可用性高。