濮阳杆衣贸易有限公司

主頁 > 知識庫 > go語言-在mac下brew升級golang

go語言-在mac下brew升級golang

熱門標(biāo)簽:外呼系統(tǒng)顯本地手機(jī)號 壽光微信地圖標(biāo)注 外呼系統(tǒng)用什么卡 阿克蘇地圖標(biāo)注 電話機(jī)器人軟件免費(fèi) excel地圖標(biāo)注分布數(shù)據(jù) 百度地圖標(biāo)注后傳給手機(jī) 涿州代理外呼系統(tǒng) 評價高的400電話辦理

在命令行下直接運(yùn)行:

brew upgrade go

補(bǔ)充:mac下更新delve調(diào)試go語言

概述

delve 是golang調(diào)試程序。但如果版本不配套, mac下goland 調(diào)試,step over會不起作用,直接變成執(zhí)行完畢或者到下一個斷點(diǎn)。 需要更新調(diào)試器delve解決。

go get安裝

mac下安裝delve,官方教程是兩步。

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
$ go get -u github.com/derekparker/delve/cmd/dlv

但go get 一直不返回。

homebrew 安裝

zhouhh@/Users/zhouhh $ brew install go-delve/delve/delve
Updating Homebrew...
==> Installing delve from go-delve/delve
==> Downloading https://github.com/derekparker/delve/archive/v1.0.0.tar.gz
Already downloaded: /Users/zhouhh/Library/Caches/Homebrew/delve-1.0.0.tar.gz
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
==> Generating dlv-cert
==> openssl req -new -newkey rsa:2048 -x509 -days 3650 -nodes -config dlv-cert.cfg -extensions codesign_reqext -batch -out dlv-cert.cer -keyout dlv-cert.key
==> [SUDO] Installing dlv-cert as root
==> sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain dlv-cert.cer
Last 15 lines from /Users/zhouhh/Library/Logs/Homebrew/delve/02.sudo:
2018-08-09 17:07:38 +0800
sudo
security
add-trusted-cert
-d
-r
trustRoot
-k
/Library/Keychains/System.keychain
dlv-cert.cer
If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/go-delve/homebrew-delve/issues
These open issues may also help:
Upgrade to delve fails https://github.com/go-delve/homebrew-delve/issues/20
/usr/local/Homebrew/Library/Homebrew/exceptions.rb:426:in `block in dump': undefined method `check_for_bad_install_name_tool' for #Homebrew::Diagnostic::Checks:0x007fc5df858bd8> (NoMethodError)
Did you mean?  check_for_tap_ruby_files_locations
 from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:425:in `each'
 from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:425:in `dump'
 from /usr/local/Homebrew/Library/Homebrew/brew.rb:138:in `rescue in main>'
 from /usr/local/Homebrew/Library/Homebrew/brew.rb:30:in `main>'

這是因?yàn)樽C書有問題。 可以到homebrew緩存下載的delve里處理一下。

zhouhh@/Users/zhouhh $ cd $HOME/Library/Caches/Homebrew
zhouhh@/Users/zhouhh/Library/Caches/Homebrew $ ls del*
delve-1.0.0.tar.gz
zhouhh@/Users/zhouhh/Library/Caches/Homebrew $ tar zxvf delve-1.0.0.tar.gz
zhouhh@/Users/zhouhh/Library/Caches/Homebrew $ sh delve-1.0.0/scripts/gencert.sh
Password:

再安裝成功

zhouhh@/Users/zhouhh/Library/Caches/Homebrew $ CGO_ENABLED=1 brew install go-delve/delve/delve
==> Installing delve from go-delve/delve
==> Downloading https://github.com/derekparker/delve/archive/v1.0.0.tar.gz
Already downloaded: /Users/zhouhh/Library/Caches/Homebrew/delve-1.0.0.tar.gz
==> dlv-cert is already installed, no need to create it
==> make build BUILD_SHA=v1.0.0
==> Caveats
If you get "could not launch process: could not fork/exec", you need to try
in a new terminal.
When uninstalling, to remove the dlv-cert certificate, run this command:
    $ sudo security delete-certificate -t -c dlv-cert /Library/Keychains/System.keychain
Alternatively, you may want to delete from the Keychain (with the Imported private key).
==> Summary
🍺  /usr/local/Cellar/delve/1.0.0: 6 files, 10.6MB, built in 13 seconds

安裝成功

修改ide環(huán)境

安裝完最新的 delve 后,如 brew install delve, 然后在IntelliJ或goland中點(diǎn)擊

Help → Edit Custom Properties...

添加新行

dlv.path=/usr/local/bin/dlv

保存重啟,解決step over(F8) 直接運(yùn)行完畢的bug。

以上為個人經(jīng)驗(yàn),希望能給大家一個參考,也希望大家多多支持腳本之家。如有錯誤或未考慮完全的地方,望不吝賜教。

您可能感興趣的文章:
  • golang 后臺進(jìn)程的啟動和停止操作
  • golang 阻止主goroutine退出的操作
  • 在golang xorm中使用postgresql的json,array類型的操作
  • 解決golang時間字符串轉(zhuǎn)time.Time的坑
  • golang 如何獲取map所有key的方式
  • Golang 實(shí)現(xiàn)interface類型轉(zhuǎn)string類型

標(biāo)簽:汕頭 蘭州 欽州 梅河口 吐魯番 銅川 雞西 重慶

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《go語言-在mac下brew升級golang》,本文關(guān)鍵詞  語言,在,mac,下,brew,升級,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《go語言-在mac下brew升級golang》相關(guān)的同類信息!
  • 本頁收集關(guān)于go語言-在mac下brew升級golang的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    会东县| 阜城县| 千阳县| 宝应县| 岳阳县| 花莲县| 苏尼特右旗| 同心县| 隆尧县| 商水县| 黄龙县| 涟水县| 夏邑县| 沅陵县| 二连浩特市| 东辽县| 冀州市| 洛南县| 铁岭县| 青浦区| 稷山县| 新营市| 东安县| 玉龙| 西畴县| 盖州市| 行唐县| 营山县| 同心县| 章丘市| 郑州市| 茂名市| 潞西市| 兴海县| 博乐市| 辽中县| 天峻县| 彝良县| 加查县| 高淳县| 新宾|