How to fix golang "unrecognized import path"

Recently when trying to run go get I ran into the the following error:

ewilson$ go get github.com/nu7hatch/gouuid
package crypto/md5: unrecognized import path "crypto/md5" (import path does not begin with hostname)

After some trial and error (and a few conflicting opinions) I chose to unset my $GOROOT environment variable. Apparently when you compile go (I use brew for most installations) the correct $GOROOT value becomes embedded in the go tool. When you set it manually you can end up conflicting with the correct setting.

You may actually need to run the unset command as once a variable is set it may only be unset by using the unset command.

ewilson$ unset GOROOT

Onward.

How to stop macOS Mail app from saving multiple drafts to Gmail

I was having a niggling issue when bouncing back and forth between the macOS Mail app and the web interface of Gmail. If I started composing an email in Mail I found that when I went to view the inbox via the Gmail web interface I was presented with a litany of (mostly) empty Draft messages. Annoying.

There was a simple solution which I found in Mail's Account Preferences. It is thus:

  1. Fire up Mail
  2. Go to Preferences...
  3. Select Accounts tab
  4. Select Gmail IMAP account
  5. Select Mailbox Behaviors 
  6. Uncheck "Store draft messages on the server"
  7. Save
  8. Life and your inbox are in harmony once again

The account preferences for draft messages should look like the following:

How to password protect a zip file in Mac OSX

For some reason there is no way (as of the date of this writing) to right click, zip and password protect a file in OSX. So we have to go to the Terminal app, or my preference - iTerm2.

I like to launch pretty much everything in OSX by using the shortcut/hotkey: Command + Space bar. This will open the Spotlight Search bar for you. Type “Terminal” in Spotlight, then double-click on Terminal (or select it and press the enter key) to open it. Alternatively, you can go to Finder, scroll down to “Utilities,” and then select “Terminal” from the Utilities programs folder.

In the Terminal window you'll have to navigate to the location of the file you want to zip. Once there type:

zip –e name_of_zip_file_to_create name_of_file_to_zip
  • The “-e” flag means create an encrypted zip file.
  • The first file name is what you want the zipped file to be called.
  • The second file name is the folder or file you want to zip.

Example

Erics-MBP:~ ewilson$ cd Desktop/
Erics-MBP:Desktop ewilson$ zip -e wilson.zip wilson.pdf
Enter password:
Verify password:
adding: wilson.pdf (deflated 4%)

As you can see the archive utility will ask you to enter a password twice. Complete this step and you'll have successfully password protected you zip file.