0

Been pulling out my hairs on this one, it must be so simple but for some reason I can't get it to work..

I'm using go1.15, on Ubuntu 18.04, trying to build lnd from source off of github.

I run sudo make install after all the preliminaries but keep getting error

GO111MODULE=on go install -v -tags="" -ldflags " -s -w -X github.com/lightningnetwork/lnd/build.Commit=v0.11.0-beta-199-g98da919bf1c421dd4a976506761e626e39384a8d -X github.com/lightningnetwork/lnd/build.CommitHash=98da919bf1c421dd4a976506761e626e39384a8d -X github.com/lightningnetwork/lnd/build.GoVersion= -X github.com/lightningnetwork/lnd/build.RawTags=" github.com/lightningnetwork/lnd/cmd/lnd
/bin/sh: 1: go: not found
Makefile:139: recipe for target 'install' failed
make: *** [install] Error 127

i have GOPATH=/usr/local/go and have added /usr/local/go/bin to my PATH variable

can't understand what i am doing wrong go version returns normally

I'm an intermediate programmer, but been using Linux for many years and do not understand what is going on.

jojeyh
  • 276
  • 1
  • 3
  • 12

1 Answers1

-2

Just in case somebody finds this the answer is that the golang installation instructions say to update your PATH variable in ~/.profile but this only applies to interactive shells, not scripts. So if you want to properly update this for scripts you'll have to find another way. My quick fix was just inserting a PATH update into the script itself.

Link for solution is: Bash script can't execute Go command

jojeyh
  • 276
  • 1
  • 3
  • 12
  • 7
    Your `$PATH` and other environment variables will be inherited by scripts run from your interactive shell -- but not if you run a command through `sudo` which alters the inherited environment for security reasons. – Keith Thompson Sep 22 '20 at 01:52