跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • tagfmt 库,用来对齐 go 语言的 struct tag 字段
未分類
4 11 月 2020

tagfmt 库,用来对齐 go 语言的 struct tag 字段

tagfmt 库,用来对齐 go 语言的 struct tag 字段

資深大佬 : bigpigeon 2

https://github.com/bigpigeon/tagfmt 除了对齐还可以对 tag key 排序和填充 tag value

一个简单例子

// tagfmt . package main type Example struct {  Data      string `xml:"data" yaml:"data"  json:"data"`  OtherData string `xml:"other_data" json:"other_data:omitempty" yaml:"other_data"` }  // result package main  type Example struct {  Data      string `xml:"data"       yaml:"data"                 json:"data"`  OtherData string `xml:"other_data" json:"other_data:omitempty" yaml:"other_data"` } 

大佬有話說 (6)

  • 資深大佬 : Maboroshii

    感觉更需要的是 tag 的顺序, 比如你的例子里的 yaml 和 json 的顺序不一样就很难受。。

  • 資深大佬 : Maboroshii

    @Maboroshii #1 哦 原来是支持排序的!!

  • 主 資深大佬 : bigpigeon

    @Maboroshii 恩,但目前只支持按 tag 的 key 的字符规则排序,迟点我吧按着某一行的 tag key 序列排序功能加上

  • 資深大佬 : huweic

    good

  • 資深大佬 : NoUltimate

    好用,强迫症福音

  • 主 資深大佬 : bigpigeon

    tag sort by order 功能也加上了
    @NoUltimate 握手

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具