suggestion: key + "#" + buildARN
371 key = strings.Join([]string{key, *a.ReviewApp}, "#")
372 }
373 if buildARN != "" {
374 key = strings.Join([]string{key, buildARN}, "#") 375 }
376 Item, err := a.ddbItem(key)
377 if err != nil {
suggestion: key + "#" + *a.ReviewApp
368func (a *App) GetDeployStatus(buildARN string) (*DeployStatus, error) {
369 key := "DEPLOYSTATUS"
370 if a.IsReviewApp() {
371 key = strings.Join([]string{key, *a.ReviewApp}, "#") 372 }
373 if buildARN != "" {
374 key = strings.Join([]string{key, buildARN}, "#")
Description
Some string concatenation operations such as strings.Join
called with a single
or a two element slice can be simplified using binary operators.
This also improves performance as it doesn't need to allocate a new slice and iterate through it.
Bad practice
func foo(x, y string) string {
return strings.Join([]string{x, y}, "_")
}
Recommended
func foo(x, y string) string {
return x + "_" + y
}