Removed golang but go command still works? - macos

I'm running Mac OSX Yosemite.
I'm trying update from golang 1.4 to golang 1.6. I uninstalled golang but I noticed I could still run the go command go version = go1.4.2 darwin/amd64. Why is this so?
The directions aren't super clear IMO. They say
To remove an existing Go installation This is usually /usr/local/go
(done) Remove etc/paths.d/go
I edited the bash by running go version go1.4.2 darwin/amd64

I was running into the same issue. I ended up with this solution:
cd /usr/local/bin
rm go
Removes the 'go' command
Then go back to golang.org and re-download the newest version, run the installer and when you run the 'go' command it will display 1.12.9 (As of writing this post).

You can try this
sudo apt-get remove golang-go
Then do this
sudo apt-get remove --auto-remove golang-go

I ran source ~/.bash_profile and that updated the env variables.

Related

Install specific rebar3 version on mac

I want to use rebar3 with erlang 24. The problem is, that if I install the newest rebar3 version I get the necessity for erlang 25. So I installed erlang 24 first but it did not change anything. I tried to install older rebar3 version with whom erlang 24 is compatible but so far nothing has worked.
I tried port and brew, but they show me only rebar 19 is available for downloads.
When I clone the new rebar3 version from git, and switch to an old commit from rebar16 I cannot install it. Does anyone have any ideas what could work?
Get rid of your existing homebrew erlang (if any) then use kerl to install erlang, and finally build rebar3 from source. The thing I like about kerl is you can easily switch between multiple erlang installations. Here's the jist of it...
brew unlink erlang
cd ~/
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl
./kerl build 24.3.4.7 24.3
mkdir kerlbins
./kerl install 24.3 ~/kerlbins/24.3
. ~/kerlbins/24.3/activate
git clone https://github.com/erlang/rebar3.git
cd rebar3/
./bootstrap
./rebar3 local install

Need help on setting up Beego and Bee dev tool

Go is already installed in my system.
and path variable is in .bashrc file.
# Golang
export PATH=$PATH:/usr/local/go/bin
$ go version
go version go1.16.14 linux/amd64
Now, I am willing to work with Beego and bee dev tools. For that, I installed Beego and Bee by using these commands.
$ go get -u github.com/beego/beego/v2
$ go get -u github.com/beego/bee/v2
both got successfully installed. but when I am using the command bee version it is resulting this in the Terminal.
Command 'bee' not found, did you mean:
command 'tee' from deb coreutils (8.30-3ubuntu2)
command 'see' from deb mime-support (3.64ubuntu1)
Try: sudo apt install <deb name>
I am a beginner in the programming world. I am not sure How to resolve it. Can Someone help me with this?
I had the same issue. When using the command bee is installed in home/go/bin. What I did was copy the bee file from there and paste it in usr/local/go/bin. Also I used go install instead of go get and at the end of the url I added the version I wanted, eg. #v2.0.2
You need to have GOPATH determination. If you don't, create a folder which named as go and it needs to have src,pkg,bin folders.
When you install successfully, you can see bee file in bin folder.
NOTE: You can see go environment with go env command.

Unable to install Go packages in Macbook with M1 chip

When I ran the command "go install github.com/go-delve/delve/cmd/dlv" in the delve folder, after downloading go-delve in my go path, the terminal showed the following result:
"go install github.com/go-delve/delve/cmd/dlv: mkdir /Desktop: read-only file system"
Terminal result put here
When I googled the same, I came across a website(https://www.dev2qa.com/how-to-fix-read-only-file-system-error-when-run-mkdir-command-on-macos/) which requires me to disable System Integrity Protection on my MacBook and it asks me to hold the option key or command + R immediately after Mac chimes in reboot after starting the MacBook, until I see a boot in a "console/terminal" mode.. But nothing happened when I tried doing that.
I am not knowing what to do. Please guide me through the right way to install dlv and other packages of go successfully on my Macbook.
make sure you use the right go version (1.16 or later, arm64)
$ go version
go version go1.17.1 darwin/arm64
make sure the env is right by this command
$ go env
check GOROOT GOPATH GOARCH GOBIN
try to install it directly
$ go install github.com/go-delve/delve/cmd/dlv#latest
your error occurs because you have no permission of /Desktop, and i'm sure install dlv don't need something like this, it will install to ~/go/bin

upgrade golang to 1.1.5 in vscode not showing

My os is windows 10 on which I have installed golang 1.16 and the version of golang on my vscode is 1.13 but since I am using my laptop for work, I have been asked to upgrade from 1.13 to 1.15
I did the following steps in terminal of vscode-ubuntu
$ sudo wget https://golang.org/dl/go1.15.5.linux-amd64.tar.gz
$ sudo tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz
$ export PATH=$PATH:/usr/local/go/bin
$ source ~/.bashrc
$ go version
still it shows version 1.13
I reinstalled vscode,ubuntu and wsl as the cache kept holding onto previous installations of go.
Now it correctly shows go 15 at the bottom of the vscode window.
I typed 'which-a go'
now it shows usr/local/go/bin/go
Now the issue has been resolved.Thanks again.

Install snap on Ubuntu Precise

After a purchase of ARK-20-S8A11E, i find out that it only supports ubuntu 12.04 and that network manager uses snap which only availale on ubuntu 14 onward. I need Mobilemanager to collect information of an LTE module integrated in the PC.
For that, i tried to install snap from source.
I needed "go", and with apt-get install golang, the last version installed on precise is go1. and snap uses go1.6 onward version.
Therefore, i installed the latest version of go from sources. It is well installed, the output of go --version is : go version go1.11.4 linux/amd, and tested a basid hello.go.
I followed this link for snap installation: https://github.com/snapcore/snapd/blob/master/HACKING.mdsnap.
The build command " sudo -E go build -o /tmp/snap github.com/snapcore/snapd/cmd/snap" give an output as the "go command not found".
The GOPATH and PATH are well verified, the go env also.
Could you please help me sort this issue?
Thank you,
sudo is the troublemaker here. When sudoing the $PATH env var is replaced with the secure_path from /etc/sudoers (see this and this.)
Either do not run go as sudo, add the go path to the secure_path or include the full path to go in your command (sudo -E /usr/local/bin/go build -o /tmp/snap github.com/snapcore/snapd/cmd/snap)

Resources