(field reflect.StructField)
| 889 | } |
| 890 | |
| 891 | func GetJsonTag(field reflect.StructField) string { |
| 892 | jsonTag := field.Tag.Get("json") |
| 893 | if jsonTag == "" { |
| 894 | return "" |
| 895 | } |
| 896 | commaIdx := strings.Index(jsonTag, ",") |
| 897 | if commaIdx != -1 { |
| 898 | jsonTag = jsonTag[:commaIdx] |
| 899 | } |
| 900 | return jsonTag |
| 901 | } |
| 902 | |
| 903 | func WriteFileIfDifferent(fileName string, contents []byte) (bool, error) { |
| 904 | oldContents, err := os.ReadFile(fileName) |
no test coverage detected