title: How to URL Safe decode Base64 in Go, encoded in Perl?
body: <p>I have an URL Safe encoded string (produced by Perl), that I need to decode in Go.
  Here are two programs, in Perl and in Go - Perl works fine, but Go rises error.
  I can't understand it.
  Please help!</p>
  
  <p>=== Perl code - works fine</p>
  
  <pre><code>#!/usr/bin/env perl
  use common::sense;
  use MIME::Base64::URLSafe;
  
  my $str = 'Oi6cQzmolrUhkgHsNehtj9p_OsasB_6CIeygK0owoxTsXCtVWyQi-7DXxIJiaV-kSc6PGNC6uNz5V0A9QOGCaeCy6PolQY2Lt_v4JM42VEbsuML8guHfMO0ydvbXVcCR-yLfkz5CO0f-P1hVqxJBD8qPvk1t1DRzqmHP41DSfIm_WzlhtITnd_Wjt6E3CFS78HL3XjJlM-QBW9Z_GZgic8y7TlOWFzCRUf2Q-EZschrDi9l81E93XBNKe8knInL_uFN_oK_ob7fjnkGJO54RNn3coVsrzuIoNa6AI6oWLfsaJ5NyQYor5P0';
  
  say urlsafe_b64decode($str);
  </code></pre>
  
  <p>=== Go code - rises error</p>
  
  <pre><code>package main
  
  import (
      b64 "encoding/base64"
      "fmt"
  )
  
  func main() {
      str := "Oi6cQzmolrUhkgHsNehtj9p_OsasB_6CIeygK0owoxTsXCtVWyQi-7DXxIJiaV-kSc6PGNC6uNz5V0A9QOGCaeCy6PolQY2Lt_v4JM42VEbsuML8guHfMO0ydvbXVcCR-yLfkz5CO0f-P1hVqxJBD8qPvk1t1DRzqmHP41DSfIm_WzlhtITnd_Wjt6E3CFS78HL3XjJlM-QBW9Z_GZgic8y7TlOWFzCRUf2Q-EZschrDi9l81E93XBNKe8knInL_uFN_oK_ob7fjnkGJO54RNn3coVsrzuIoNa6AI6oWLfsaJ5NyQYor5P0"
  
      fmt.Println("source B64:", str)
      _, err := b64.URLEncoding.DecodeString(str)
  
      if err != nil {
          fmt.Println("error b64:", err)
      }
  }
  </code></pre>
  
  <p>=== END</p>
  
  <p>As decode returns truncated result it is impossible to use it in next step.</p>