tweeeetyのぶろぐ的めも

アウトプットが少なかったダメな自分をアウトプット<br>\(^o^)/

【GAE】appengine(app-engine-go)をhomebrew経由でinstallするgo1.6.3 (appengine-1.9.48)から、cloud sdk経由でinstallするgo version 1.8.5 (appengine-1.9.68) にupdateするメモ

はじめに

GAE goな環境を使っています。

結構長いことgo1.6.3 (appengine-1.9.48)で困った事はなかったのですが、
goのversionの関係でtestingパッケージのt.Run()が使えなかったりとあったのでupdateしました。

以前は、homebrew経由でinstallおよびアップデートができたのですが、
いまはサポートされておらずcloud sdk経由に変わったとの事です。

その時の自分メモ

f:id:tweeeety:20180503231719p:plain

アジェンダ

  1. 環境確認
  2. google-cloud-sdkをUPDATE
  3. Components(app-engine-go)のインストール

1. 環境確認

あげる前に自分の環境をもろもろ確認しておきます。

gcloud周りの確認
gcloud コマンドまわりを確認
# 場所を確認
# gcloudはhomeに落としたままpathを通していた
# 
# 新しく入れる方は/usr/local/Caskroom配下において/usr/local/bin/gcloudにsymlink予定
/Users/tweeeety/google-cloud-sdk/bin/gcloud

$ ls -la /Users/tweeeety/google-cloud-sdk/bin/gcloud
-rwxr-xr-x  1 tweeeety  tweeeety Users  3089 10 10  2017 /Users/tweeeety/google-cloud-sdk/bin/gcloud

# pathを確認
$ vim ~/.bash_profile
-- vim確認 --
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/tweeeety/google-cloud-sdk/path.bash.inc' ]; then source '/Users/tweeeety/google-cloud-sdk/path.bash.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/tweeeety/google-cloud-sdk/completion.bash.inc' ]; then source '/Users/tweeeety/google-cloud-sdk/completion.bash.inc'; fi
------------

# gcloudのversionを確認
$ gcloud version
Google Cloud SDK 175.0.0
app-engine-python 1.9.61
beta 2017.09.15
bq 2.0.27
core 2017.10.09
gcloud 
gsutil 4.27
Updates are available for some Cloud SDK components.  To install them,
please run:
  $ gcloud components update

Updates are available for some Cloud SDK components.  To install them,
please run:
  $ gcloud components update

# gcoud 情報を確認
$ gcloud info
Google Cloud SDK [175.0.0]

Platform: [Mac OS X, x86_64] ('Darwin', 'tweeeety-MAC', '13.4.0', 'Darwin Kernel Version 13.4.0: Mon Jan 11 18:17:34 PST 2016; root:xnu-2422.115.15~1/RELEASE_X86_64', 'x86_64', 'i386')
Python Version: [2.7.14 (default, Feb  4 2018, 00:19:50)  [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)]]
Python Location: [/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python]
Site Packages: [Disabled]

Installation Root: [/Users/tweeeety/google-cloud-sdk]
Installed Components:
  core: [2017.10.09]
  app-engine-python: [1.9.61]
  gcloud: []
  beta: [2017.09.15]
  gsutil: [4.27]
  bq: [2.0.27]
System PATH: [/usr/local/opt/imagemagick@6/bin:/Users/tweeeety/google-cloud-sdk/bin:/Users/tweeeety/.plenv/shims:/Users/tweeeety/.plenv/bin:/Users/tweeeety/.nodebrew/current/bin:/Users/tweeeety/.mysqlenv/mysqls/5.1.69/bin:/Users/tweeeety/.mysqlenv/bin:/Users/tweeeety/.mysqlenv/shims:/Users/tweeeety/.mysqlenv/mysql-build/bin:/usr/local/sbin:/Users/tweeeety/.mysqlenv/bin:/Users/tweeeety/.mysqlenv/shims:/Users/tweeeety/.mysqlenv/mysql-build/bin:/usr/local/heroku/bin:/Users/tweeeety/.chefdk/gem/ruby/2.1.0/bin:/opt/chefdk/bin:/Users/tweeeety/.rbenv/shims:/Users/tweeeety/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/go/bin:/sbin:/usr/sbin:/Users/tweeeety/local/bin:/usr/local/opt/go/libexec/bin:/Users/tweeeety/.go/bin]
Python PATH: [/Users/tweeeety/google-cloud-sdk/lib/third_party:/Users/tweeeety/google-cloud-sdk/lib:/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python27.zip:/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7:/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin:/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac:/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages:/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk:/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old:/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload]
Cloud SDK on PATH: [True]
Kubectl on PATH: [False]

WARNING: There are old versions of the Google Cloud Platform tools on your system PATH.
  /usr/local/Cellar/app-engine-go-64/1.9.48/share/app-engine-go-64/dev_appserver.py
  /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/bq
  /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gcloud
  /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gsutil

Installation Properties: [/Users/tweeeety/google-cloud-sdk/properties]
User Config Directory: [/Users/tweeeety/.config/gcloud]
Active Configuration Name: [sample]
Active Configuration Path: [/Users/tweeeety/.config/gcloud/configurations/config_sample]

Account: [tweeeety@hoge.jp]
Project: [hoge-fuga-gcp]

Current Properties:
  [core]
    project: [hoge-fuga-gcp]
    account: [tweeeety@hoge.jp]
    disable_usage_reporting: [False]
  [compute]
    region: [asia-east1]
    zone: [asia-east1-b]

Logs Directory: [/Users/tweeeety/.config/gcloud/logs]
Last Log File: [/Users/tweeeety/.config/gcloud/logs/2018.04.24/19.25.04.354908.log]

git: [git version 1.9.3 (Apple Git-50)]
ssh: [OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011]
gcloud以外のcommponentsを確認

ついで程度ですが、componensまわりを確認してみます

$ which gsutil
/Users/tweeeety/google-cloud-sdk/bin/gsutil

$ goapp version
go version go1.6.3 (appengine-1.9.48) darwin/amd64

# goappはhomebrewで入れた?か忘れたがCellarに入っていた
# 新しく入れる方は/usr/local/Caskroom配下になる予定
$ which goapp
/usr/local/bin/goapp

$ ls -al /usr/local/bin/goapp
lrwxr-xr-x  1 tweeeety  admin  43  1 11  2017 /usr/local/bin/goapp -> ../Cellar/app-engine-go-64/1.9.48/bin/goapp

2. google-cloud-sdkをUPDATE

まず、以前にgoogle-cloud-sdkbrew caskにて入れていたようなのでその辺の確認から行います。

gcloudの再インストール

# versionを確認
$ brew cask --version
Homebrew-Cask 1.6.1
caskroom/homebrew-cask (git revision 385494; last commit 2018-04-23)

# caskで入れたlistを確認
$ brew cask list
google-cloud-sdk
vagrant

# そのままinstallしてみるが
# re-installしてねと言われる...まぁそうだね
$ brew cask install google-cloud-sdk
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (caskroom/cask, homebrew/core, phinze/cask).
==> Updated Formulae
ruby-build ✔     bettercap        cayley           dcd              emscripten       folly            heroku           ice              juju             knot-resolver    meson            r                silk             telegraf         watson
vim ✔            bluepill         cockroach        dscanner         fobis            gollum           hugo             jruby            jvgrep           libsass          pqiv             rocksdb          skaffold         tokei            xonsh

Warning: Cask 'google-cloud-sdk' is already installed.

To re-install google-cloud-sdk, run:

# すなおにreinstall
$ brew cask reinstall google-cloud-sdk
==> Caveats
google-cloud-sdk is installed at /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk. Add your profile:

  for bash users
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc'
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc'

  for zsh users
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc'
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc'

~ 省略 ~ 

==> Your current Cloud SDK version is: 198.0.0
==> Installing components from version: 198.0.0
==> 
==> +----------------------------------------------------------------------------+
==> |                    These components will be installed.                     |
==> +-----------------------------------------------------+------------+---------+
==> |                         Name                        |  Version   |   Size  |
==> +-----------------------------------------------------+------------+---------+
==> | BigQuery Command Line Tool                          |     2.0.32 | < 1 MiB |
==> | BigQuery Command Line Tool (Platform Specific)      |     2.0.26 | < 1 MiB |
==> | Cloud SDK Core Libraries (Platform Specific)        | 2018.03.16 | < 1 MiB |
==> | Cloud Storage Command Line Tool                     |       4.30 | 3.4 MiB |
==> | Cloud Storage Command Line Tool (Platform Specific) |       4.27 | < 1 MiB |
==> | Default set of gcloud commands                      |            |         |
==> | gcloud cli dependencies                             | 2017.10.20 | 1.4 MiB |
==> +-----------------------------------------------------+------------+---------+

~ 省略 ~ 

==> For the latest full release notes, please visit:
==>   https://cloud.google.com/sdk/release_notes
🍺  google-cloud-sdk was successfully installed!

最後にビールの絵とともにgoogle-cloud-sdk was successfully installed!と言われます

gcloudコマンドの初期化(ログイン)

公式を参考に行いました
* Cloud SDK の初期化

公式には以下のように記載されています

通常、Cloud SDK をインストールした後、gcloud init コマンドを実行して初期設定を行います。
後で gcloud init を実行して設定を変更したり、新しい設定を作成したりすることもできます。
 

  • Cloud SDK ツールを承認して、現在のユーザー アカウントの認証情報を使用して Google Cloud Platform にアクセスできるようにします。すでにアクセスが承認されている場合はアカウントを選択できます。
  • Cloud SDK 構成をセットアップし、一連の基本プロパティを設定します。たとえば、上記のステップで設定した有効なアカウント、現在のプロジェクト、Google Compute Engine のデフォルトのリージョンとゾーン(該当する場合)などです。
gcloud init

初回の場合は、gcloud initを打ってセットアップします。
自分は既にセットアップ済みの内容を変えたくなかったのでloginのみにしました。

# そのまま打つだけ
$ gcloud init

# この後いろいろ聞かれるので設定に合わせて答える
gcloud auth login

セットアプップ構成を変えたくなかったので、
ユーザー アカウントを使用して承認だけをおこないました

# ブラウザが起動して認証を行う
$ gcloud auth login

3. Components(app-engine-go)のインストール

goappコマンドが使いたいので
app-engine-goというComponentsをインストールします。

以前にbrewで入れたものとバッティングしてうまくいかなかった編

Componentsのインストール状況を確認

念のためインストール状況を確認します

$ gcloud components list

Your current Cloud SDK version is: 175.0.0
The latest available version is: 198.0.0

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                   Components                                                   │
├──────────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│      Status      │                         Name                         │            ID            │    Size   │
├──────────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Update Available │ BigQuery Command Line Tool                           │ bq                       │   < 1 MiB │
│ Update Available │ Cloud SDK Core Libraries                             │ core                     │   7.6 MiB │
│ Update Available │ Cloud Storage Command Line Tool                      │ gsutil                   │   3.4 MiB │
│ Update Available │ gcloud app Python Extensions                         │ app-engine-python        │   6.1 MiB │
│ Not Installed    │ App Engine Go Extensions                             │ app-engine-go            │ 151.3 MiB │
│ Not Installed    │ Cloud Bigtable Command Line Tool                     │ cbt                      │   4.7 MiB │
│ Not Installed    │ Cloud Bigtable Emulator                              │ bigtable                 │   3.8 MiB │
│ Not Installed    │ Cloud Datalab Command Line Tool                      │ datalab                  │   < 1 MiB │
│ Not Installed    │ Cloud Datastore Emulator                             │ cloud-datastore-emulator │  17.9 MiB │
│ Not Installed    │ Cloud Datastore Emulator (Legacy)                    │ gcd-emulator             │  38.1 MiB │
│ Not Installed    │ Cloud Pub/Sub Emulator                               │ pubsub-emulator          │  33.4 MiB │
│ Not Installed    │ Emulator Reverse Proxy                               │ emulator-reverse-proxy   │  14.5 MiB │
│ Not Installed    │ Google Container Local Builder                       │ container-builder-local  │   4.3 MiB │
│ Not Installed    │ Google Container Registry's Docker credential helper │ docker-credential-gcr    │   2.5 MiB │
│ Not Installed    │ gcloud Alpha Commands                                │ alpha                    │   < 1 MiB │
│ Not Installed    │ gcloud app Java Extensions                           │ app-engine-java          │ 118.9 MiB │
│ Not Installed    │ gcloud app PHP Extensions                            │ app-engine-php           │  21.9 MiB │
│ Not Installed    │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras │  28.5 MiB │
│ Not Installed    │ kubectl                                              │ kubectl                  │  12.2 MiB │
│ Installed        │ gcloud Beta Commands                                 │ beta                     │   < 1 MiB │
└──────────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
To install or remove components at your current SDK version [175.0.0], run:
  $ gcloud components install COMPONENT_ID
  $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [198.0.0], run:
  $ gcloud components update

Update Available のものをUpdateしろよなと言われています。

Componentsのupdates

素直にupdateも行います

$ gcloud components update

Your current Cloud SDK version is: 175.0.0
You will be upgraded to version: 198.0.0

┌─────────────────────────────────────────────────────────────────────┐
│                  These components will be updated.                  │
├──────────────────────────────────────────────┬────────────┬─────────┤
│                     Name                     │  Version   │   Size  │
├──────────────────────────────────────────────┼────────────┼─────────┤
│ BigQuery Command Line Tool                   │     2.0.32 │ < 1 MiB │
│ Cloud SDK Core Libraries                     │ 2018.04.13 │ 7.6 MiB │
│ Cloud SDK Core Libraries (Platform Specific) │ 2018.03.16 │ < 1 MiB │
│ Cloud Storage Command Line Tool              │       4.30 │ 3.4 MiB │
│ gcloud app Python Extensions                 │     1.9.69 │ 6.1 MiB │
│ gcloud cli dependencies                      │ 2018.04.06 │ 1.6 MiB │
│ gcloud cli dependencies                      │ 2017.10.20 │ 1.4 MiB │
└──────────────────────────────────────────────┴────────────┴─────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│                     These components will be installed.                     │
├─────────────────────────────────┬─────────────────────┬─────────────────────┤
│               Name              │       Version       │         Size        │
├─────────────────────────────────┼─────────────────────┼─────────────────────┤
│ gRPC python library             │               1.9.1 │             7.6 MiB │
│ gRPC python library             │                     │                     │
└─────────────────────────────────┴─────────────────────┴─────────────────────┘

A lot has changed since your last upgrade.  For the latest full release notes,
please visit:
  https://cloud.google.com/sdk/release_notes

Do you want to continue (Y/n)?  Y

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: BigQuery Command Line Tool                 ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Cloud SDK Core Libraries                   ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Cloud SDK Core Libraries (Platform Spec... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Cloud Storage Command Line Tool            ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: gcloud app Python Extensions               ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: gcloud cli dependencies                    ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: gcloud cli dependencies                    ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool                   ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud SDK Core Libraries                     ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud SDK Core Libraries (Platform Specific) ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool              ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gRPC python library                          ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gRPC python library                          ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud app Python Extensions                 ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies                      ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies                      ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.                                                                                                                                                                                                                       

==> Start a new shell for the changes to take effect.


Update done!

To revert your SDK to the previously installed version, you may run:
  $ gcloud components update --version 175.0.0

WARNING:   There are older versions of Google Cloud Platform tools on your system PATH.
  Please remove the following to avoid accidentally invoking these old tools:

/usr/local/Cellar/app-engine-go-64/1.9.48/share/app-engine-go-64/dev_appserver.py
/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/bq
/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gcloud
/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gsutil

と、warningが...
以前、別の方法で入れたヤツがいるぞ と教えてくれてます....

Componentsのupdates後の確認

念のためgcloud components list で確認すると
StatusはInstalledに変わっているのでupdateはされたようです。

$ gcloud components list

Your current Cloud SDK version is: 198.0.0
The latest available version is: 198.0.0

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                  Components                                                 │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│     Status    │                         Name                         │            ID            │    Size   │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Not Installed │ App Engine Go Extensions                             │ app-engine-go            │ 151.3 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool                     │ cbt                      │   4.7 MiB │
│ Not Installed │ Cloud Bigtable Emulator                              │ bigtable                 │   3.8 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool                      │ datalab                  │   < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator                             │ cloud-datastore-emulator │  17.9 MiB │
│ Not Installed │ Cloud Datastore Emulator (Legacy)                    │ gcd-emulator             │  38.1 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator                               │ pubsub-emulator          │  33.4 MiB │
│ Not Installed │ Emulator Reverse Proxy                               │ emulator-reverse-proxy   │  14.5 MiB │
│ Not Installed │ Google Container Local Builder                       │ container-builder-local  │   4.3 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr    │   2.5 MiB │
│ Not Installed │ gcloud Alpha Commands                                │ alpha                    │   < 1 MiB │
│ Not Installed │ gcloud app Java Extensions                           │ app-engine-java          │ 118.9 MiB │
│ Not Installed │ gcloud app PHP Extensions                            │ app-engine-php           │  21.9 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras │  28.5 MiB │
│ Not Installed │ kubectl                                              │ kubectl                  │  12.2 MiB │
│ Installed     │ BigQuery Command Line Tool                           │ bq                       │   < 1 MiB │
│ Installed     │ Cloud SDK Core Libraries                             │ core                     │   7.6 MiB │
│ Installed     │ Cloud Storage Command Line Tool                      │ gsutil                   │   3.4 MiB │
│ Installed     │ gcloud Beta Commands                                 │ beta                     │   < 1 MiB │
│ Installed     │ gcloud app Python Extensions                         │ app-engine-python        │   6.1 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
To install or remove components at your current SDK version [198.0.0], run:
  $ gcloud components install COMPONENT_ID
  $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [198.0.0], run:
  $ gcloud components update
app-engine-goを入れたい
app-engine-goが以前のものとバッティング
# 念のため確認
# brewで入れたやつがいるけど...
$ goapp version
go version go1.6.3 (appengine-1.9.48) darwin/amd64

# gcloudコマンドでインストール
$ gcloud components install app-engine-go


Your current Cloud SDK version is: 198.0.0
Installing components from version: 198.0.0

┌────────────────────────────────────────────────┐
│      These components will be installed.       │
├──────────────────────────┬─────────┬───────────┤
│           Name           │ Version │    Size   │
├──────────────────────────┼─────────┼───────────┤
│ App Engine Go Extensions │         │           │
│ App Engine Go Extensions │  1.9.64 │ 151.3 MiB │
└──────────────────────────┴─────────┴───────────┘

For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

Do you want to continue (Y/n)?  Y

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: App Engine Go Extensions                     ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: App Engine Go Extensions                     ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.                                                                                                                                                                                                                       

Update done!

WARNING:   There are older versions of Google Cloud Platform tools on your system PATH.
  Please remove the following to avoid accidentally invoking these old tools:

/usr/local/Cellar/app-engine-go-64/1.9.48/share/app-engine-go-64/dev_appserver.py
/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/bq
/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gcloud
/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gsutil

# ↑この変にolderなやつがいるぞと教えてくれる
# さらにはremoveしろと...

# 当然goappも以前のまま
$ goapp version
go version go1.6.3 (appengine-1.9.48) darwin/amd64
brewで入れた方を消す

最初から消せば良かったのですが、ここでようやく消します。

# brewで入れか確認
$ brew list | grep app-engine
app-engine-go-64

# appengine系のコマンドも、きっとbrew経由のままだろうな、を確認
$ ls -al /usr/local/bin/appcfg.py
lrwxr-xr-x  1 tweeeety  admin  47  1 11  2017 /usr/local/bin/appcfg.py -> ../Cellar/app-engine-go-64/1.9.48/bin/appcfg.py

# 一応unlinkだけしてみる
$ brew unlink app-engine-go-64
Unlinking /usr/local/Cellar/app-engine-go-64/1.9.48... 7 symlinks removed

# リンクは外れた
$ goapp version
-bash: /usr/local/bin/goapp: No such file or directory

# 思い切ってremove
$ brew remove app-engine-go-64
Uninstalling /usr/local/Cellar/app-engine-go-64/1.9.48... (9,842 files, 247.8MB)
app-engine-go-64 1.9.38 1 is still installed.
Remove all versions with `brew uninstall --force app-engine-go-64`.

# ↑でRemove allしてよね、と言われてるが再度確認
# やっぱりまだいる
$ brew list | grep app-engine-
app-engine-go-64

# 再度消す
$ brew remove app-engine-go-64
Uninstalling /usr/local/Cellar/app-engine-go-64/1.9.38... (6,634 files, 225.0MB)

# gcloudコマンドもhomeに置いたままなので、この辺も消す
$ which gcloud
/Users/tweeeety/google-cloud-sdk/bin/gcloud

# 消す(いったん移動...)
$ mv ~/google-cloud-sdk .google-cloud-sdk

# 再度確認すると、Caskroomの方に切り替わってくれた模様
$ which gcloud 
/usr/local/bin/gcloud

$ ls -al /usr/local/bin/gcloud
lrwxr-xr-x  1 tweeeety  admin  71  4 24 22:10 /usr/local/bin/gcloud -> /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gcloud

# 以前入れた方のpathをコメントアウト
$ vim ~/.bash_profile
-- vi編集 --
# The next line updates PATH for the Google Cloud SDK.
#if [ -f '/Users/tweeeety/google-cloud-sdk/path.bash.inc' ]; then source '/Users/tweeeety/google-cloud-sdk/path.bash.inc'; fi

# The next line enables shell command completion for gcloud.
#if [ -f '/Users/tweeeety/google-cloud-sdk/completion.bash.inc' ]; then source '/Users/tweeeety/google-cloud-sdk/completion.bash.inc'; fi
------------

再度、app-engine-goをインストールでうまくいった編

$ gcloud components install app-engine-go


Your current Cloud SDK version is: 198.0.0
Installing components from version: 198.0.0

┌────────────────────────────────────────────────────┐
│        These components will be installed.         │
├──────────────────────────────┬─────────┬───────────┤
│             Name             │ Version │    Size   │
├──────────────────────────────┼─────────┼───────────┤
│ App Engine Go Extensions     │         │           │
│ App Engine Go Extensions     │  1.9.64 │ 151.3 MiB │
│ gRPC python library          │   1.9.1 │   7.6 MiB │
│ gRPC python library          │         │           │
│ gcloud app Python Extensions │  1.9.69 │   6.1 MiB │
└──────────────────────────────┴─────────┴───────────┘

For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

Do you want to continue (Y/n)?  Y

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: App Engine Go Extensions                     ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: App Engine Go Extensions                     ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gRPC python library                          ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gRPC python library                          ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud app Python Extensions                 ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.                                                                                                                                                                                                                       

Update done!

# パスを通して反映
vim ~/.bash_profile
-- vim追記 --
export PATH=$PATH:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine
-------------

$ source ~/.bash_profile

# そのままだと実行権限がついてないので実行権限をつける
$ chmod +x /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/goapp

# 無事、versionが上がりました!
$ goapp version
go version 1.8.5 (appengine-1.9.68) darwin/amd64

さらに

実行権限をつけましたが、以下も必要に応じてつけると良いです

$ chmod +x /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/goapp
$ chmod +x /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/appcfg.py
$ chmod +x /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/dev_appserver.py
$ chmod +x /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/backends_conversion.py
$ chmod +x /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/bulkload_client.py
$ chmod +x /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/bulkloader.py
$ chmod +x /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/download_appstats.py
$ chmod +x /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/endpointscfg.py

補足

以下もご参考ください

おわり

cloud sdk便利!enjoy!\(^o^)/