How do I downgrade Go from 1.10 to 1.9?
Asked Answered
G

6

5

I have a problem with debugging in Go 1.10 in vscode using delve on Mac. I read here that the workaround is to downgrade to Go 1.9. Since I am new at Go, but have lots of stuff already installed, how do I do this cleanly?

Grenville answered 30/4, 2018 at 8:6 Comment(1)
Well, I just downloaded 1.9.5 darwin installer from golang.org and it uninstalled 1.10 and now the debugger works!Grenville
A
10

The same way you upgrade. That is, remove the existing version, then install the new version. Although "downgrade" isn't explicitly stated on the official docs, it does explain how to do it.

Appurtenant answered 30/4, 2018 at 8:26 Comment(0)
S
4

To downgrade Go on MacOS, for instance from [email protected] to [email protected]:

$ brew unlink [email protected]
$ brew install [email protected]
$ brew link [email protected]
Salonika answered 28/4, 2023 at 18:20 Comment(0)
T
3

First remove go from the system

  • sudo snap remove go

Then install particular version of go

  • sudo snap install --classic --channel=1.14/stable go
Tunis answered 10/10, 2020 at 5:55 Comment(0)
C
1

I don't know if you need to downgrade Go in order to reenable the debugging. I had the same problem on a Mac(10.13) and the problem seems to be XCode.

Here I've found the solution for fixing the debugging problem.

You should delete the current XCode Command Line Tools binary:

sudo rm -rf /Library/Developer/CommandLineTools

and install an older XCode Command Line Tools (for me it's working with 9.2) using one of the following links:

Congress answered 1/5, 2018 at 6:36 Comment(0)
K
0

Best way to upgrade or downgrade Go on Ubuntu is to download required version from here. Here you could have all stable and releases, along with archived versions.

after downloading you selected version you can follow further steps, i will suggest you to download tar.gz format for ubuntu machine:

  1. first of all fully remove the older version from your local by doing this

sudo rm -rf /usr/local/go /usr/local/gocache

this will remove all the local go code base but wait something more we have to do to remove fully from local, i was missing this step and it took so much time until I understood what i am missing so here is the purge stuff to remove from list

sudo apt-get purge golang

or

sudo apt remove golang-go
  1. Now install / extract your downloaded version of go inside /usr/local/go, by hitting terminal with this

tar -C /usr/local -xzf go1.10.8.linux-amd64.tar.gz

  1. after doing all above stuff , don't forget or check to GOROOT variable value you can check the value by go env if not set then export PATH=$PATH:/usr/local/go
  2. Better to test a small go program to make sure. write this inside /home/yourusername/go/test.php if you haven't changed set GOPATH value:
package main

import "fmt"

func main() {
    fmt.Println("hello world")
}
  1. run this by go run test.go

i hope it works for you!!

Knisley answered 21/2, 2019 at 15:30 Comment(0)
H
-4

I use my own fork of gvm to easily switch between go versions. The original gvm is fairly old and keeps a different gopath per go version which I found annoying and removed in my fork.

So after setting up gvm, you can do

gvm install go1.9.5 -B
gvm use go1.9.5 --default

The -B flag installs go from a binary release. If you don't add it, it will try to compile it from sources, which requires a bit more setup.

Hieroglyphic answered 30/4, 2018 at 10:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.