Skip to content

Commit

Permalink
Add comments to conversion functions to clarify the use
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Riegel authored and mrcrgl committed Nov 23, 2017
1 parent c214eae commit bb80b4f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cluster-autoscaler/cloudprovider/aws/api/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ package api

import "strconv"

// stringRefToFloat64 converts fields of type *float64 to float64 (fallback to zero value if nil)
// it's mostly used to handle aws api responds nicely
func stringRefToFloat64(p *string) (float64, error) {
if p == nil {
return 0, nil
}
return strconv.ParseFloat(*p, 64)
}

// stringRefToStringSlice converts ...*string to []string (fallback to zero value if nil)
// it's mostly used to handle aws api responds nicely
func stringRefToStringSlice(in ...*string) []string {
vs := make([]string, len(in))

Expand All @@ -35,6 +39,8 @@ func stringRefToStringSlice(in ...*string) []string {
return vs
}

// stringToStringSliceRef converts ...string to []*string
// it's mostly used to handle aws api responds nicely
func stringToStringSliceRef(in ...string) []*string {
vs := make([]*string, len(in))

Expand Down

0 comments on commit bb80b4f

Please sign in to comment.