How to install Go

$home profile being /home/user right?

Yes.

still saying go command not found unless i put the path thing in the terminal, once i restart terminal i have to redo it. i also restarted pc and tried again, didnt work.

btw thanks for ur help

What’s the content of /home/user/.profile file?

cat /home/user/.profile

Are you running the go commands from the user terminal or from root terminal?
If you want to run the go commands from the root terminal then you need to add the /usr/local/go/bin to $PATH for root in its /root/.profile file.

" ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

I have tried running the command in user terminal, the terminal of a certain file, and root, none work unless I do the path thing.

you can add what you need to the correct file with

echo 'export PATH=$PATH:/usr/local/go/bin/' >> /home/user/.bashrc

Thank you it now works. But a few issues…

Whenever i try to build something it still does not work.

" sudo sh name_name.bat
name_name.bat: 1: @echo: not found
Building…
name_name.bat: 4: go: not found
user@name:~/github/name$ sh name_name.bat
name_name.bat: 1: @echo: not found
Building…
name_name.bat: 4: cls: not found
user@name:~/github/name"

I still cant do whats needed :(.

a .bat is a script for Windows®, it won’t work

1 Like