The Go Programming Language
› http://golang.org/
› Go Playground
Go Projects
› Revel Web Framework
noobsheldon

struct tag 变得太长了,很容易出错

  •  
  •   noobsheldon · Oct 2, 2019 via Android · 3998 views
    This topic created in 2576 days ago, the information mentioned may be changed or developed.

    有一个结构体,使用 orm,json, validate 等各种 tag 过后,struct tag 就变得特别长。好像没有一种单独编写 tag 的方式…

    2 replies  •  2019-10-04 12:51:23 +08:00
    freestyle
        1
    freestyle  
       Oct 2, 2019 via iPhone
    golangd 有 structtag 语法错误的 warning 提示. 跑 golint 也会提示.
    reus
        2
    reus  
       Oct 4, 2019
    用多行字符串
    foo int `
    json:"foo"
    db:"foo"
    ...
    `
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1188 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 18:00 · PVG 02:00 · LAX 11:00 · JFK 14:00
    ♥ Do have faith in what you're doing.