From 4c532303a6a732ffcea1008c155735e98ece18b1 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Tue, 3 May 2016 22:25:14 -0700 Subject: [PATCH] Simplify Bool, Int, String helpers. Code simplification suggestion by @gmlewis. Closes #350 --- github/github.go | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/github/github.go b/github/github.go index faafb54..5907501 100644 --- a/github/github.go +++ b/github/github.go @@ -760,24 +760,12 @@ func cloneRequest(r *http.Request) *http.Request { // Bool is a helper routine that allocates a new bool value // to store v and returns a pointer to it. -func Bool(v bool) *bool { - p := new(bool) - *p = v - return p -} +func Bool(v bool) *bool { return &v } // Int is a helper routine that allocates a new int value // to store v and returns a pointer to it. -func Int(v int) *int { - p := new(int) - *p = v - return p -} +func Int(v int) *int { return &v } // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. -func String(v string) *string { - p := new(string) - *p = v - return p -} +func String(v string) *string { return &v }