欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

go語言-在mac下brew升級golang

 更新時(shí)間:2021年04月25日 14:31:09   作者:qauzy  
這篇文章主要介紹了go語言-在mac下brew升級golang,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧

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

brew upgrade go

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

概述

delve 是golang調(diào)試程序。但如果版本不配套, mac下goland 調(diào)試,step over會(huì)不起作用,直接變成執(zhí)行完畢或者到下一個(gè)斷點(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。

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

相關(guān)文章

  • Golang實(shí)現(xiàn)按行讀取文件的方法小結(jié)

    Golang實(shí)現(xiàn)按行讀取文件的方法小結(jié)

    按行讀取文件相較于一次性載入,有著很多優(yōu)勢,如內(nèi)存效率高、處理速度快、實(shí)時(shí)性高等,本文主要介紹了Golang按行讀取文件的相關(guān)方法,希望對大家有所幫助
    2024-02-02
  • 深入理解Go設(shè)計(jì)模式之代理模式

    深入理解Go設(shè)計(jì)模式之代理模式

    代理模式是一種結(jié)構(gòu)型設(shè)計(jì)模式,?其中代理控制著對于原對象的訪問,?并允許在將請求提交給原對象的前后進(jìn)行一些處理,從而增強(qiáng)原對象的邏輯處理,這篇文章主要來學(xué)習(xí)一下代理模式的構(gòu)成和用法,需要的朋友可以參考下
    2023-05-05
  • golang copy函數(shù)使用的坑

    golang copy函數(shù)使用的坑

    本文主要介紹了golang copy函數(shù)使用的坑,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-04-04
  • 解決Golang 中使用WaitGroup的那點(diǎn)坑

    解決Golang 中使用WaitGroup的那點(diǎn)坑

    這篇文章主要介紹了解決Golang 中使用WaitGroup的那點(diǎn)坑,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-04-04
  • Golang實(shí)現(xiàn)WebSocket服務(wù)的項(xiàng)目實(shí)踐

    Golang實(shí)現(xiàn)WebSocket服務(wù)的項(xiàng)目實(shí)踐

    本文介紹如何使用Golang實(shí)現(xiàn)實(shí)時(shí)后端WebSocket服務(wù),首先使用Gin框架搭建http服務(wù),然后使用gorilla/websocket庫實(shí)現(xiàn)簡單后端WebSocket服務(wù),具有一定的參考價(jià)值,感興趣的可以了解一下
    2023-05-05
  • axios?gin的GET和POST請求實(shí)現(xiàn)示例

    axios?gin的GET和POST請求實(shí)現(xiàn)示例

    這篇文章主要為大家介紹了axios?gin的GET和POST請求實(shí)現(xiàn)示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步早日升職加薪
    2022-04-04
  • 詳解Golang如何優(yōu)雅判斷interface是否為nil

    詳解Golang如何優(yōu)雅判斷interface是否為nil

    這篇文章主要為大家詳細(xì)介紹了Golang如何優(yōu)雅判斷interface是否為nil的相關(guān)知識,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起了解下
    2024-01-01
  • go env環(huán)境變量配置的使用

    go env環(huán)境變量配置的使用

    在安裝和使用Go時(shí),必須要正確地配置環(huán)境變量,本文主要介紹了go env環(huán)境變量配置的使用,具有一定的參考價(jià)值,感興趣的可以了解一下
    2023-11-11
  • Golang實(shí)現(xiàn)web文件共享服務(wù)的示例代碼

    Golang實(shí)現(xiàn)web文件共享服務(wù)的示例代碼

    這篇文章主要介紹了Golang實(shí)現(xiàn)web文件共享服務(wù)的示例代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-10-10
  • golang替換無法顯示的特殊字符(\u0000,?\000,?^@)

    golang替換無法顯示的特殊字符(\u0000,?\000,?^@)

    這篇文章主要介紹了golang替換無法顯示的特殊字符,包括的字符有\(zhòng)u0000,?\000,?^@等,下文詳細(xì)資料,需要的小伙伴可以參考一下
    2022-04-04

最新評論