Skip to content

Commit

Permalink
feat: updating template for supporting int64 values (#161)
Browse files Browse the repository at this point in the history
* updating template for supporting int64 values

* review changes

---------

Co-authored-by: Varkeychan Jacob <[email protected]>
  • Loading branch information
varkey98 and Varkeychan Jacob authored Feb 21, 2024
1 parent f05da39 commit 0c1dbb4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/go-generator/cmd/generator/_templates/loader.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ func getInt32Env(name string) (int32, bool) {
return 0, false
}

// getInt64Env returns the int64 value for an env var and a confirmation
// if the var exists
func getInt64Env(name string) (int64, bool) {
if val := os.Getenv(name); val != "" {
intVal, err := strconv.Atoi(val)
if err != nil {
return 0, false
}
return int64(intVal), true
}

return 0, false
}

// loadFromFile loads the agent config from a file
func loadFromFile(c *{{ .MainType}}, filename string) error {
unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
Expand Down

0 comments on commit 0c1dbb4

Please sign in to comment.