title: Which is the Go way, PutUint32 or use >> operator directly?
body: <p>This is two ways to get the same 4 bytes:</p>
  
  <pre><code>package main
  
  import (
    "encoding/binary"
    "fmt"
  )
  
  func main() {
    i := binary.LittleEndian.Uint32([]byte{1, 2, 3, 0})
    bs := make([]byte, 4)
    binary.LittleEndian.PutUint32(bs, uint32(i))
    fmt.Println(bs[0] == 1 &amp;&amp; bs[1] == 2 &amp;&amp; bs[2] == 3 &amp;&amp; bs[3] == 0)
  
    bs = []byte{byte(i &amp; 0x000000ff),
      byte(i &gt;&gt; 8 &amp; 0x000000ff),
      byte(i &gt;&gt; 16 &amp; 0x000000ff),
      byte(i &gt;&gt; 24)}
    fmt.Println(bs[0] == 1 &amp;&amp; bs[1] == 2 &amp;&amp; bs[2] == 3 &amp;&amp; bs[3] == 0)
  }
  </code></pre>
  
  <p>They both work. But which is the way the Go community would say is best?</p>