title: Go : How to read the contents of two files and concatenate to a string
body: <p>I'm trying to fix a bug in <a href="https://github.com/docker/machine/issues/2787" rel="nofollow">docker-machine</a>. The problem seems to be in it's vmware-fusion driver. When trying to resolve a machine by it's MAC address it consults the vmware dhcp leases file. Unfortunately, when you use a custom network (for example the private network vmnet2) the most recent dhcp lease will be in the file 'vmnet-dhcpd-vmnet2.leases' instead.</p>
  
  <p>Anyhow, my knowledge of go is non-existent.</p>
  
  <p>I'd like to implement something like (pseudocode):</p>
  
  <pre><code>var allText = ""
  for i in "/var/db/vmware/*.leases"
    do read i; allText = allText ++ i
  done
  </code></pre>
  
  <p>The existing code <a href="https://github.com/docker/machine/blob/master/drivers/vmwarefusion/fusion_darwin.go#L464" rel="nofollow">(fusion_darwin.go)</a> looks like this:</p>
  
  <pre><code>// DHCP lease table for NAT vmnet interface
  var dhcpfile = "/var/db/vmware/vmnet-dhcpd-vmnet8.leases"
  
  if vmxfh, err = os.Open(d.vmxPath()); err != nil {
      return "", err
  }
  defer vmxfh.Close()
  
  if vmxcontent, err = ioutil.ReadAll(vmxfh); err != nil {
      return "", err
  }
  </code></pre>
  
  <p>I've created an issue etc, but if possible I'd like to learn a little more about Go along the way and contribute back whatever I can fix. </p>
  
  <p>Any ideas?</p>