Unable to Display go version

0

Dear Community,

I'm using Amazon Linux to connect my Mac Terminal. While following Step 4.1 "Install Package" - so far I'm able to view the Output of "Sudo Docker Version" and "sudo /usr/local/bin/docker-compose version". (https://docs.aws.amazon.com/managed-blockchain/latest/hyperledger-fabric-dev/get-started-create-client.html)

When comes to "go version" - I keep getting Error message: -bash: go: command not found

But I have installed the latest Go and tried to Run it:

[ec2-user@ip-172-31-22-105 ~]$ cd go

[ec2-user@ip-172-31-22-105 go]$ ls CONTRIBUTING.md PATENTS SECURITY.md api codereview.cfg lib pkg test LICENSE README.md VERSION bin doc misc src

[ec2-user@ip-172-31-22-105 go]$ go version -bash: go: command not found

Any idea how to solve this? Thanks.

  • First thing to check: is the 'go' command in your $PATH env var ?

    so, type 'echo $PATH' and check if the path to go binary is in the list

    If not, add it permanently by following: https://linuxize.com/post/how-to-add-directory-to-path-in-linux/

  • Hi @Didier_AWS, thanks for getting back to me. When I type 'echo $PATH' in the linux terminal (connected to my Mac Terminal), the Output is this --> /usr/local/go/bin:/home/ec2-user/.local/bin:/home/ec2-user/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ec2-user/.local/bin:/home/ec2-user/bin:/home/ec2-user/go/src/github.com/hyperledger/fabric-ca/bin:/usr/local/go/bin

    As for the link provided, have read through it and did an update my "/.bash_profile". But still the same.

    [ec2-user@ip-172-31-22-105 ~]$ source ~/.bash_profile [ec2-user@ip-172-31-22-105 ~]$ go version -bash: go: command not found

    Kindly refer to the copied and paste of the content "/.bash_profile"

    Update PATH so that you can access the go binary system wide

    export PATH=$GOROOT/bin:$PATH export PATH=$PATH:/home/ec2-user/go/src/github.com/hyperledger/fabric-ca/bin

    export PATH=$PATH:/usr/local/go/bin

    export PATH="$HOME/bin:$PATH"

  • @Didier_AWS,

    User specific environment and startup programs

    PATH=$PATH:$HOME/.local/bin:$HOME/bin

    GOROOT is the location where Go package is installed on your system

    export GOROOT=/usr/local/go

    GOPATH is the location of your work directory

    export GOPATH=$HOME/go

    Does the above might affect it?

  • Hi @Didier_AWS - thanks for getting back to me but the problem has been resolved. All is because that the Linux Terminal Processor is running as aarch64 - ARM64 whereby I've installed the AMD instead.

    Right now, I'm able to display the go version already.

    Thanks again.

asked a year ago73 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions