github.com/chenfeining/golangci-lint@v1.0.2-0.20230730162517-14c6c67868df/test/testdata/musttag.go (about)

     1  //golangcitest:args -Emusttag
     2  package testdata
     3  
     4  import (
     5  	"encoding/asn1"
     6  	"encoding/json"
     7  )
     8  
     9  // builtin functions:
    10  func musttagJSON() {
    11  	var user struct { // want "`anonymous struct` should be annotated with the `json` tag as it is passed to `json.Marshal` at "
    12  		Name  string
    13  		Email string `json:"email"`
    14  	}
    15  	json.Marshal(user)
    16  }
    17  
    18  // custom functions from config:
    19  func musttagASN1() {
    20  	var user struct {
    21  		Name  string
    22  		Email string `asn1:"email"`
    23  	}
    24  	asn1.Marshal(user)
    25  }