title: Golang store print as variable
body: <p>I am fairly new to GO and I was hoping someone would be able to point me in the right direction.
  I am trying to store a Print to a variable. To give some context, currently, I am retrieving the URL of a file that is in Amazon S3 and I would like to store the URL as a variable so I can send it out as say, an email or push notification.</p>
  
  <p>Here is what I have at the moment:</p>
  
  <pre><code>func main() {
      bucket := "bucket"
      region := "eu-west-2"
  
      // Initialize a session in us-west-2 that the SDK will use to load
      // credentials from the shared credentials file ~/.aws/credentials.
      sess, err := session.NewSession(&amp;aws.Config{
          Region: aws.String("eu-west-2")},
      )
  
      // Create S3 service client
      svc := s3.New(sess)
  
  
      // Get the list of item
      resp, err := svc.ListObjects(&amp;s3.ListObjectsInput{Bucket: aws.String(bucket)})
      if err != nil {
          exitErrorf("Unable to list items in bucket %q, %v", bucket, err)
      }
  
      for _, item := range resp.Contents {
          fmt.Printf("https://s3.%s.amazonaws.com/%s/%s", region, bucket, *item.Key)
          fmt.Println("")
          var url string = "https://s3.%s.amazonaws.com/%s/%s", region, bucket, *item.Key
  }
  }
  
  func exitErrorf(msg string, args ...interface{}) {
      fmt.Fprintf(os.Stderr, msg+"\n", args...)
      os.Exit(1)
  }
  </code></pre>
  
  <p>This results in <code>extra expression in var declaration</code> when attempting to compile (TBF I did not expect it to work). Would anyone know an alternative way of doing this?</p>
  
  <p>Thanks!</p>