Skip to content

Instantly share code, notes, and snippets.

@tbmreza
Last active June 22, 2023 09:11
Show Gist options
  • Save tbmreza/e293e1a7edb98d7442276441d1f45d45 to your computer and use it in GitHub Desktop.
Save tbmreza/e293e1a7edb98d7442276441d1f45d45 to your computer and use it in GitHub Desktop.
a growing snippet
func Deref(s *string) string {
if s != nil {
return *s
}
return ""
}
func ParseInt64OrDefault(s string) int64 {
n, strconvErr := strconv.ParseInt(s, 10, 64)
if strconvErr != nil {
return 0
}
return n
}
func JsonPrint(input interface{}) {
str, _ := json.Marshal(input)
log.Println("str:\n", string(str))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment